modernize: Replace most remaining old-style connects by PMF ones
[quassel.git] / src / qtui / settingspages / chatmonitorsettingspage.cpp
index faba1bd..bf546b1 100644 (file)
@@ -60,12 +60,12 @@ ChatMonitorSettingsPage::ChatMonitorSettingsPage(QWidget *parent)
     ui.operationMode->addItem(tr("Opt Out"), ChatViewSettings::OptOut);
 
     // connect slots
-    connect(ui.operationMode, SIGNAL(currentIndexChanged(int)), SLOT(switchOperationMode(int)));
-    connect(ui.showHighlights, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
-    connect(ui.showOwnMessages, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
-    connect(ui.alwaysOwn, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
-    connect(ui.showBacklog, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
-    connect(ui.includeRead, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
+    connect(ui.operationMode, selectOverload<int>(&QComboBox::currentIndexChanged), this, &ChatMonitorSettingsPage::switchOperationMode);
+    connect(ui.showHighlights, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged);
+    connect(ui.showOwnMessages, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged);
+    connect(ui.alwaysOwn, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged);
+    connect(ui.showBacklog, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged);
+    connect(ui.includeRead, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged);
 }
 
 
@@ -77,9 +77,12 @@ bool ChatMonitorSettingsPage::hasDefaults() const
 
 void ChatMonitorSettingsPage::defaults()
 {
+    // NOTE: Whenever changing defaults here, also update ChatMonitorFilter::ChatMonitorFilter()
+    // and ChatMonitorSettingsPage::loadSettings() to match
+
     settings["OperationMode"] = ChatViewSettings::OptOut;
     settings["ShowHighlights"] = false;
-    settings["ShowOwnMsgs"] = false;
+    settings["ShowOwnMsgs"] = true;
     settings["AlwaysOwn"] = false;
     settings["Buffers"] = QVariant();
     settings["Default"] = true;
@@ -130,15 +133,18 @@ void ChatMonitorSettingsPage::load()
 
 void ChatMonitorSettingsPage::loadSettings()
 {
+    // NOTE: Whenever changing defaults here, also update ChatMonitorFilter::ChatMonitorFilter()
+    // and ChatMonitorSettingsPage::defaults() to match
     ChatViewSettings chatViewSettings("ChatMonitor");
-    settings["OperationMode"] = (ChatViewSettings::OperationMode)chatViewSettings.value("OperationMode", ChatViewSettings::OptOut).toInt();
 
+    settings["OperationMode"] = (ChatViewSettings::OperationMode)
+            chatViewSettings.value("OperationMode", ChatViewSettings::OptOut).toInt();
     settings["ShowHighlights"] = chatViewSettings.value("ShowHighlights", false);
-    settings["ShowOwnMsgs"] = chatViewSettings.value("ShowOwnMsgs", false);
+    settings["ShowOwnMsgs"] = chatViewSettings.value("ShowOwnMsgs", true);
     settings["AlwaysOwn"] = chatViewSettings.value("AlwaysOwn", false);
     settings["Buffers"] = chatViewSettings.value("Buffers", QVariantList());
     settings["ShowBacklog"] = chatViewSettings.value("ShowBacklog", true);
-    settings["IncludeRead"] = chatViewSettings.value("IncludeRead", true);
+    settings["IncludeRead"] = chatViewSettings.value("IncludeRead", false);
 }
 
 
@@ -232,8 +238,8 @@ void ChatMonitorSettingsPage::toggleBuffers(BufferView *inView, BufferViewConfig
       This can probably be removed whenever BufferViewConfig::bulkAdd or something
       like that is available.
     */
-    qobject_cast<BufferViewFilter *>(outView->model())->setConfig(0);
-    qobject_cast<BufferViewFilter *>(inView->model())->setConfig(0);
+    qobject_cast<BufferViewFilter *>(outView->model())->setConfig(nullptr);
+    qobject_cast<BufferViewFilter *>(inView->model())->setConfig(nullptr);
 
     // actually move the ids
     foreach(QList<BufferId> list, selectedBuffers) {
@@ -274,7 +280,7 @@ void ChatMonitorSettingsPage::on_deactivateBuffer_clicked()
 */
 void ChatMonitorSettingsPage::switchOperationMode(int idx)
 {
-    ChatViewSettings::OperationMode mode = (ChatViewSettings::OperationMode)(idx + 1);
+    auto mode = (ChatViewSettings::OperationMode)(idx + 1);
     if (mode == ChatViewSettings::OptIn) {
         ui.labelActiveBuffers->setText(tr("Show:"));
     }