X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fcorehighlightsettingspage.cpp;h=a413b59d02d63ef269a666c3b95a1fd4e01d04e4;hp=644a9020e2088e79c26202708456717c5aca3f6f;hb=0182f0e3977026de65be1edb6ca1e8d7ea0184fd;hpb=b627af388d570f48a03fd22ab024c07e82e0d503 diff --git a/src/qtui/settingspages/corehighlightsettingspage.cpp b/src/qtui/settingspages/corehighlightsettingspage.cpp index 644a9020..a413b59d 100644 --- a/src/qtui/settingspages/corehighlightsettingspage.cpp +++ b/src/qtui/settingspages/corehighlightsettingspage.cpp @@ -27,7 +27,11 @@ #include "qtui.h" CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent) - : SettingsPage(tr("Interface"), tr("Remote Highlights"), parent) + : SettingsPage(tr("Interface"), + // In Monolithic mode, local highlights are replaced by remote highlights + Quassel::runMode() == Quassel::Monolithic ? + tr("Highlights") : tr("Remote Highlights"), + parent) { ui.setupUi(this); @@ -105,29 +109,57 @@ void CoreHighlightSettingsPage::setupRuleTable(QTableWidget *table) const table->verticalHeader()->hide(); table->setShowGrid(false); + table->horizontalHeaderItem(CoreHighlightSettingsPage::EnableColumn)->setToolTip( + tr("Enable/disable this rule")); + table->horizontalHeaderItem(CoreHighlightSettingsPage::EnableColumn)->setWhatsThis( + table->horizontalHeaderItem(CoreHighlightSettingsPage::EnableColumn)->toolTip()); + + table->horizontalHeaderItem(CoreHighlightSettingsPage::NameColumn)->setToolTip( + tr("Phrase to match")); + table->horizontalHeaderItem(CoreHighlightSettingsPage::NameColumn)->setWhatsThis( + table->horizontalHeaderItem(CoreHighlightSettingsPage::NameColumn)->toolTip()); + 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, Sender, and " + "Channel should be interpreted as regular expressions or just as " + "keywords.")); table->horizontalHeaderItem(CoreHighlightSettingsPage::RegExColumn)->setWhatsThis( 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, Sender, and " + "Channel should be interpreted case sensitive.")); table->horizontalHeaderItem(CoreHighlightSettingsPage::CsColumn)->setWhatsThis( table->horizontalHeaderItem(CoreHighlightSettingsPage::CsColumn)->toolTip()); + table->horizontalHeaderItem(CoreHighlightSettingsPage::SenderColumn)->setToolTip( + tr("
Sender: Semicolon separated list of nick!ident@host names, " + "leave blank to match any nickname.
" + "Example:
"
+ "Alice!*; Bob!*@example.com; Carol*!*; !Caroline!*
"
+ "would match on Alice, Bob with hostmask example.com, and "
+ "any nickname starting with Carol except for Caroline
"
+ "
If only inverted names are specified, it will match anything except for " + "what's specified (implicit wildcard).
" + "Example:
"
+ "!Announce*!*; !Wheatley!aperture@*
"
+ "would match anything except for Wheatley with ident aperture or "
+ "any nickname starting with Announce
Channel: Semicolon separated list of channel names.
" + tr("Channel: Semicolon separated list of channel names, leave blank to " + "match any name.
" "Example:
"
"#quassel*; #foobar; !#quasseldroid
"
- "would match on #foobar and on any channel starting with #quassel except "
- "for #quasseldroid
"
+ "would match on #foobar and 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 "
+ "would match anything except for #foobar or any channel starting with "
"#quassel
Sender: Semicolon separated list of nick!ident@host names, " + "leave blank to match any nickname.
" + "Example:
"
+ "Alice!*; Bob!*@example.com; Carol*!*; !Caroline!*
"
+ "would match on Alice, Bob with hostmask example.com, and "
+ "any nickname starting with Carol except for Caroline
"
+ "
If only inverted names are specified, it will match anything except for " + "what's specified (implicit wildcard).
" + "Example:
"
+ "!Announce*!*; !Wheatley!aperture@*
"
+ "would match anything except for Wheatley with ident aperture or "
+ "any nickname starting with Announce
Channel: Semicolon separated list of channel names.
" + tr("Channel: Semicolon separated list of channel names, leave blank to " + "match any name.
" "Example:
"
"#quassel*; #foobar; !#quasseldroid
"
- "would match on #foobar and on any channel starting with #quassel except "
- "for #quasseldroid
"
+ "would match on #foobar and 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 "
+ "would match anything except for #foobar or any channel starting with "
"#quassel
Channel: Semicolon separated list of channel names.
" "Example:
"
"#quassel*; #foobar; !#quasseldroid
"
- "would match on #foobar and on any channel starting with #quassel except "
+ "would match on #foobar and 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).
" @@ -591,6 +635,33 @@ void CoreHighlightSettingsPage::on_coreUnsupportedDetails_clicked() void CoreHighlightSettingsPage::importRules() { NotificationSettings notificationSettings; + const auto localHighlightList = notificationSettings.highlightList(); + + // 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(" ", " "); + + if (localHighlightList.count() == 0) { + // No highlight rules exist to import, do nothing + QMessageBox::information(this, + tr("No local highlights"), + tr("No highlight rules in %1." + ).arg(localHighlightsName)); + return; + } + + int ret = QMessageBox::question(this, + tr("Import local highlights?"), + tr("Import all highlight rules from %1?" + ).arg(localHighlightsName), + QMessageBox::Yes|QMessageBox::No, + QMessageBox::No); + + if (ret == QMessageBox::No) { + // Only two options, Yes or No, just return if No + return; + } + auto clonedManager = HighlightRuleManager(); clonedManager.fromVariantMap(Client::highlightRuleManager()->toVariantMap()); @@ -611,6 +682,12 @@ void CoreHighlightSettingsPage::importRules() { Client::highlightRuleManager()->requestUpdate(clonedManager.toVariantMap()); setChangedState(false); load(); + + // Give a heads-up that all succeeded + QMessageBox::information(this, + tr("Imported local highlights"), + tr("%1 highlight rules successfully imported." + ).arg(QString::number(localHighlightList.count()))); } bool CoreHighlightSettingsPage::isSelectable() const {