#ifdef HAVE_SONNET
dlg->registerSettingsPage(new SonnetSettingsPage(dlg));
#endif
- dlg->registerSettingsPage(new HighlightSettingsPage(dlg));
- dlg->registerSettingsPage(new CoreHighlightSettingsPage(dlg));
+ auto coreHighlightsPage = new CoreHighlightSettingsPage(dlg);
+ auto localHighlightsPage = new HighlightSettingsPage(dlg);
+ // Let CoreHighlightSettingsPage reload HighlightSettingsPage after doing an import with
+ // cleaning up. Otherwise, HighlightSettingsPage won't show that the local rules were deleted.
+ connect(coreHighlightsPage, &CoreHighlightSettingsPage::localHighlightsChanged,
+ localHighlightsPage, &HighlightSettingsPage::load);
+ // Put core-side highlights before local/legacy highlights
+ dlg->registerSettingsPage(coreHighlightsPage);
+ dlg->registerSettingsPage(localHighlightsPage);
dlg->registerSettingsPage(new NotificationsSettingsPage(dlg));
dlg->registerSettingsPage(new BacklogSettingsPage(dlg));
#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);
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 <i>%1</i>.").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 <i>%1</i>.").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 <i>%1</i>.").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)
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("<p><b>%1</b></p></br><p>%2</p></br><p>%3</p>")
.arg(tr("Your Quassel core is too old to support remote highlights"),
// 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
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("<p>%1</p></br><p>%2</p>").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
void revert();
void clientConnected();
+signals:
+ /**
+ * Signals the local highlight settings have been changed as part of cleaning up after
+ * importing the rules locally.
+ *
+ * @see CoreHighlightSettingsPage::importRules()
+ */
+ void localHighlightsChanged();
+
private slots:
void coreConnectionStateChanged(bool state);
void widgetHasChanged();
#include "uisettings.h"
HighlightSettingsPage::HighlightSettingsPage(QWidget* parent)
- : SettingsPage(tr("Interface"),
- // In Monolithic mode, local highlights are replaced by remote highlights
- Quassel::runMode() == Quassel::Monolithic ? tr("Legacy Highlights") : tr("Local Highlights"),
+ : SettingsPage(tr("Interface"), tr("Legacy Highlights"),
parent)
{
ui.setupUi(this);
// Information icon
ui.localHighlightsIcon->setPixmap(icon::get("dialog-information").pixmap(16));
- // Set up client/monolithic local highlights information
- if (Quassel::runMode() == Quassel::Monolithic) {
- // We're running in Monolithic mode, core/client version in total sync. Discourage the use
- // of local (legacy) highlights as it's identical to setting remote highlights.
- ui.localHighlightsLabel->setText(tr("Legacy Highlights are replaced by Highlights"));
- }
- else {
- // We're running in client/split mode, allow for splitting the details.
- ui.localHighlightsLabel->setText(tr("Local Highlights apply to this device only"));
- }
-
connect(ui.add, &QAbstractButton::clicked, this, [this]() { addNewRow(); });
connect(ui.remove, &QAbstractButton::clicked, this, &HighlightSettingsPage::removeSelectedRows);
// TODO: search for a better signal (one that emits everytime a selection has been changed for one item)
void HighlightSettingsPage::on_localHighlightsDetails_clicked()
{
- // Show information specific to client/monolithic differences
- if (Quassel::runMode() == Quassel::Monolithic) {
- // We're running in Monolithic mode, core/client version in total sync. Discourage the use
- // of local (legacy) highlights as it's identical to setting remote highlights.
- QMessageBox::information(this,
- tr("Legacy Highlights vs. Highlights"),
- QString("<p><b>%1</b></p></br><p>%2</p></br><p>%3</p>")
- .arg(tr("Legacy Highlights are replaced by Highlights"),
- tr("These highlights will keep working for now, but you should move to "
- "the improved highlight rules when you can."),
- tr("Configure the new style of highlights in "
- "<i>%1</i>.")
- .arg(tr("Highlights"))));
- }
- else {
- // We're running in client/split mode, allow for splitting the details.
- QMessageBox::information(this,
- tr("Local Highlights vs. Remote Highlights"),
- QString("<p><b>%1</b></p></br><p>%2</p></br><p>%3</p>")
- .arg(tr("Local Highlights apply to this device only"),
- tr("Highlights configured on this page only apply to your current "
- "device."),
- tr("Configure highlights for all of your devices in "
- "<i>%1</i>.")
- .arg(tr("Remote Highlights").replace(" ", " "))));
- // Re-use translations of "Remote Highlights" as this is a word-for-word reference, forcing
- // all spaces to be non-breaking
- }
+ // Discourage the use of local (legacy) highlights. When not running in Monolithic mode, they
+ // need to be kept around for pre-0.13 cores.
+ QMessageBox::information(this,
+ tr("Legacy Highlights vs. Highlights"),
+ QString("<p><b>%1</b></p></br><p>%2</p></br><p>%3</p>")
+ .arg(tr("Legacy Highlights are replaced by Highlights"),
+ tr("These highlights will keep working for now, but you should move to "
+ "the improved highlight rules when you can."),
+ tr("Configure the new style of highlights in <i>%1</i>.")
+ .arg(tr("Highlights"))));
}
void HighlightSettingsPage::load()
<string>Form</string>
</property>
<layout class="QVBoxLayout">
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="localHighlightsIcon">
+ <property name="text">
+ <string notr="true">[icon]</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="localHighlightsLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Legacy Highlights are replaced by Highlights</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="localHighlightsDetails">
+ <property name="text">
+ <string>Details...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
</layout>
</widget>
</item>
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="QLabel" name="localHighlightsIcon">
- <property name="text">
- <string notr="true">[icon]</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="localHighlightsLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Local Highlights apply to this device only</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="localHighlightsDetails">
- <property name="text">
- <string>Details...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
</layout>
</widget>
<resources/>