client: Explain Local Highlights vs. Remote
authorShane Synan <digitalcircuit36939@gmail.com>
Fri, 2 Mar 2018 00:25:49 +0000 (18:25 -0600)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 6 Jun 2018 17:15:14 +0000 (19:15 +0200)
Add footer to "Local Highlights" page to note that local highlights
apply to the current device only, including a "Details..." button.

Add a "Details..." dialog with a brief explanation and points out
where to configure highlights for all devices.

For Monolithic builds, indicate that "Remote Highlights" replaces
"Local Highlights" to help avoid confusion.  There's no remote core,
so local highlights have no reason to exist other than to provide a
path for upgrades.

src/qtui/settingspages/highlightsettingspage.cpp
src/qtui/settingspages/highlightsettingspage.h
src/qtui/settingspages/highlightsettingspage.ui

index 6210f6f..7a000e9 100644 (file)
@@ -25,6 +25,7 @@
 #include "uisettings.h"
 
 #include <QHeaderView>
+#include <QMessageBox>
 
 HighlightSettingsPage::HighlightSettingsPage(QWidget *parent)
     : SettingsPage(tr("Interface"), tr("Local Highlights"), parent)
@@ -74,6 +75,20 @@ HighlightSettingsPage::HighlightSettingsPage(QWidget *parent)
     ui.highlightTable->horizontalHeader()->setSectionResizeMode(HighlightSettingsPage::ChanColumn, QHeaderView::ResizeToContents);
 #endif
 
+    // Information icon
+    ui.localHighlightsIcon->setPixmap(QIcon::fromTheme("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 highlights as it's identical to setting remote highlights.
+        ui.localHighlightsLabel->setText(
+                    tr("Local Highlights are replaced by Remote 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, SIGNAL(clicked(bool)), this, SLOT(addNewRow()));
     connect(ui.remove, SIGNAL(clicked(bool)), this, SLOT(removeSelectedRows()));
     //TODO: search for a better signal (one that emits everytime a selection has been changed for one item)
@@ -252,6 +267,41 @@ void HighlightSettingsPage::tableChanged(QTableWidgetItem *item)
 }
 
 
+void HighlightSettingsPage::on_localHighlightsDetails_clicked()
+{
+    // Re-use translations of "Remote Highlights" as this is a word-for-word reference, forcing all
+    // spaces to non-breaking
+    const QString remoteHighlightsName = tr("Remote Highlights").replace(" ", "&nbsp;");
+    QString localHighlightsMsgText;
+
+    // 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 highlights as it's identical to setting remote highlights.
+        localHighlightsMsgText =
+                QString("<p><b>%1</b></p></br><p>%2</p></br><p>%3</p>"
+                        ).arg(tr("Local Highlights are replaced by Remote 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(remoteHighlightsName));
+    } else {
+        // We're running in client/split mode, allow for splitting the details.
+        localHighlightsMsgText =
+                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(remoteHighlightsName));
+    }
+
+    QMessageBox::information(this,
+                             tr("Local Highlights vs. Remote Highlights"),
+                             localHighlightsMsgText);
+}
+
+
 void HighlightSettingsPage::load()
 {
     NotificationSettings notificationSettings;
index 1d051f0..57c0123 100644 (file)
@@ -48,6 +48,11 @@ private slots:
     void selectRow(QTableWidgetItem *item);
     void tableChanged(QTableWidgetItem *item);
 
+    /**
+     * Event handler for Local Highlights Details button
+     */
+    void on_localHighlightsDetails_clicked();
+
 private:
     Ui::HighlightSettingsPage ui;
     QVariantList highlightList;
index 53f70f1..a07e0c8 100644 (file)
      </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/>