X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fchatmonitorsettingspage.cpp;h=e6f0435d2f1529e4a47ed4ed2862a73b3bf24d6f;hb=b40672ab5c48b577b31371c159e60d330fdd7ce5;hp=d16342b61ac58aaf20ba5d0f9e0e171a82011dc5;hpb=9d54503555534a2c554f09a33df6afa33d6308ec;p=quassel.git diff --git a/src/qtui/settingspages/chatmonitorsettingspage.cpp b/src/qtui/settingspages/chatmonitorsettingspage.cpp index d16342b6..e6f0435d 100644 --- a/src/qtui/settingspages/chatmonitorsettingspage.cpp +++ b/src/qtui/settingspages/chatmonitorsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -21,12 +21,12 @@ #include "chatmonitorsettingspage.h" #include "client.h" +#include "icon.h" #include "networkmodel.h" #include "bufferviewconfig.h" #include "buffermodel.h" #include "bufferview.h" #include "bufferviewfilter.h" -#include "iconloader.h" #include "chatviewsettings.h" #include @@ -36,8 +36,8 @@ ChatMonitorSettingsPage::ChatMonitorSettingsPage(QWidget *parent) { ui.setupUi(this); - ui.activateBuffer->setIcon(SmallIcon("go-next")); - ui.deactivateBuffer->setIcon(SmallIcon("go-previous")); + ui.activateBuffer->setIcon(icon::get("go-next")); + ui.deactivateBuffer->setIcon(icon::get("go-previous")); // setup available buffers config (for the bufferview on the left) _configAvailable = new BufferViewConfig(-667, this); @@ -63,6 +63,9 @@ 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())); } @@ -74,11 +77,17 @@ 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; + settings["IncludeRead"] = false; load(); widgetHasChanged(); } @@ -95,6 +104,9 @@ 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()); // get all available buffer Ids QList allBufferIds = Client::networkModel()->allBufferIds(); @@ -121,12 +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", false); } @@ -137,6 +155,9 @@ 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()); // save list of active buffers QVariantList saveableBufferIdList; @@ -165,6 +186,12 @@ 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()) + return true; if (_configActive->bufferList().count() != settings["Buffers"].toList().count()) return true;