From: Manuel Nickschas Date: Tue, 21 Oct 2008 11:32:08 +0000 (+0200) Subject: Make custom highlights work again X-Git-Tag: 0.3.1~150 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=01ed2953cbad3f2de3df262dc1601e82d903b4a8;ds=sidebyside Make custom highlights work again As a side effect, you'll have to set your custom highlights again, we have moved stuff around in the config. --- diff --git a/src/client/clientsettings.cpp b/src/client/clientsettings.cpp index 31200782..02a8c9cb 100644 --- a/src/client/clientsettings.cpp +++ b/src/client/clientsettings.cpp @@ -112,19 +112,19 @@ NotificationSettings::NotificationSettings() : ClientSettings("Notification") { } void NotificationSettings::setHighlightList(const QVariantList &highlightList) { - setLocalValue("highlightList", highlightList); + setLocalValue("Highlights/CustomList", highlightList); } QVariantList NotificationSettings::highlightList() { - return localValue("highlightList").toList(); + return localValue("Highlights/CustomList").toList(); } void NotificationSettings::setHighlightNick(NotificationSettings::HighlightNickType highlightNickType) { - setLocalValue("highlightNick", highlightNickType); + setLocalValue("Highlights/HighlightNick", highlightNickType); } NotificationSettings::HighlightNickType NotificationSettings::highlightNick() { - return (NotificationSettings::HighlightNickType) localValue("highlightNick", CurrentNick).toInt(); + return (NotificationSettings::HighlightNickType) localValue("Highlights/HighlightNick", CurrentNick).toInt(); } void NotificationSettings::setNicksCaseSensitive(bool cs) { @@ -132,5 +132,5 @@ void NotificationSettings::setNicksCaseSensitive(bool cs) { } bool NotificationSettings::nicksCaseSensitive() { - return localValue("Highlights/NicksCaseSensitive", true).toBool(); + return localValue("Highlights/NicksCaseSensitive", false).toBool(); } diff --git a/src/qtui/qtuimessageprocessor.cpp b/src/qtui/qtuimessageprocessor.cpp index e7fa1983..095b3e62 100644 --- a/src/qtui/qtuimessageprocessor.cpp +++ b/src/qtui/qtuimessageprocessor.cpp @@ -40,8 +40,8 @@ QtUiMessageProcessor::QtUiMessageProcessor(QObject *parent) _highlightNick = notificationSettings.highlightNick(); highlightListChanged(notificationSettings.highlightList()); notificationSettings.notify("Highlights/NicksCaseSensitive", this, SLOT(nicksCaseSensitiveChanged(const QVariant &))); - notificationSettings.notify("highlightList", this, SLOT(highlightListChanged(const QVariant &))); - notificationSettings.notify("highlightNick", this, SLOT(highlightNickChanged(const QVariant &))); + notificationSettings.notify("Highlights/CustomList", this, SLOT(highlightListChanged(const QVariant &))); + notificationSettings.notify("Highlights/HighlightNick", this, SLOT(highlightNickChanged(const QVariant &))); _processTimer.setInterval(0); connect(&_processTimer, SIGNAL(timeout()), this, SLOT(processNextMessage())); @@ -174,13 +174,12 @@ void QtUiMessageProcessor::highlightListChanged(const QVariant &variant) { _highlightRules.clear(); QVariantList::const_iterator iter = varList.constBegin(); - QVariantList::const_iterator iterEnd = varList.constEnd(); - while(iter != iterEnd) { - QVariantMap rule; - _highlightRules << HighlightRule(rule["name"].toString(), - rule["enable"].toBool(), - rule["cs"].toBool() ? Qt::CaseSensitive : Qt::CaseInsensitive, - rule["regex"].toBool()); + while(iter != varList.constEnd()) { + QVariantMap rule = iter->toMap(); + _highlightRules << HighlightRule(rule["Name"].toString(), + rule["Enable"].toBool(), + rule["CS"].toBool() ? Qt::CaseSensitive : Qt::CaseInsensitive, + rule["RegEx"].toBool()); iter++; } } diff --git a/src/qtui/settingspages/highlightsettingspage.cpp b/src/qtui/settingspages/highlightsettingspage.cpp index 45567d1d..77aa2972 100644 --- a/src/qtui/settingspages/highlightsettingspage.cpp +++ b/src/qtui/settingspages/highlightsettingspage.cpp @@ -63,7 +63,7 @@ bool HighlightSettingsPage::hasDefaults() const { void HighlightSettingsPage::defaults() { ui.highlightCurrentNick->setChecked(true); - ui.nicksCaseSensitive->setChecked(true); + ui.nicksCaseSensitive->setChecked(false); emptyTable(); widgetHasChanged(); @@ -102,10 +102,10 @@ void HighlightSettingsPage::addNewRow(QString name, bool regex, bool cs, bool en ui.highlightTable->setItem(lastRow, HighlightSettingsPage::EnableColumn, enableItem); QVariantMap highlightRule; - highlightRule["name"] = name; - highlightRule["regex"] = regex; - highlightRule["cs"] = cs; - highlightRule["enable"] = enable; + highlightRule["Name"] = name; + highlightRule["RegEx"] = regex; + highlightRule["CS"] = cs; + highlightRule["Enable"] = enable; highlightList.append(highlightRule); } @@ -157,16 +157,16 @@ void HighlightSettingsPage::tableChanged(QTableWidgetItem *item) { case HighlightSettingsPage::NameColumn: if(item->text() == "") item->setText(tr("this shouldn't be empty")); - highlightRule["name"] = item->text(); + highlightRule["Name"] = item->text(); break; case HighlightSettingsPage::RegExColumn: - highlightRule["regex"] = (item->checkState() == Qt::Checked); + highlightRule["RegEx"] = (item->checkState() == Qt::Checked); break; case HighlightSettingsPage::CsColumn: - highlightRule["cs"] = (item->checkState() == Qt::Checked); + highlightRule["CS"] = (item->checkState() == Qt::Checked); break; case HighlightSettingsPage::EnableColumn: - highlightRule["enable"] = (item->checkState() == Qt::Checked); + highlightRule["Enable"] = (item->checkState() == Qt::Checked); break; } highlightList[item->row()] = highlightRule; @@ -180,10 +180,10 @@ void HighlightSettingsPage::load() { foreach(QVariant highlight, notificationSettings.highlightList()) { QVariantMap highlightRule = highlight.toMap(); - QString name = highlightRule["name"].toString(); - bool regex = highlightRule["regex"].toBool(); - bool cs = highlightRule["cs"].toBool(); - bool enable = highlightRule["enable"].toBool(); + QString name = highlightRule["Name"].toString(); + bool regex = highlightRule["RegEx"].toBool(); + bool cs = highlightRule["CS"].toBool(); + bool enable = highlightRule["Enable"].toBool(); addNewRow(name, regex, cs, enable); }