X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcorehighlightrulemanager.h;h=4cf3427daddb5bacd91686c11a704e9a0d49c18b;hb=f12d6496251729f7d21f4fbcb0814dec7fba4b75;hp=9cb1b634ecfc6e6d9b6a88f9f7506906d123106f;hpb=7678f2402fdb01b03b359a2266f1e7427894d82a;p=quassel.git diff --git a/src/core/corehighlightrulemanager.h b/src/core/corehighlightrulemanager.h index 9cb1b634..4cf3427d 100644 --- a/src/core/corehighlightrulemanager.h +++ b/src/core/corehighlightrulemanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,38 +18,53 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef COREHIGHLIGHTRULEMANAHER_H -#define COREHIGHLIGHTRULEMANAHER_H +#pragma once #include "highlightrulemanager.h" class CoreSession; struct RawMessage; +/** + * Core-side specialization for HighlightRuleManager. + * + * Adds the ability to load/save the settings from/to the database. + */ class CoreHighlightRuleManager : public HighlightRuleManager { + Q_OBJECT SYNCABLE_OBJECT - Q_OBJECT + + using HighlightRuleManager::match; public: - explicit CoreHighlightRuleManager(CoreSession *parent); + /** + * Constructor. + * + * @param[in] session Pointer to the parent CoreSession (takes ownership) + */ + explicit CoreHighlightRuleManager(CoreSession *session); - inline virtual const QMetaObject *syncMetaObject() const { return &HighlightRuleManager::staticMetaObject; } + virtual const QMetaObject *syncMetaObject() const override { return &HighlightRuleManager::staticMetaObject; } bool match(const RawMessage &msg, const QString ¤tNick, const QStringList &identityNicks); + public slots: - virtual inline void requestToggleHighlightRule(const QString &highlightRule) { toggleHighlightRule(highlightRule); } - virtual inline void requestRemoveHighlightRule(const QString &highlightRule) { removeHighlightRule(highlightRule); } - virtual inline void requestAddHighlightRule(const QString &name, bool isRegEx, bool isCaseSensitive, - bool isEnabled, bool isInverse, const QString &chanName) + inline void requestToggleHighlightRule(int highlightRule) override { toggleHighlightRule(highlightRule); } + inline void requestRemoveHighlightRule(int highlightRule) override { removeHighlightRule(highlightRule); } + inline void requestAddHighlightRule(int id, const QString &name, bool isRegEx, bool isCaseSensitive, + bool isEnabled, bool isInverse, const QString &sender, + const QString &chanName) override { - addHighlightRule(name, isRegEx, isCaseSensitive, isEnabled, isInverse, chanName); + addHighlightRule(id, name, isRegEx, isCaseSensitive, isEnabled, isInverse, sender, chanName); } - private slots: - void save() const; -}; - + /** + * Saves the config to the database. + */ + void save(); -#endif //COREHIGHLIGHTRULEMANAHER_H +private: + CoreSession *_coreSession {nullptr}; ///< Pointer to the parent CoreSession +};