diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-01-21 10:23:31 (GMT) |
---|---|---|
committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-01-21 10:23:31 (GMT) |
commit | c1ac72f9fd5e8da003eee57552586fee93e937fb (patch) | |
tree | 1688ad6fc5b2d452e9ce7b861a9b24f7e85cd924 /Swift/QtUI | |
parent | 5f187f420d69c264d6b36a5c32f003514ab45ed8 (diff) | |
download | swift-c1ac72f9fd5e8da003eee57552586fee93e937fb.zip swift-c1ac72f9fd5e8da003eee57552586fee93e937fb.tar.bz2 |
GUI Tweaks.
Change-Id: Ibe58d9c0fccc4f96854aa486415372f98a3eb167
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.cpp | 23 | ||||
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.h | 2 |
2 files changed, 17 insertions, 8 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp index 7bb7736..5d3cf2a 100644 --- a/Swift/QtUI/QtHighlightEditor.cpp +++ b/Swift/QtUI/QtHighlightEditor.cpp @@ -170,14 +170,9 @@ std::string formatShortDescription(const HighlightRule &rule) void QtHighlightEditor::show() { - ui_.listWidget->clear(); - highlightManager_->loadSettings(); - foreach(const HighlightRule &rule, highlightManager_->getRules()) { - QListWidgetItem *item = new QListWidgetItem(); - item->setText(P2QSTRING(formatShortDescription(rule))); - ui_.listWidget->addItem(item); - } + + populateList(); if (ui_.listWidget->count()) { selectRow(0); @@ -227,6 +222,7 @@ void QtHighlightEditor::soundCustomSelect() void QtHighlightEditor::onNewButtonClicked() { int row = getSelectedRow() + 1; + populateList(); HighlightRule newRule; newRule.setMatchChat(true); highlightManager_->insertRule(row, newRule); @@ -271,6 +267,9 @@ void QtHighlightEditor::onCurrentRowChanged(int currentRow) HighlightRule rule = highlightManager_->getRule(currentRow); ruleToDialog(rule); ui_.ruleDescription->setText(P2QSTRING(formatLongDescription(rule))); + if (ui_.listWidget->currentItem()) { + ui_.listWidget->currentItem()->setText(P2QSTRING(formatShortDescription(rule))); + } } /* grey the dialog if we have nothing selected */ @@ -379,6 +378,16 @@ void QtHighlightEditor::selectSoundFile() ui_.soundFile->setText(path); } +void QtHighlightEditor::populateList() +{ + ui_.listWidget->clear(); + foreach(const HighlightRule &rule, highlightManager_->getRules()) { + QListWidgetItem *item = new QListWidgetItem(); + item->setText(P2QSTRING(formatShortDescription(rule))); + ui_.listWidget->addItem(item); + } +} + void QtHighlightEditor::selectRow(int row) { for (int i = 0; i < ui_.listWidget->count(); ++i) { diff --git a/Swift/QtUI/QtHighlightEditor.h b/Swift/QtUI/QtHighlightEditor.h index 6d3d42d..52414a6 100644 --- a/Swift/QtUI/QtHighlightEditor.h +++ b/Swift/QtUI/QtHighlightEditor.h @@ -50,7 +50,7 @@ namespace Swift { void selectSoundFile(); private: - + void populateList(); void selectRow(int row); int getSelectedRow() const; HighlightRule ruleFromDialog(); |