From: Manuel Nickschas Date: Fri, 19 Dec 2008 23:29:00 +0000 (+0100) Subject: More fixes, save state correctly, test state of checkboxes correctly X-Git-Tag: 0.4.0~352 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=572346c3a1075025a04508b8bc6b1842170c68bd More fixes, save state correctly, test state of checkboxes correctly --- diff --git a/src/qtui/settingspages/chatmonitorsettingspage.cpp b/src/qtui/settingspages/chatmonitorsettingspage.cpp index d457d3d3..c833dd8b 100644 --- a/src/qtui/settingspages/chatmonitorsettingspage.cpp +++ b/src/qtui/settingspages/chatmonitorsettingspage.cpp @@ -59,7 +59,9 @@ ChatMonitorSettingsPage::ChatMonitorSettingsPage(QWidget *parent) ui.operationMode->addItem(tr("Opt Out"), ChatViewSettings::OptOut); // connect slots - connect(ui.operationMode, SIGNAL(currentIndexChanged(int)), this, SLOT(switchOperationMode(int))); + 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())); } bool ChatMonitorSettingsPage::hasDefaults() const { @@ -69,6 +71,7 @@ bool ChatMonitorSettingsPage::hasDefaults() const { void ChatMonitorSettingsPage::defaults() { settings["OperationMode"] = ChatViewSettings::OptOut; settings["ShowHighlights"] = false; + settings["ShowOwnMsgs"] = false; settings["Buffers"] = QVariant(); settings["Default"] = true; load(); @@ -83,6 +86,7 @@ void ChatMonitorSettingsPage::load() { ui.operationMode->setCurrentIndex(settings["OperationMode"].toInt() - 1); ui.showHighlights->setChecked(settings["ShowHighlights"].toBool()); + ui.showOwnMessages->setChecked(settings["ShowOwnMsgs"].toBool()); // get all available buffer Ids QList allBufferIds = Client::networkModel()->allBufferIds(); @@ -116,14 +120,16 @@ void ChatMonitorSettingsPage::loadSettings() { settings["OperationMode"] == ChatViewSettings::OptOut; } settings["ShowHighlights"] = chatViewSettings.value("ShowHighlights", false); + settings["ShowOwnMsgs"] = chatViewSettings.value("ShowOwnMsgs", false); settings["Buffers"] = chatViewSettings.value("Buffers", QVariantList()); } void ChatMonitorSettingsPage::save() { ChatViewSettings chatViewSettings("ChatMonitor"); // save operation mode - chatViewSettings.setValue("OperationMode", settings["OperationMode"]); - chatViewSettings.setValue("ShowHighlights", settings["ShowHighlights"]); + chatViewSettings.setValue("OperationMode", ui.operationMode->currentIndex() + 1); + chatViewSettings.setValue("ShowHighlights", ui.showHighlights->isChecked()); + chatViewSettings.setValue("ShowOwnMsgs", ui.showOwnMessages->isChecked()); // save list of active buffers QVariantList saveableBufferIdList; @@ -144,6 +150,10 @@ void ChatMonitorSettingsPage::widgetHasChanged() { bool ChatMonitorSettingsPage::testHasChanged() { if(settings["OperationMode"] != ui.operationMode->itemData(ui.operationMode->currentIndex())) return true; + if(settings["ShowHighlights"].toBool() != ui.showHighlights->isChecked()) + return true; + if(settings["ShowOwnMsgs"].toBool() != ui.showOwnMessages->isChecked()) + return true; if(_configActive->bufferList().count() != settings["Buffers"].toList().count()) return true; @@ -220,12 +230,6 @@ void ChatMonitorSettingsPage::on_deactivateBuffer_clicked() { } } -void ChatMonitorSettingsPage::on_showHighlights_toggled(bool state) -{ - settings["ShowHighlights"] = state; - widgetHasChanged(); -} - /* switchOperationMode gets called on combobox signal currentIndexChanged. modeIndex is the row id in combobox itemlist diff --git a/src/qtui/settingspages/chatmonitorsettingspage.h b/src/qtui/settingspages/chatmonitorsettingspage.h index 6639339c..9498c873 100644 --- a/src/qtui/settingspages/chatmonitorsettingspage.h +++ b/src/qtui/settingspages/chatmonitorsettingspage.h @@ -45,7 +45,6 @@ class ChatMonitorSettingsPage : public SettingsPage { void widgetHasChanged(); void on_activateBuffer_clicked(); void on_deactivateBuffer_clicked(); - void on_showHighlights_toggled(bool state); void switchOperationMode(int modeIndex); private: