diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.cpp | 46 | ||||
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.h | 2 |
2 files changed, 15 insertions, 33 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp index f933e3f..b9d9a53 100644 --- a/Swift/QtUI/QtHighlightEditor.cpp +++ b/Swift/QtUI/QtHighlightEditor.cpp @@ -33,8 +33,6 @@ QtHighlightEditor::QtHighlightEditor(QtSettingsProvider* settings, QWidget* pare connect(ui_.newButton, SIGNAL(clicked()), SLOT(onNewButtonClicked())); connect(ui_.deleteButton, SIGNAL(clicked()), SLOT(onDeleteButtonClicked())); - connect(ui_.moveUpButton, SIGNAL(clicked()), SLOT(onMoveUpButtonClicked())); - connect(ui_.moveDownButton, SIGNAL(clicked()), SLOT(onMoveDownButtonClicked())); connect(ui_.buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), SLOT(onApplyButtonClick())); connect(ui_.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), SLOT(onCancelButtonClick())); @@ -70,6 +68,10 @@ QtHighlightEditor::QtHighlightEditor(QtSettingsProvider* settings, QWidget* pare connect(ui_.defaultSoundRadio, SIGNAL(clicked()), SLOT(updateRuleDescription())); connect(ui_.customSoundRadio, SIGNAL(clicked()), SLOT(updateRuleDescription())); + /* if these are not needed, then they should be removed */ + ui_.moveUpButton->setVisible(false); + ui_.moveDownButton->setVisible(false); + setWindowTitle(tr("Highlight Rules")); } @@ -117,12 +119,18 @@ std::string formatNaturalDescription(const HighlightRule& rule) text += " (not case sensivitive)"; } if (rule.getMatchWholeWords()) { - text += " as a whole word."; + text += " as a whole word"; } else { - text += " as a part of any word."; + text += " as a part of any word"; } } + if (rule.getNickIsKeyword()) { + text += ", or mentions my nickname"; + } + + text += "."; + return text; } @@ -195,33 +203,9 @@ void QtHighlightEditor::onNewButtonClicked() void QtHighlightEditor::onDeleteButtonClicked() { int selectedRow = getSelectedRow(); - if (selectedRow != -1) { - delete ui_.listWidget->takeItem(selectedRow); - highlightManager_->removeRule(selectedRow); - } -} - -void QtHighlightEditor::onMoveUpButtonClicked() -{ - //int row = getSelectedRow(); - //assert(row > 0); -// - //ui_.ruleWidget->save(); - //ui_.ruleWidget->setActiveIndex(QModelIndex()); - //itemModel_->swapRows(row, row - 1); - //selectRow(row - 1); -} - -void QtHighlightEditor::onMoveDownButtonClicked() -{ - //int row = getSelectedRow(); - //assert(row < itemModel_->rowCount(QModelIndex()) - 1); -// - //ui_.ruleWidget->save(); - //ui_.ruleWidget->setActiveIndex(QModelIndex()); - //if (itemModel_->swapRows(row, row + 1)) { - //selectRow(row + 1); - //} + assert(selectedRow > 0); + delete ui_.listWidget->takeItem(selectedRow); + highlightManager_->removeRule(selectedRow); } void QtHighlightEditor::onCurrentRowChanged(int currentRow) diff --git a/Swift/QtUI/QtHighlightEditor.h b/Swift/QtUI/QtHighlightEditor.h index bd35736..2c3a819 100644 --- a/Swift/QtUI/QtHighlightEditor.h +++ b/Swift/QtUI/QtHighlightEditor.h @@ -38,8 +38,6 @@ namespace Swift { void soundCustomSelect(); void onNewButtonClicked(); void onDeleteButtonClicked(); - void onMoveUpButtonClicked(); - void onMoveDownButtonClicked(); void onCurrentRowChanged(int currentRow); void onApplyButtonClick(); void onCancelButtonClick(); |