1 /***************************************************************************
2 * Copyright (C) 2005-2018 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
23 #include <QVariantList>
24 #include <QTableWidgetItem>
26 #include "highlightrulemanager.h"
27 #include "settingspage.h"
29 #include "ui_corehighlightsettingspage.h"
31 class CoreHighlightSettingsPage : public SettingsPage
36 explicit CoreHighlightSettingsPage(QWidget *parent = nullptr);
38 bool hasDefaults() const override;
40 bool isSelectable() const override;
45 void defaults() override;
47 void clientConnected();
50 void coreConnectionStateChanged(bool state);
51 void widgetHasChanged();
52 void addNewHighlightRow(bool enable = true, const QString &name = tr("highlight rule"), bool regex = false,
53 bool cs = false, const QString &sender = "", const QString &chanName = "",
55 void addNewIgnoredRow(bool enable = true, const QString &name = tr("highlight rule"), bool regex = false,
56 bool cs = false, const QString &sender = "", const QString &chanName = "", bool self = false);
57 void removeSelectedHighlightRows();
58 void removeSelectedIgnoredRows();
59 void highlightNicksChanged(const int index);
60 void selectHighlightRow(QTableWidgetItem *item);
61 void selectIgnoredRow(QTableWidgetItem *item);
62 void highlightTableChanged(QTableWidgetItem *item);
63 void ignoredTableChanged(QTableWidgetItem *item);
65 /** Import local Highlight rules into the Core Highlight rules
67 * Iterates through all local highlight rules, converting each into core-side highlight rules.
72 * Event handler for core unspported Details button
74 void on_coreUnsupportedDetails_clicked();
77 Ui::CoreHighlightSettingsPage ui;
79 HighlightRuleManager::HighlightRuleList highlightList;
80 HighlightRuleManager::HighlightRuleList ignoredList;
92 void emptyHighlightTable();
93 void emptyIgnoredTable();
95 void setupRuleTable(QTableWidget *highlightTable) const;
97 /** Update the UI to show core support for highlights
99 * Shows or hides the UI warnings around core-side highlights according to core connection and
100 * core feature support.
102 * @param state True if connected to core, otherwise false
104 void updateCoreSupportStatus(bool state);