diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-01-17 17:14:46 (GMT) |
---|---|---|
committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-01-17 17:14:46 (GMT) |
commit | 97d03baffbf399c98238f9583c2718b5e7ab4b0e (patch) | |
tree | 2646ebe66eacd1ca88ed6b4fdcaf2c82d9395c1e | |
parent | a98bbd87b9dff60d1de2dcd1d4538055543d3b1e (diff) | |
download | swift-97d03baffbf399c98238f9583c2718b5e7ab4b0e.zip swift-97d03baffbf399c98238f9583c2718b5e7ab4b0e.tar.bz2 |
Saving and restoring colour values.
Change-Id: I36cf2a70958d7195dca264846962f28a1ec534b8
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.cpp | 37 | ||||
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.ui | 2 |
2 files changed, 25 insertions, 14 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp index 807b180..bd71c37 100644 --- a/Swift/QtUI/QtHighlightEditor.cpp +++ b/Swift/QtUI/QtHighlightEditor.cpp @@ -168,13 +168,13 @@ void QtHighlightEditor::setHighlightManager(HighlightManager* highlightManager) void QtHighlightEditor::colorOtherSelect() { - ui_.foregoundColor->setEnabled(false); + ui_.foregroundColor->setEnabled(false); ui_.backgroundColor->setEnabled(false); } void QtHighlightEditor::colorCustomSelect() { - ui_.foregoundColor->setEnabled(true); + ui_.foregroundColor->setEnabled(true); ui_.backgroundColor->setEnabled(true); } @@ -272,10 +272,16 @@ void QtHighlightEditor::enableDialog(bool state) ui_.matchWholeWords->setChecked(false); ui_.matchCase->setChecked(false); ui_.noColorRadio->setChecked(true); - //ui_.foregoundColor->setEnabled(state); - //ui_.backgroundColor->setEnabled(state); + ui_.foregroundColor->setEnabled(state); + ui_.backgroundColor->setEnabled(state); ui_.noSoundRadio->setChecked(true); + ui_.foregroundColor->setColor(QColor()); + ui_.backgroundColor->setColor(QColor()); ui_.soundFile->setText(""); + ui_.foregroundColor->setEnabled(false); + ui_.backgroundColor->setEnabled(false); + ui_.soundFile->setEnabled(false); + ui_.soundFileButton->setEnabled(false); } ui_.chatCheck->setEnabled(state); @@ -290,13 +296,9 @@ void QtHighlightEditor::enableDialog(bool state) ui_.noColorRadio->setEnabled(state); ui_.defaultColorRadio->setEnabled(state); ui_.customColorRadio->setEnabled(state); - ui_.foregoundColor->setEnabled(state); - ui_.backgroundColor->setEnabled(state); ui_.noSoundRadio->setEnabled(state); ui_.defaultSoundRadio->setEnabled(state); ui_.customSoundRadio->setEnabled(state); - ui_.soundFile->setEnabled(state); - ui_.soundFileButton->setEnabled(state); } void QtHighlightEditor::selectRow(int row) @@ -354,17 +356,16 @@ HighlightRule QtHighlightEditor::ruleFromDialog() 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); - QColor foregroundColor = ui_.foregoundColor.getColor(); - action.setTextColor("#ffffffff"); - - QColor backgroundColor = ui_.backgroundColor.getColor(); - action.setTextBackground("#ffffffff"); + action.setTextColor(Q2PSTRING(ui_.foregroundColor->getColor().name())); + action.setTextBackground(Q2PSTRING(ui_.backgroundColor->getColor().name())); } if (ui_.noSoundRadio->isChecked()) { @@ -416,11 +417,21 @@ void QtHighlightEditor::ruleToDialog(const HighlightRule& rule) 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 { ui_.noColorRadio->setChecked(true); + ui_.foregroundColor->setEnabled(false); + ui_.backgroundColor->setEnabled(false); } if (action.playSound()) { diff --git a/Swift/QtUI/QtHighlightEditor.ui b/Swift/QtUI/QtHighlightEditor.ui index 76ccf05..cd07192 100644 --- a/Swift/QtUI/QtHighlightEditor.ui +++ b/Swift/QtUI/QtHighlightEditor.ui @@ -318,7 +318,7 @@ p, li { white-space: pre-wrap; } </spacer> </item> <item> - <widget class="Swift::QtColorToolButton" name="foregoundColor"> + <widget class="Swift::QtColorToolButton" name="foregroundColor"> <property name="enabled"> <bool>false</bool> </property> |