summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-07-16 12:37:25 (GMT)
committerSwift Review <review@swift.im>2014-07-29 08:36:54 (GMT)
commit9c5c731845881996f45b32ea6de12e0647f4634d (patch)
tree70331a822814ade469f07231ff0bf6dfbfa1fcde /Swift/QtUI/QtHighlightEditor.cpp
parent690cb7e85ff9dadbfca3e3bc91826161011712f1 (diff)
downloadswift-contrib-9c5c731845881996f45b32ea6de12e0647f4634d.zip
swift-contrib-9c5c731845881996f45b32ea6de12e0647f4634d.tar.bz2
Prevent nick highlight rule highlighting the entire message and remove default highlight colours
Test-Information: Add a nick highlight rule. Verify that it is triggered correctly in MUCs and that only the nick text is highlighted. Added unit tests. Change-Id: I9af1c900f4767383745afd36a5eadbe08f606432
Diffstat (limited to 'Swift/QtUI/QtHighlightEditor.cpp')
-rw-r--r--Swift/QtUI/QtHighlightEditor.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp
index ce07003..8488d7d 100644
--- a/Swift/QtUI/QtHighlightEditor.cpp
+++ b/Swift/QtUI/QtHighlightEditor.cpp
@@ -41,5 +41,4 @@ QtHighlightEditor::QtHighlightEditor(QtSettingsProvider* settings, QWidget* pare
connect(ui_.noColorRadio, SIGNAL(clicked()), SLOT(colorOtherSelect()));
- connect(ui_.defaultColorRadio, SIGNAL(clicked()), SLOT(colorOtherSelect()));
connect(ui_.customColorRadio, SIGNAL(clicked()), SLOT(colorCustomSelect()));
@@ -69,5 +68,4 @@ QtHighlightEditor::QtHighlightEditor(QtSettingsProvider* settings, QWidget* pare
connect(ui_.matchCase, SIGNAL(clicked()), SLOT(widgetClick()));
connect(ui_.noColorRadio, SIGNAL(clicked()), SLOT(widgetClick()));
- connect(ui_.defaultColorRadio, SIGNAL(clicked()), SLOT(widgetClick()));
connect(ui_.customColorRadio, SIGNAL(clicked()), SLOT(widgetClick()));
connect(ui_.noSoundRadio, SIGNAL(clicked()), SLOT(widgetClick()));
@@ -306,5 +304,4 @@ void QtHighlightEditor::disableDialog()
ui_.matchCase->setEnabled(false);
ui_.noColorRadio->setEnabled(false);
- ui_.defaultColorRadio->setEnabled(false);
ui_.customColorRadio->setEnabled(false);
ui_.foregroundColor->setEnabled(false);
@@ -400,20 +397,19 @@ HighlightRule QtHighlightEditor::ruleFromDialog()
}
- rule.setNickIsKeyword(ui_.nickIsKeyword->isChecked());
+ if (ui_.nickIsKeyword->isChecked()) {
+ rule.setNickIsKeyword(true);
+ rule.setMatchWholeWords(true);
+ rule.setMatchCase(true);
+ } else {
rule.setMatchWholeWords(!ui_.matchPartialWords->isChecked());
rule.setMatchCase(ui_.matchCase->isChecked());
+ }
HighlightAction& action = rule.getAction();
if (ui_.noColorRadio->isChecked()) {
- action.setHighlightText(false);
- action.setTextColor("");
- action.setTextBackground("");
- } else if (ui_.defaultColorRadio->isChecked()) {
- action.setHighlightText(true);
action.setTextColor("");
action.setTextBackground("");
} else {
- action.setHighlightText(true);
action.setTextColor(Q2PSTRING(ui_.foregroundColor->getColor().name()));
action.setTextBackground(Q2PSTRING(ui_.backgroundColor->getColor().name()));
@@ -477,9 +473,7 @@ void QtHighlightEditor::ruleToDialog(const HighlightRule& rule)
ui_.noColorRadio->setEnabled(true);
- ui_.defaultColorRadio->setEnabled(true);
ui_.customColorRadio->setEnabled(true);
- if (action.highlightText()) {
if (action.getTextColor().empty() && action.getTextBackground().empty()) {
- ui_.defaultColorRadio->setChecked(true);
+ ui_.noColorRadio->setChecked(true);
ui_.foregroundColor->setEnabled(false);
ui_.backgroundColor->setEnabled(false);
@@ -493,9 +487,4 @@ void QtHighlightEditor::ruleToDialog(const HighlightRule& rule)
ui_.customColorRadio->setChecked(true);
}
- } else {
- ui_.noColorRadio->setChecked(true);
- ui_.foregroundColor->setEnabled(false);
- ui_.backgroundColor->setEnabled(false);
- }
ui_.noSoundRadio->setEnabled(true);