X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fcorehighlightsettingspage.h;h=1a0ea7115b7fa9d4d08eb3d691ab96a699bea293;hb=932ab289c1482a8069cc320a16aca9216058523a;hp=a411662e94ca6860bde086fe12eb924dbdbc3922;hpb=af39ec163d703852a8fa49dbf79c0ef694aa2e76;p=quassel.git diff --git a/src/qtui/settingspages/corehighlightsettingspage.h b/src/qtui/settingspages/corehighlightsettingspage.h index a411662e..1a0ea711 100644 --- a/src/qtui/settingspages/corehighlightsettingspage.h +++ b/src/qtui/settingspages/corehighlightsettingspage.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,56 +18,90 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef _COREHIGHLIGHTSETTINGSPAGE_H_ -#define _COREHIGHLIGHTSETTINGSPAGE_H_ +#pragma once #include #include -#include -#include +#include "highlightrulemanager.h" #include "settingspage.h" -#include "ui_highlightsettingspage.h" + +#include "ui_corehighlightsettingspage.h" class CoreHighlightSettingsPage : public SettingsPage { Q_OBJECT public: - CoreHighlightSettingsPage(QWidget *parent = 0); + explicit CoreHighlightSettingsPage(QWidget *parent = nullptr); + + bool hasDefaults() const override; - bool hasDefaults() const; + bool isSelectable() const override; public slots: - void save(); - void load(); - void defaults(); + void save() override; + void load() override; + void defaults() override; void revert(); void clientConnected(); private slots: + void coreConnectionStateChanged(bool state); void widgetHasChanged(); - void addNewRow(QString name = tr("highlight rule"), bool regex = false, bool cs = false, bool enable = true, QString chanName = "", bool self = false); - void removeSelectedRows(); - void selectRow(QTableWidgetItem *item); - void tableChanged(QTableWidgetItem *item); + void addNewHighlightRow(bool enable = true, const QString &name = tr("highlight rule"), bool regex = false, + bool cs = false, const QString &sender = "", const QString &chanName = "", + bool self = false); + void addNewIgnoredRow(bool enable = true, const QString &name = tr("highlight rule"), bool regex = false, + bool cs = false, const QString &sender = "", const QString &chanName = "", bool self = false); + void removeSelectedHighlightRows(); + void removeSelectedIgnoredRows(); + void highlightNicksChanged(const int index); + void selectHighlightRow(QTableWidgetItem *item); + void selectIgnoredRow(QTableWidgetItem *item); + void highlightTableChanged(QTableWidgetItem *item); + void ignoredTableChanged(QTableWidgetItem *item); + + /** Import local Highlight rules into the Core Highlight rules + * + * Iterates through all local highlight rules, converting each into core-side highlight rules. + */ + void importRules(); + + /** + * Event handler for core unspported Details button + */ + void on_coreUnsupportedDetails_clicked(); private: Ui::CoreHighlightSettingsPage ui; + HighlightRuleManager::HighlightRuleList highlightList; + HighlightRuleManager::HighlightRuleList ignoredList; + enum column { - NameColumn = 0, - RegExColumn = 1, - CsColumn = 2, - EnableColumn = 3, - ChanColumn = 4, - ColumnCount = 5 + EnableColumn = 0, + NameColumn = 1, + RegExColumn = 2, + CsColumn = 3, + SenderColumn = 4, + ChanColumn = 5, + ColumnCount = 6 }; - void emptyTable(); + void emptyHighlightTable(); + void emptyIgnoredTable(); - bool _initialized; -}; + void setupRuleTable(QTableWidget *highlightTable) const; + /** Update the UI to show core support for highlights + * + * Shows or hides the UI warnings around core-side highlights according to core connection and + * core feature support. + * + * @param state True if connected to core, otherwise false + */ + void updateCoreSupportStatus(bool state); -#endif + bool _initialized; +};