X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fcorehighlightsettingspage.cpp;h=644a9020e2088e79c26202708456717c5aca3f6f;hp=444afd1c2c6f29afe016454a4acd3d249fd7a4da;hb=b627af388d570f48a03fd22ab024c07e82e0d503;hpb=f4cc482f39451e564f549b39549d68f46561a9aa diff --git a/src/qtui/settingspages/corehighlightsettingspage.cpp b/src/qtui/settingspages/corehighlightsettingspage.cpp index 444afd1c..644a9020 100644 --- a/src/qtui/settingspages/corehighlightsettingspage.cpp +++ b/src/qtui/settingspages/corehighlightsettingspage.cpp @@ -19,6 +19,7 @@ ***************************************************************************/ #include +#include #include #include "client.h" @@ -83,10 +84,14 @@ CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent) SLOT(ignoredTableChanged(QTableWidgetItem * ))); connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected())); + + // Warning icon + ui.coreUnsupportedIcon->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(16)); } void CoreHighlightSettingsPage::coreConnectionStateChanged(bool state) { + updateCoreSupportStatus(state); setEnabled(state); if (state) { load(); @@ -101,19 +106,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); @@ -130,6 +147,21 @@ void CoreHighlightSettingsPage::setupRuleTable(QTableWidget *table) const #endif } +void CoreHighlightSettingsPage::updateCoreSupportStatus(bool state) +{ + // Assume connected state as enforced by the settings page UI + if (!state || Client::isCoreFeatureEnabled(Quassel::Feature::CoreSideHighlights)) { + // Either disconnected or core supports highlights, enable highlight configuration and hide + // warning. Don't show the warning needlessly when disconnected. + ui.highlightsConfigWidget->setEnabled(true); + ui.coreUnsupportedWidget->setVisible(false); + } else { + // Core does not support highlights, show warning and disable highlight configuration + ui.highlightsConfigWidget->setEnabled(false); + ui.coreUnsupportedWidget->setVisible(true); + } +} + void CoreHighlightSettingsPage::clientConnected() { connect(Client::highlightRuleManager(), SIGNAL(updated()), SLOT(revert())); @@ -193,6 +225,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 +295,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); @@ -489,6 +569,25 @@ void CoreHighlightSettingsPage::widgetHasChanged() setChangedState(true); } +void CoreHighlightSettingsPage::on_coreUnsupportedDetails_clicked() +{ + // Re-use translations of "Local Highlights" as this is a word-for-word reference, forcing all + // spaces to non-breaking + const QString localHighlightsName = tr("Local Highlights").replace(" ", " "); + + const QString remoteHighlightsMsgText = + QString("

%1


%2


%3

" + ).arg(tr("Your Quassel core is too old to support remote highlights"), + tr("You need a Quassel core v0.13.0 or newer to configure remote " + "highlights."), + tr("You can still configure highlights for this device only in " + "%1.").arg(localHighlightsName)); + + QMessageBox::warning(this, + tr("Remote Highlights unsupported"), + remoteHighlightsMsgText); +} + void CoreHighlightSettingsPage::importRules() { NotificationSettings notificationSettings; @@ -515,5 +614,7 @@ void CoreHighlightSettingsPage::importRules() { } bool CoreHighlightSettingsPage::isSelectable() const { - return Client::isConnected() && Client::isCoreFeatureEnabled(Quassel::Feature::CoreSideHighlights); + return Client::isConnected(); + // We check for Quassel::Feature::CoreSideHighlights when loading this page, allowing us to show + // a friendly error message. }