settings: Local Highlights, default Current nick
[quassel.git] / src / qtui / settingspages / highlightsettingspage.cpp
index 7a000e9..db5982e 100644 (file)
 
 #include "highlightsettingspage.h"
 
+#include <QHeaderView>
+#include <QMessageBox>
+
 #include "client.h"
+#include "icon.h"
 #include "qtui.h"
 #include "uisettings.h"
 
-#include <QHeaderView>
-#include <QMessageBox>
 
 HighlightSettingsPage::HighlightSettingsPage(QWidget *parent)
-    : SettingsPage(tr("Interface"), tr("Local Highlights"), parent)
+    : SettingsPage(tr("Interface"),
+                   // In Monolithic mode, local highlights are replaced by remote highlights
+                   Quassel::runMode() == Quassel::Monolithic ?
+                       tr("Legacy Highlights") : tr("Local Highlights"),
+                   parent)
 {
     ui.setupUi(this);
     ui.highlightTable->verticalHeader()->hide();
     ui.highlightTable->setShowGrid(false);
 
+
+    ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::EnableColumn)->setToolTip(
+                tr("Enable/disable this rule"));
+    ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::EnableColumn)->setWhatsThis(
+                ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::EnableColumn)->toolTip());
+
+    ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::NameColumn)->setToolTip(
+                tr("Phrase to match"));
+    ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::NameColumn)->setWhatsThis(
+                ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::NameColumn)->toolTip());
+
     ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::RegExColumn)->setToolTip(
-                tr("<b>RegEx</b>: This option determines if the highlight rule should be "
-                   "interpreted as a <b>regular expression</b> or just as a keyword."));
+                tr("<b>RegEx</b>: This option determines if the highlight rule and <i>Channel</i> "
+                   "should be interpreted as <b>regular expressions</b> or just as keywords."));
     ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::RegExColumn)->setWhatsThis(
                 ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::RegExColumn)->toolTip());
 
     ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::CsColumn)->setToolTip(
-                tr("<b>CS</b>: This option determines if the highlight rule should be interpreted "
-                   "<b>case sensitive</b>."));
+                tr("<b>CS</b>: This option determines if the highlight rule and <i>Channel</i> "
+                   "should be interpreted <b>case sensitive</b>."));
     ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::CsColumn)->setWhatsThis(
                 ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::CsColumn)->toolTip());
 
     ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::ChanColumn)->setToolTip(
-                tr("<p><b>Channel</b>: Semicolon separated list of channel names.</p>"
+                tr("<p><b>Channel</b>: Semicolon separated list of channel/query names, leave "
+                   "blank to match any name.</p>"
                    "<p><i>Example:</i><br />"
                    "<i>#quassel*; #foobar; !#quasseldroid</i><br />"
-                   "would match on #foobar and on any channel starting with <i>#quassel</i> except "
-                   "for <i>#quasseldroid</i><br />"
+                   "would match on <i>#foobar</i> and any channel starting with <i>#quassel</i> "
+                   "except for <i>#quasseldroid</i><br />"
                    "<p>If only inverted names are specified, it will match anything except for "
                    "what's specified (implicit wildcard).</p>"
                    "<p><i>Example:</i><br />"
                    "<i>!#quassel*; !#foobar</i><br />"
-                   "would match anything except for #foobar or any channel starting with "
+                   "would match anything except for <i>#foobar</i> or any channel starting with "
                    "<i>#quassel</i></p>"));
     ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::ChanColumn)->setWhatsThis(
                 ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::ChanColumn)->toolTip());
@@ -76,14 +94,14 @@ HighlightSettingsPage::HighlightSettingsPage(QWidget *parent)
 #endif
 
     // Information icon
-    ui.localHighlightsIcon->setPixmap(QIcon::fromTheme("dialog-information").pixmap(16));
+    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 highlights as it's identical to setting remote highlights.
+        // of local (legacy) highlights as it's identical to setting remote highlights.
         ui.localHighlightsLabel->setText(
-                    tr("Local Highlights are replaced by Remote Highlights"));
+                    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"));
@@ -112,7 +130,7 @@ bool HighlightSettingsPage::hasDefaults() const
 
 void HighlightSettingsPage::defaults()
 {
-    ui.highlightNoNick->setChecked(true);
+    ui.highlightCurrentNick->setChecked(true);
     ui.nicksCaseSensitive->setChecked(false);
     emptyTable();
 
@@ -152,22 +170,23 @@ void HighlightSettingsPage::addNewRow(QString name, bool regex, bool cs, bool en
     enableItem->setToolTip(tr("Enable/disable this rule"));
     nameItem->setToolTip(tr("Phrase to match"));
     regexItem->setToolTip(
-                tr("<b>RegEx</b>: This option determines if the highlight rule should be "
-                   "interpreted as a <b>regular expression</b> or just as a keyword."));
+                tr("<b>RegEx</b>: This option determines if the highlight rule and <i>Channel</i> "
+                   "should be interpreted as <b>regular expressions</b> or just as keywords."));
     csItem->setToolTip(
-                tr("<b>CS</b>: This option determines if the highlight rule should be interpreted "
-                   "<b>case sensitive</b>."));
+                tr("<b>CS</b>: This option determines if the highlight rule and <i>Channel</i> "
+                   "should be interpreted <b>case sensitive</b>."));
     chanNameItem->setToolTip(
-                tr("<p><b>Channel</b>: Semicolon separated list of channel names.</p>"
+                tr("<p><b>Channel</b>: Semicolon separated list of channel/query names, leave "
+                   "blank to match any name.</p>"
                    "<p><i>Example:</i><br />"
                    "<i>#quassel*; #foobar; !#quasseldroid</i><br />"
-                   "would match on #foobar and on any channel starting with <i>#quassel</i> except "
-                   "for <i>#quasseldroid</i><br />"
+                   "would match on <i>#foobar</i> and any channel starting with <i>#quassel</i> "
+                   "except for <i>#quasseldroid</i><br />"
                    "<p>If only inverted names are specified, it will match anything except for "
                    "what's specified (implicit wildcard).</p>"
                    "<p><i>Example:</i><br />"
                    "<i>!#quassel*; !#foobar</i><br />"
-                   "would match anything except for #foobar or any channel starting with "
+                   "would match anything except for <i>#foobar</i> or any channel starting with "
                    "<i>#quassel</i></p>"));
 
     int lastRow = ui.highlightTable->rowCount()-1;
@@ -269,36 +288,33 @@ 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
+    // 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 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));
+        // 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.
-        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"),
+                    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(" ", "&nbsp;"))));
+        // Re-use translations of "Remote Highlights" as this is a word-for-word reference, forcing
+        // all spaces to be non-breaking
     }
-
-    QMessageBox::information(this,
-                             tr("Local Highlights vs. Remote Highlights"),
-                             localHighlightsMsgText);
 }