X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fchatmonitorsettingspage.cpp;h=f62462c4d470dee88da499ca4c1d4fdebba93360;hb=39328183a6a87c6eb10a9dbbffcd5d65bf154a1f;hp=1690722bed7bb61da8d6c04545bdd0dc1ca7c570;hpb=b7447afe8e836376776dac26704e227a678d2913;p=quassel.git diff --git a/src/qtui/settingspages/chatmonitorsettingspage.cpp b/src/qtui/settingspages/chatmonitorsettingspage.cpp index 1690722b..f62462c4 100644 --- a/src/qtui/settingspages/chatmonitorsettingspage.cpp +++ b/src/qtui/settingspages/chatmonitorsettingspage.cpp @@ -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())); } @@ -76,9 +77,13 @@ 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; settings["ShowBacklog"] = true; @@ -99,6 +104,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()); @@ -127,14 +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); } @@ -145,6 +155,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 +186,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()) @@ -225,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(outView->model())->setConfig(0); - qobject_cast(inView->model())->setConfig(0); + qobject_cast(outView->model())->setConfig(nullptr); + qobject_cast(inView->model())->setConfig(nullptr); // actually move the ids foreach(QList list, selectedBuffers) {