X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fcorehighlightsettingspage.cpp;h=b79e3e34f8acce06e167bf5a156f89c3f175c4e4;hb=6f10483c9fe74a9464d7bf9eea53ef83c3403e23;hp=5a53b4ab9329537ff0cddc6e67cbf93f6f704a67;hpb=c76b74c18766c1a6631a06bab95f2290dd860395;p=quassel.git diff --git a/src/qtui/settingspages/corehighlightsettingspage.cpp b/src/qtui/settingspages/corehighlightsettingspage.cpp index 5a53b4ab..b79e3e34 100644 --- a/src/qtui/settingspages/corehighlightsettingspage.cpp +++ b/src/qtui/settingspages/corehighlightsettingspage.cpp @@ -32,9 +32,7 @@ #include "util.h" CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget* parent) - : SettingsPage(tr("Interface"), - // In Monolithic mode, local highlights are replaced by remote highlights - Quassel::runMode() == Quassel::Monolithic ? tr("Highlights") : tr("Remote Highlights"), + : SettingsPage(tr("Interface"), tr("Highlights"), parent) { ui.setupUi(this); @@ -84,22 +82,12 @@ CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget* parent) ui.coreUnsupportedIcon->setPixmap(icon::get("dialog-warning").pixmap(16)); // Set up client/monolithic remote highlights information - if (Quassel::runMode() == Quassel::Monolithic) { - // We're running in Monolithic mode, local highlights are considered legacy - ui.highlightImport->setText(tr("Import Legacy")); - ui.highlightImport->setToolTip( - tr("Import highlight rules configured in %1.").arg(tr("Legacy Highlights").replace(" ", " "))); - // Re-use translations of "Legacy Highlights" as this is a word-for-word reference, forcing - // all spaces to be non-breaking - } - else { - // We're running in client/split mode, local highlights are distinguished from remote - ui.highlightImport->setText(tr("Import Local")); - ui.highlightImport->setToolTip( - tr("Import highlight rules configured in %1.").arg(tr("Local Highlights").replace(" ", " "))); - // Re-use translations of "Local Highlights" as this is a word-for-word reference, forcing - // all spaces to be non-breaking - } + // Local highlights are considered legacy + ui.highlightImport->setText(tr("Import Legacy")); + ui.highlightImport->setToolTip( + tr("Import highlight rules configured in %1.").arg(tr("Legacy Highlights").replace(" ", " "))); + // Re-use translations of "Legacy Highlights" as this is a word-for-word reference, forcing + // all spaces to be non-breaking } void CoreHighlightSettingsPage::coreConnectionStateChanged(bool state) @@ -681,9 +669,9 @@ void CoreHighlightSettingsPage::widgetHasChanged() void CoreHighlightSettingsPage::on_coreUnsupportedDetails_clicked() { - // Re-use translations of "Local Highlights" as this is a word-for-word reference, forcing all + // Re-use translations of "Legacy Highlights" as this is a word-for-word reference, forcing all // spaces to non-breaking - const QString localHighlightsName = tr("Local Highlights").replace(" ", " "); + const QString localHighlightsName = tr("Legacy Highlights").replace(" ", " "); const QString remoteHighlightsMsgText = QString("

%1


%2


%3

") .arg(tr("Your Quassel core is too old to support remote highlights"), @@ -704,13 +692,8 @@ void CoreHighlightSettingsPage::importRules() // Re-use translations of "Legacy/Local Highlights" as this is a word-for-word reference, // forcing all spaces to non-breaking - QString localHighlightsName; - if (Quassel::runMode() == Quassel::Monolithic) { - localHighlightsName = tr("Legacy Highlights").replace(" ", " "); - } - else { - localHighlightsName = tr("Local Highlights").replace(" ", " "); - } + // "Local Highlights" has been removed; it's always called "Legacy" now. + QString localHighlightsName = tr("Legacy Highlights").replace(" ", " "); if (localHighlightList.count() == 0) { // No highlight rules exist to import, do nothing @@ -750,14 +733,48 @@ void CoreHighlightSettingsPage::importRules() highlightRule["Channel"].toString()); } + // Copy nickname highlighting settings + clonedManager.setNicksCaseSensitive(notificationSettings.nicksCaseSensitive()); + if (notificationSettings.highlightNick() == NotificationSettings::HighlightNickType::AllNicks) { + clonedManager.setHighlightNick(HighlightRuleManager::HighlightNickType::AllNicks); + } + else if (notificationSettings.highlightNick() == NotificationSettings::HighlightNickType::CurrentNick) { + clonedManager.setHighlightNick(HighlightRuleManager::HighlightNickType::CurrentNick); + } + // else - Don't copy "NoNick", "NoNick" is now default and should be ignored + Client::highlightRuleManager()->requestUpdate(clonedManager.toVariantMap()); setChangedState(false); load(); - // Give a heads-up that all succeeded - QMessageBox::information(this, - tr("Imported highlights"), - tr("%1 highlight rules successfully imported.").arg(QString::number(localHighlightList.count()))); + // Give a heads-up that all succeeded, ask about removing old rules + // + // Hypothetically, someone might use a common set of highlight rules across multiple cores. + // This won't matter once client highlights are disabled entirely on newer cores. + // + // Remove this once client-side highlights are disabled for newer cores. + ret = QMessageBox::question(this, tr("Imported highlights"), + QString("

%1


%2

").arg( + tr("%1 highlight rules successfully imported.").arg(QString::number(localHighlightList.count())), + tr("Clean up old, duplicate highlight rules?")), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::Yes); + + if (ret != QMessageBox::Yes) { + // Only two options, Yes or No, return if not Yes + return; + } + + // Remove all local highlight rules + notificationSettings.setHighlightList({}); + // Disable local nickname highlighting + notificationSettings.setHighlightNick(NotificationSettings::HighlightNickType::NoNick); + // Disable nickname sensitivity + // This isn't needed to disable local highlights, but it's part of appearing reset-to-default + notificationSettings.setNicksCaseSensitive(false); + + // Refresh HighlightSettingsPage in case it was already loaded + emit localHighlightsChanged(); } bool CoreHighlightSettingsPage::isSelectable() const