summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/QtUI/QtHighlightEditor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp
index 134155c..a5f49c2 100644
--- a/Swift/QtUI/QtHighlightEditor.cpp
+++ b/Swift/QtUI/QtHighlightEditor.cpp
@@ -353,108 +353,108 @@ void QtHighlightEditor::populateList()
HighlightRulesListPtr rules = highlightManager_->getRules();
for (size_t i = 0; i < rules->getSize(); ++i) {
const HighlightRule& rule = rules->getRule(i);
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) {
if (i == row) {
ui_.listWidget->item(i)->setSelected(true);
onCurrentRowChanged(i);
} else {
ui_.listWidget->item(i)->setSelected(false);
}
}
ui_.listWidget->setCurrentRow(row);
}
int QtHighlightEditor::getSelectedRow() const
{
for (int i = 0; i < ui_.listWidget->count(); ++i) {
if (ui_.listWidget->item(i)->isSelected()) {
return i;
}
}
return -1;
}
HighlightRule QtHighlightEditor::ruleFromDialog()
{
HighlightRule rule;
+ HighlightAction& action = rule.getAction();
if (ui_.chatRadio->isChecked()) {
rule.setMatchChat(true);
rule.setMatchMUC(false);
} else {
rule.setMatchChat(false);
rule.setMatchMUC(true);
}
if (ui_.senderRadio->isChecked()) {
QString senderName = jid_->text();
if (!senderName.isEmpty()) {
std::vector<std::string> senders;
senders.push_back(Q2PSTRING(senderName));
rule.setSenders(senders);
+ action.setHighlightAllText(true);
}
}
if (ui_.keywordRadio->isChecked()) {
QString keywordString = ui_.keyword->text();
if (!keywordString.isEmpty()) {
std::vector<std::string> keywords;
keywords.push_back(Q2PSTRING(keywordString));
rule.setKeywords(keywords);
}
}
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.setTextColor("");
action.setTextBackground("");
} else {
action.setTextColor(Q2PSTRING(ui_.foregroundColor->getColor().name()));
action.setTextBackground(Q2PSTRING(ui_.backgroundColor->getColor().name()));
}
if (ui_.noSoundRadio->isChecked()) {
action.setPlaySound(false);
} else if (ui_.defaultSoundRadio->isChecked()) {
action.setPlaySound(true);
action.setSoundFile("");
} else {
action.setPlaySound(true);
action.setSoundFile(Q2PSTRING(ui_.soundFile->text()));
}
return rule;
}
void QtHighlightEditor::ruleToDialog(const HighlightRule& rule)
{
ui_.chatRadio->setEnabled(true);
ui_.roomRadio->setEnabled(true);
if (rule.getMatchMUC()) {
ui_.chatRadio->setChecked(false);
ui_.roomRadio->setChecked(true);
} else {
ui_.chatRadio->setChecked(true);
ui_.roomRadio->setChecked(false);
}
ui_.allMsgRadio->setEnabled(true);