Chat Monitor: Add option to always include own messages
[quassel.git] / src / qtui / settingspages / chatmonitorsettingspage.cpp
index 1690722..faba1bd 100644 (file)
@@ -63,6 +63,7 @@ ChatMonitorSettingsPage::ChatMonitorSettingsPage(QWidget *parent)
     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()));
 }
@@ -79,6 +80,7 @@ void ChatMonitorSettingsPage::defaults()
     settings["OperationMode"] = ChatViewSettings::OptOut;
     settings["ShowHighlights"] = false;
     settings["ShowOwnMsgs"] = false;
+    settings["AlwaysOwn"] = false;
     settings["Buffers"] = QVariant();
     settings["Default"] = true;
     settings["ShowBacklog"] = true;
@@ -99,6 +101,7 @@ void ChatMonitorSettingsPage::load()
     ui.operationMode->setCurrentIndex(settings["OperationMode"].toInt() - 1);
     ui.showHighlights->setChecked(settings["ShowHighlights"].toBool());
     ui.showOwnMessages->setChecked(settings["ShowOwnMsgs"].toBool());
+    ui.alwaysOwn->setChecked(settings["AlwaysOwn"].toBool());
     ui.showBacklog->setChecked(settings["ShowBacklog"].toBool());
     ui.includeRead->setChecked(settings["IncludeRead"].toBool());
 
@@ -132,6 +135,7 @@ void ChatMonitorSettingsPage::loadSettings()
 
     settings["ShowHighlights"] = chatViewSettings.value("ShowHighlights", false);
     settings["ShowOwnMsgs"] = chatViewSettings.value("ShowOwnMsgs", false);
+    settings["AlwaysOwn"] = chatViewSettings.value("AlwaysOwn", false);
     settings["Buffers"] = chatViewSettings.value("Buffers", QVariantList());
     settings["ShowBacklog"] = chatViewSettings.value("ShowBacklog", true);
     settings["IncludeRead"] = chatViewSettings.value("IncludeRead", true);
@@ -145,6 +149,7 @@ void ChatMonitorSettingsPage::save()
     chatViewSettings.setValue("OperationMode", ui.operationMode->currentIndex() + 1);
     chatViewSettings.setValue("ShowHighlights", ui.showHighlights->isChecked());
     chatViewSettings.setValue("ShowOwnMsgs", ui.showOwnMessages->isChecked());
+    chatViewSettings.setValue("AlwaysOwn", ui.alwaysOwn->isChecked());
     chatViewSettings.setValue("ShowBacklog", ui.showBacklog->isChecked());
     chatViewSettings.setValue("IncludeRead", ui.includeRead->isChecked());
 
@@ -175,6 +180,8 @@ bool ChatMonitorSettingsPage::testHasChanged()
         return true;
     if (settings["ShowOwnMsgs"].toBool() != ui.showOwnMessages->isChecked())
         return true;
+    if (settings["AlwaysOwn"].toBool() != ui.alwaysOwn->isChecked())
+        return true;
     if (settings["ShowBacklog"].toBool() != ui.showBacklog->isChecked())
         return true;
     if (settings["IncludeRead"].toBool() != ui.includeRead->isChecked())