diff options
Diffstat (limited to 'Swift/QtUI')
| -rw-r--r-- | Swift/QtUI/QtHighlightEditor.cpp | 45 | ||||
| -rw-r--r-- | Swift/QtUI/QtHighlightEditor.ui | 7 | ||||
| -rw-r--r-- | Swift/QtUI/QtWebKitChatView.cpp | 8 |
3 files changed, 21 insertions, 39 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 @@ -42,3 +42,2 @@ 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())); @@ -70,3 +69,2 @@ QtHighlightEditor::QtHighlightEditor(QtSettingsProvider* settings, QWidget* pare connect(ui_.noColorRadio, SIGNAL(clicked()), SLOT(widgetClick())); - connect(ui_.defaultColorRadio, SIGNAL(clicked()), SLOT(widgetClick())); connect(ui_.customColorRadio, SIGNAL(clicked()), SLOT(widgetClick())); @@ -307,3 +305,2 @@ void QtHighlightEditor::disableDialog() ui_.noColorRadio->setEnabled(false); - ui_.defaultColorRadio->setEnabled(false); ui_.customColorRadio->setEnabled(false); @@ -401,5 +398,10 @@ HighlightRule QtHighlightEditor::ruleFromDialog() - rule.setNickIsKeyword(ui_.nickIsKeyword->isChecked()); - rule.setMatchWholeWords(!ui_.matchPartialWords->isChecked()); - rule.setMatchCase(ui_.matchCase->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()); + } @@ -408,7 +410,2 @@ HighlightRule QtHighlightEditor::ruleFromDialog() if (ui_.noColorRadio->isChecked()) { - action.setHighlightText(false); - action.setTextColor(""); - action.setTextBackground(""); - } else if (ui_.defaultColorRadio->isChecked()) { - action.setHighlightText(true); action.setTextColor(""); @@ -416,3 +413,2 @@ HighlightRule QtHighlightEditor::ruleFromDialog() } else { - action.setHighlightText(true); action.setTextColor(Q2PSTRING(ui_.foregroundColor->getColor().name())); @@ -478,19 +474,4 @@ 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_.foregroundColor->setEnabled(false); - ui_.backgroundColor->setEnabled(false); - } else { - ui_.foregroundColor->setEnabled(true); - ui_.backgroundColor->setEnabled(true); - QColor foregroundColor(P2QSTRING(action.getTextColor())); - ui_.foregroundColor->setColor(foregroundColor); - QColor backgroundColor(P2QSTRING(action.getTextBackground())); - ui_.backgroundColor->setColor(backgroundColor); - ui_.customColorRadio->setChecked(true); - } - } else { + if (action.getTextColor().empty() && action.getTextBackground().empty()) { ui_.noColorRadio->setChecked(true); @@ -498,2 +479,10 @@ void QtHighlightEditor::ruleToDialog(const HighlightRule& rule) ui_.backgroundColor->setEnabled(false); + } else { + ui_.foregroundColor->setEnabled(true); + ui_.backgroundColor->setEnabled(true); + QColor foregroundColor(P2QSTRING(action.getTextColor())); + ui_.foregroundColor->setColor(foregroundColor); + QColor backgroundColor(P2QSTRING(action.getTextBackground())); + ui_.backgroundColor->setColor(backgroundColor); + ui_.customColorRadio->setChecked(true); } diff --git a/Swift/QtUI/QtHighlightEditor.ui b/Swift/QtUI/QtHighlightEditor.ui index be2e99b..775771f 100644 --- a/Swift/QtUI/QtHighlightEditor.ui +++ b/Swift/QtUI/QtHighlightEditor.ui @@ -279,9 +279,2 @@ <item> - <widget class="QRadioButton" name="defaultColorRadio"> - <property name="text"> - <string>Default Color</string> - </property> - </widget> - </item> - <item> <widget class="QRadioButton" name="customColorRadio"> diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp index 1486293..a510e34 100644 --- a/Swift/QtUI/QtWebKitChatView.cpp +++ b/Swift/QtUI/QtWebKitChatView.cpp @@ -610,4 +610,4 @@ std::string QtWebKitChatView::addMessage( QString styleSpanEnd = style == "" ? "" : "</span>"; - QString highlightSpanStart = highlight.highlightText() ? getHighlightSpanStart(highlight) : ""; - QString highlightSpanEnd = highlight.highlightText() ? "</span>" : ""; + QString highlightSpanStart = highlight.highlightAllText() ? getHighlightSpanStart(highlight) : ""; + QString highlightSpanEnd = highlight.highlightAllText() ? "</span>" : ""; htmlString += "<span class='swift_inner_message'>" + styleSpanStart + highlightSpanStart + message + highlightSpanEnd + styleSpanEnd + "</span>" ; @@ -828,4 +828,4 @@ void QtWebKitChatView::replaceMessage(const QString& message, const std::string& QString styleSpanEnd = style == "" ? "" : "</span>"; - QString highlightSpanStart = highlight.highlightText() ? getHighlightSpanStart(highlight) : ""; - QString highlightSpanEnd = highlight.highlightText() ? "</span>" : ""; + QString highlightSpanStart = highlight.highlightAllText() ? getHighlightSpanStart(highlight) : ""; + QString highlightSpanEnd = highlight.highlightAllText() ? "</span>" : ""; messageHTML = styleSpanStart + highlightSpanStart + messageHTML + highlightSpanEnd + styleSpanEnd; |
Swift