Disable the highlights page when not connected
[quassel.git] / src / qtui / settingspages / corehighlightsettingspage.h
index a411662..fe0113f 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#ifndef _COREHIGHLIGHTSETTINGSPAGE_H_
-#define _COREHIGHLIGHTSETTINGSPAGE_H_
+#pragma once
 
 #include <QVariantList>
 #include <QTableWidgetItem>
-#include <highlightrulemanager.h>
-#include <ui_corehighlightsettingspage.h>
 
+#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;
+    bool hasDefaults() 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 selectHighlightRow(QTableWidgetItem *item);
+    void selectIgnoredRow(QTableWidgetItem *item);
+    void highlightTableChanged(QTableWidgetItem *item);
+    void ignoredTableChanged(QTableWidgetItem *item);
 
 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();
+
+    void setupRuleTable(QTableWidget *highlightTable) const;
 
     bool _initialized;
 };
-
-
-#endif