From 0eb413175783a04999ce04c5db8a9b9132ea0d8c Mon Sep 17 00:00:00 2001 From: Shane Synan Date: Thu, 1 Mar 2018 06:48:47 -0600 Subject: [PATCH] client: Add Highlight Rules tooltips, UI polish Add tooltips to every element of Highlight/Highlight Ignore tables, and to the Local Highlight table. Update the "Channel" tooltip to describe the non-regular-expression approach used now. Rename "Import" to "Import Local", add tooltip to better describe purpose. Move "Highlight Ignore Rules" table into QGroupBox to place at even height with "Highlight Rules" box, making it less jarring to switch between the two. --- .../corehighlightsettingspage.cpp | 72 +++++++- .../corehighlightsettingspage.ui | 162 ++++++++++-------- .../settingspages/highlightsettingspage.cpp | 55 +++++- 3 files changed, 200 insertions(+), 89 deletions(-) diff --git a/src/qtui/settingspages/corehighlightsettingspage.cpp b/src/qtui/settingspages/corehighlightsettingspage.cpp index 444afd1c..55266d05 100644 --- a/src/qtui/settingspages/corehighlightsettingspage.cpp +++ b/src/qtui/settingspages/corehighlightsettingspage.cpp @@ -101,19 +101,31 @@ void CoreHighlightSettingsPage::setupRuleTable(QTableWidget *table) const table->setShowGrid(false); table->horizontalHeaderItem(CoreHighlightSettingsPage::RegExColumn)->setToolTip( - tr("RegEx: This option determines if the highlight rule should be interpreted as a regular expression or just as a keyword.")); + tr("RegEx: This option determines if the highlight rule should be " + "interpreted as a regular expression or just as a keyword.")); table->horizontalHeaderItem(CoreHighlightSettingsPage::RegExColumn)->setWhatsThis( - tr("RegEx: This option determines if the highlight rule should be interpreted as a regular expression or just as a keyword.")); + table->horizontalHeaderItem(CoreHighlightSettingsPage::RegExColumn)->toolTip()); table->horizontalHeaderItem(CoreHighlightSettingsPage::CsColumn)->setToolTip( - tr("CS: This option determines if the highlight rule should be interpreted case sensitive.")); + tr("CS: This option determines if the highlight rule should be interpreted " + "case sensitive.")); table->horizontalHeaderItem(CoreHighlightSettingsPage::CsColumn)->setWhatsThis( - tr("CS: This option determines if the highlight rule should be interpreted case sensitive.")); + table->horizontalHeaderItem(CoreHighlightSettingsPage::CsColumn)->toolTip()); table->horizontalHeaderItem(CoreHighlightSettingsPage::ChanColumn)->setToolTip( - tr("Channel: This regular expression determines for which channels the highlight rule works. Leave blank to match any channel. Put ! in the beginning to negate. Case insensitive.")); + tr("

Channel: Semicolon separated list of channel names.

" + "

Example:
" + "#quassel*; #foobar; !#quasseldroid
" + "would match on #foobar and on any channel starting with #quassel except " + "for #quasseldroid
" + "

If only inverted names are specified, it will match anything except for " + "what's specified (implicit wildcard).

" + "

Example:
" + "!#quassel*; !#foobar
" + "would match anything except for #foobar or any channel starting with " + "#quassel

")); table->horizontalHeaderItem(CoreHighlightSettingsPage::ChanColumn)->setWhatsThis( - tr("Channel: This regular expression determines for which channels the highlight rule works. Leave blank to match any channel. Put ! in the beginning to negate. Case insensitive.")); + table->horizontalHeaderItem(CoreHighlightSettingsPage::ChanColumn)->toolTip()); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) table->horizontalHeader()->setResizeMode(CoreHighlightSettingsPage::EnableColumn, QHeaderView::ResizeToContents); @@ -193,6 +205,30 @@ void CoreHighlightSettingsPage::addNewHighlightRow(bool enable, const QString &n auto *senderItem = new QTableWidgetItem(sender); + enableItem->setToolTip(tr("Enable/disable this rule")); + nameItem->setToolTip(tr("Phrase to match")); + regexItem->setToolTip( + tr("RegEx: This option determines if the highlight rule should be " + "interpreted as a regular expression or just as a keyword.")); + csItem->setToolTip( + tr("CS: This option determines if the highlight rule should be interpreted " + "case sensitive.")); + senderItem->setToolTip( + tr("Sender: This option specifies which sender to match. Leave blank to " + "match any nickname.")); + chanNameItem->setToolTip( + tr("

Channel: Semicolon separated list of channel names.

" + "

Example:
" + "#quassel*; #foobar; !#quasseldroid
" + "would match on #foobar and on any channel starting with #quassel except " + "for #quasseldroid
" + "

If only inverted names are specified, it will match anything except for " + "what's specified (implicit wildcard).

" + "

Example:
" + "!#quassel*; !#foobar
" + "would match anything except for #foobar or any channel starting with " + "#quassel

")); + int lastRow = ui.highlightTable->rowCount() - 1; ui.highlightTable->setItem(lastRow, CoreHighlightSettingsPage::NameColumn, nameItem); ui.highlightTable->setItem(lastRow, CoreHighlightSettingsPage::RegExColumn, regexItem); @@ -239,6 +275,30 @@ void CoreHighlightSettingsPage::addNewIgnoredRow(bool enable, const QString &nam auto *senderItem = new QTableWidgetItem(sender); + enableItem->setToolTip(tr("Enable/disable this rule")); + nameItem->setToolTip(tr("Phrase to match")); + regexItem->setToolTip( + tr("RegEx: This option determines if the highlight rule should be " + "interpreted as a regular expression or just as a keyword.")); + csItem->setToolTip( + tr("CS: This option determines if the highlight rule should be interpreted " + "case sensitive.")); + senderItem->setToolTip( + tr("Sender: This option specifies which sender nicknames match. Leave " + "blank to match any nickname.")); + chanNameItem->setToolTip( + tr("

Channel: Semicolon separated list of channel names.

" + "

Example:
" + "#quassel*; #foobar; !#quasseldroid
" + "would match on #foobar and on any channel starting with #quassel except " + "for #quasseldroid
" + "

If only inverted names are specified, it will match anything except for " + "what's specified (implicit wildcard).

" + "

Example:
" + "!#quassel*; !#foobar
" + "would match anything except for #foobar or any channel starting with " + "#quassel

")); + int lastRow = ui.ignoredTable->rowCount() - 1; ui.ignoredTable->setItem(lastRow, CoreHighlightSettingsPage::NameColumn, nameItem); ui.ignoredTable->setItem(lastRow, CoreHighlightSettingsPage::RegExColumn, regexItem); diff --git a/src/qtui/settingspages/corehighlightsettingspage.ui b/src/qtui/settingspages/corehighlightsettingspage.ui index 11b64e28..1c102bf3 100644 --- a/src/qtui/settingspages/corehighlightsettingspage.ui +++ b/src/qtui/settingspages/corehighlightsettingspage.ui @@ -161,8 +161,11 @@ + + Import highlight rules configured in <i>Local Highlights</i> + - Import + Import Local @@ -177,84 +180,93 @@ Highlight Ignore Rules - + - - - - - - + + + Never Highlight For - - - Enabled - - - - - Rule - - - - - RegEx - - - - - CS - - - - - Sender - - - - - Channel - - + + + + + + + + + + + + Enabled + + + + + Rule + + + + + RegEx + + + + + CS + + + + + Sender + + + + + Channel + + + + + + + + 0 + + + 0 + + + + + Add + + + + + + + Remove + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + - - - - 0 - - - 0 - - - - - Add - - - - - - - Remove - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - diff --git a/src/qtui/settingspages/highlightsettingspage.cpp b/src/qtui/settingspages/highlightsettingspage.cpp index 330eb6df..6210f6f6 100644 --- a/src/qtui/settingspages/highlightsettingspage.cpp +++ b/src/qtui/settingspages/highlightsettingspage.cpp @@ -33,14 +33,32 @@ HighlightSettingsPage::HighlightSettingsPage(QWidget *parent) ui.highlightTable->verticalHeader()->hide(); ui.highlightTable->setShowGrid(false); - ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::RegExColumn)->setToolTip("RegEx: This option determines if the highlight rule should be interpreted as a regular expression or just as a keyword."); - ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::RegExColumn)->setWhatsThis("RegEx: This option determines if the highlight rule should be interpreted as a regular expression or just as a keyword."); - - ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::CsColumn)->setToolTip("CS: This option determines if the highlight rule should be interpreted case sensitive."); - ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::CsColumn)->setWhatsThis("CS: This option determines if the highlight rule should be interpreted case sensitive."); - - ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::ChanColumn)->setToolTip("Channel: This regular expression determines for which channels the highlight rule works. Leave blank to match any channel. Put ! in the beginning to negate. Case insensitive."); - ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::ChanColumn)->setWhatsThis("Channel: This regular expression determines for which channels the highlight rule works. Leave blank to match any channel. Put ! in the beginning to negate. Case insensitive."); + ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::RegExColumn)->setToolTip( + tr("RegEx: This option determines if the highlight rule should be " + "interpreted as a regular expression or just as a keyword.")); + ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::RegExColumn)->setWhatsThis( + ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::RegExColumn)->toolTip()); + + ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::CsColumn)->setToolTip( + tr("CS: This option determines if the highlight rule should be interpreted " + "case sensitive.")); + ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::CsColumn)->setWhatsThis( + ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::CsColumn)->toolTip()); + + ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::ChanColumn)->setToolTip( + tr("

Channel: Semicolon separated list of channel names.

" + "

Example:
" + "#quassel*; #foobar; !#quasseldroid
" + "would match on #foobar and on any channel starting with #quassel except " + "for #quasseldroid
" + "

If only inverted names are specified, it will match anything except for " + "what's specified (implicit wildcard).

" + "

Example:
" + "!#quassel*; !#foobar
" + "would match anything except for #foobar or any channel starting with " + "#quassel

")); + ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::ChanColumn)->setWhatsThis( + ui.highlightTable->horizontalHeaderItem(HighlightSettingsPage::ChanColumn)->toolTip()); #if QT_VERSION < 0x050000 ui.highlightTable->horizontalHeader()->setResizeMode(HighlightSettingsPage::NameColumn, QHeaderView::Stretch); @@ -116,6 +134,27 @@ void HighlightSettingsPage::addNewRow(QString name, bool regex, bool cs, bool en QTableWidgetItem *chanNameItem = new QTableWidgetItem(chanName); + enableItem->setToolTip(tr("Enable/disable this rule")); + nameItem->setToolTip(tr("Phrase to match")); + regexItem->setToolTip( + tr("RegEx: This option determines if the highlight rule should be " + "interpreted as a regular expression or just as a keyword.")); + csItem->setToolTip( + tr("CS: This option determines if the highlight rule should be interpreted " + "case sensitive.")); + chanNameItem->setToolTip( + tr("

Channel: Semicolon separated list of channel names.

" + "

Example:
" + "#quassel*; #foobar; !#quasseldroid
" + "would match on #foobar and on any channel starting with #quassel except " + "for #quasseldroid
" + "

If only inverted names are specified, it will match anything except for " + "what's specified (implicit wildcard).

" + "

Example:
" + "!#quassel*; !#foobar
" + "would match anything except for #foobar or any channel starting with " + "#quassel

")); + int lastRow = ui.highlightTable->rowCount()-1; ui.highlightTable->setItem(lastRow, HighlightSettingsPage::EnableColumn, enableItem); ui.highlightTable->setItem(lastRow, HighlightSettingsPage::NameColumn, nameItem); -- 2.20.1