X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fignorelistsettingspage.h;h=f3bcab709ee0e2183a7d255070441fd62a7d10a8;hp=4e2e85c61470d36e6a274d7638f93ba1759fe1bf;hb=a95ad2de573027f9bee36db972bcae4195168d0c;hpb=88af3f967343754d06b989eef3682945eb73e346 diff --git a/src/qtui/settingspages/ignorelistsettingspage.h b/src/qtui/settingspages/ignorelistsettingspage.h index 4e2e85c6..f3bcab70 100644 --- a/src/qtui/settingspages/ignorelistsettingspage.h +++ b/src/qtui/settingspages/ignorelistsettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,83 +15,89 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef IGNORELISTSETTINGSPAGE_H #define IGNORELISTSETTINGSPAGE_H -#include #include +#include +#include "clientignorelistmanager.h" +#include "ignorelistmodel.h" #include "settingspage.h" -#include "ui_ignorelistsettingspage.h" + #include "ui_ignorelisteditdlg.h" -#include "ignorelistmodel.h" -#include "clientignorelistmanager.h" +#include "ui_ignorelistsettingspage.h" class QEvent; class QPainter; class QAbstractItemModel; // the delegate is used to draw the checkbox in column 0 -class IgnoreListDelegate : public QStyledItemDelegate { - Q_OBJECT +class IgnoreListDelegate : public QStyledItemDelegate +{ + Q_OBJECT public: - IgnoreListDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent) {} - void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const; - bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, - const QModelIndex &index); + IgnoreListDelegate(QWidget* parent = nullptr) + : QStyledItemDelegate(parent) + {} + void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; + bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) override; }; -class IgnoreListEditDlg : public QDialog { - Q_OBJECT +class IgnoreListEditDlg : public QDialog +{ + Q_OBJECT public: - IgnoreListEditDlg(int row, const IgnoreListManager::IgnoreListItem &item, QWidget *parent = 0); - inline IgnoreListManager::IgnoreListItem ignoreListItem() { return _ignoreListItem; } + IgnoreListEditDlg(const IgnoreListManager::IgnoreListItem& item, QWidget* parent = nullptr, bool enabled = false); + inline IgnoreListManager::IgnoreListItem ignoreListItem() { return _ignoreListItem; } + void enableOkButton(bool state); private slots: - void widgetHasChanged(); - void aboutToAccept() { _ignoreListItem = _clonedIgnoreListItem; } + void widgetHasChanged(); + void aboutToAccept() { _ignoreListItem = _clonedIgnoreListItem; } + private: - int _selectedRow; - IgnoreListManager::IgnoreListItem _ignoreListItem; - IgnoreListManager::IgnoreListItem _clonedIgnoreListItem; - bool _hasChanged; - Ui::IgnoreListEditDlg ui; - QButtonGroup _typeButtonGroup; - QButtonGroup _strictnessButtonGroup; - QButtonGroup _scopeButtonGroup; + IgnoreListManager::IgnoreListItem _ignoreListItem; + IgnoreListManager::IgnoreListItem _clonedIgnoreListItem; + bool _hasChanged; + Ui::IgnoreListEditDlg ui; + QButtonGroup _typeButtonGroup; + QButtonGroup _strictnessButtonGroup; + QButtonGroup _scopeButtonGroup; }; -class IgnoreListSettingsPage : public SettingsPage { - Q_OBJECT +class IgnoreListSettingsPage : public SettingsPage +{ + Q_OBJECT public: - IgnoreListSettingsPage(QWidget *parent = 0); - ~IgnoreListSettingsPage(); - virtual inline bool hasDefaults() const { return true; } + IgnoreListSettingsPage(QWidget* parent = nullptr); + ~IgnoreListSettingsPage() override; + inline bool hasDefaults() const override { return false; } + inline bool needsCoreConnection() const override { return true; } + void editIgnoreRule(const QString& ignoreRule); public slots: - void save(); - void load(); - void defaults(); + void save() override; + void load() override; + void defaults() override; + void newIgnoreRule(const QString& rule = {}); private slots: - void enableDialog(bool); - void deleteSelectedIgnoreRule(); - void editSelectedIgnoreRule(); - void newIgnoreRule(); - void selectionChanged(const QItemSelection &selection, const QItemSelection &); + void enableDialog(bool); + void deleteSelectedIgnoreRule(); + void editSelectedIgnoreRule(); + void selectionChanged(const QItemSelection& selection, const QItemSelection&); private: - IgnoreListDelegate *_delegate; - Ui::IgnoreListSettingsPage ui; - IgnoreListModel _ignoreListModel; + IgnoreListDelegate* _delegate; + Ui::IgnoreListSettingsPage ui; + IgnoreListModel _ignoreListModel; }; - -#endif //IGNORELISTSETTINGSPAGE_H +#endif // IGNORELISTSETTINGSPAGE_H