summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-01-16 15:14:20 (GMT)
committerRichard Maudsley <richard.maudsley@isode.com>2014-01-16 15:14:20 (GMT)
commitcacd6f5cc3754872653311d5333145f2256079d9 (patch)
treee4258b40a8ea33e94e5d6183b1f439a795a7b37c /Swift/QtUI
parentc4f8b7b06d038473a377c88d0dee54b69f67c77a (diff)
downloadswift-cacd6f5cc3754872653311d5333145f2256079d9.zip
swift-cacd6f5cc3754872653311d5333145f2256079d9.tar.bz2
Updated highlight dialog.
Change-Id: I9bf91fdbf542e01a9f2421315698846ca0bdb043
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtHighlightEditor.cpp67
-rw-r--r--Swift/QtUI/QtHighlightEditor.h3
-rw-r--r--Swift/QtUI/QtHighlightEditor.ui38
3 files changed, 99 insertions, 9 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp
index f4ec78f..bc07158 100644
--- a/Swift/QtUI/QtHighlightEditor.cpp
+++ b/Swift/QtUI/QtHighlightEditor.cpp
@@ -14,9 +14,11 @@
#include <boost/lexical_cast.hpp>
+#include <Swift/QtUI/UserSearch/QtSuggestingJIDInput.h>
#include <Swift/Controllers/HighlightManager.cpp>
#include <Swift/QtUI/QtHighlightEditor.h>
#include <Swift/QtUI/QtSwiftUtil.h>
+#include <Swift/QtUI/QtSettingsProvider.h>
#include <QTreeWidgetItem>
@@ -58,6 +60,9 @@ QtHighlightEditor::QtHighlightEditor(QtSettingsProvider* settings, QWidget* pare
connect(ui_.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), SLOT(onCancelButtonClick()));
connect(ui_.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(onOkButtonClick()));
+ ui_.lineEdit->setVisible(false);
+ ui_.horizontalLayout_2->addWidget(new QtSuggestingJIDInput(this, settings));
+
setWindowTitle(tr("Highlight Rules"));
}
@@ -145,7 +150,6 @@ void QtHighlightEditor::onCurrentRowChanged(int currentRow)
//ui_.ruleWidget->setEnabled(index.isValid());
ui_.deleteButton->setEnabled(currentRow != -1);
-
ui_.moveUpButton->setEnabled(currentRow != -1 && currentRow != 0);
ui_.moveDownButton->setEnabled(currentRow != -1 && currentRow != (ui_.listWidget->count()-1));
}
@@ -184,4 +188,65 @@ int QtHighlightEditor::getSelectedRow() const
return -1;
}
+HighlightRule QtHighlightEditor::ruleFromDialog()
+{
+ HighlightRule rule;
+
+ return rule;
+}
+
+void QtHighlightEditor::ruleToDialog(const HighlightRule& rule)
+{
+ ui_.checkBox->setChecked(rule.getMatchChat());
+ ui_.checkBox_2->setChecked(rule.getMatchMUC());
+
+ std::vector<std::string> senders = rule.getSenders();
+ if (senders.empty()) {
+ ui_.checkBox_3->setChecked(false);
+ ui_.lineEdit->setEnabled(false);
+ ui_.lineEdit->setText("");
+ } else {
+ ui_.checkBox_3->setChecked(true);
+ ui_.lineEdit->setEnabled(true);
+ ui_.lineEdit->setText(P2QSTRING(senders[0]));
+ }
+
+ std::vector<std::string> keywords = rule.getKeywords();
+ if (keywords.empty()) {
+ ui_.checkBox_4->setChecked(false);
+ ui_.lineEdit_2->setEnabled(false);
+ ui_.lineEdit_2->setText("");
+ } else {
+ ui_.checkBox_4->setChecked(true);
+ ui_.lineEdit_2->setEnabled(true);
+ ui_.lineEdit_2->setText(P2QSTRING(keywords[0]));
+ }
+
+ ui_.nickIsKeyword->setChecked(rule.getNickIsKeyword());
+ ui_.matchWholeWords_2->setChecked(rule.getMatchWholeWords());
+ ui_.matchCase_2->setChecked(rule.getMatchCase());
+
+ const HighlightAction &action = rule.getAction();
+
+ if (action.highlightText()) {
+ if (action.getTextColor().empty() && action.getTextBackground().empty()) {
+ ui_.radioButton_2->setChecked(true);
+ } else {
+ ui_.radioButton_7->setChecked(true);
+ }
+ } else {
+ ui_.radioButton->setChecked(true);
+ }
+
+ if (action.playSound()) {
+ if (action.getSoundFile().empty()) {
+ ui_.radioButton_5->setChecked(true);
+ } else {
+ ui_.radioButton_6->setChecked(true);
+ }
+ } else {
+ ui_.radioButton_4->setChecked(true);
+ }
+}
+
}
diff --git a/Swift/QtUI/QtHighlightEditor.h b/Swift/QtUI/QtHighlightEditor.h
index 4769ed9..3d52cd7 100644
--- a/Swift/QtUI/QtHighlightEditor.h
+++ b/Swift/QtUI/QtHighlightEditor.h
@@ -12,6 +12,7 @@
#pragma once
+#include <Swift/Controllers/HighlightRule.h>
#include <Swift/Controllers/UIInterfaces/HighlightEditorWindow.h>
#include <Swift/QtUI/ui_QtHighlightEditor.h>
@@ -43,6 +44,8 @@ namespace Swift {
void selectRow(int row);
int getSelectedRow() const;
+ HighlightRule ruleFromDialog();
+ void ruleToDialog(const HighlightRule& rule);
Ui::QtHighlightEditor ui_;
QtSettingsProvider* settings_;
diff --git a/Swift/QtUI/QtHighlightEditor.ui b/Swift/QtUI/QtHighlightEditor.ui
index 2b37e3c..8355381 100644
--- a/Swift/QtUI/QtHighlightEditor.ui
+++ b/Swift/QtUI/QtHighlightEditor.ui
@@ -52,8 +52,7 @@
</property>
<property name="icon">
<iconset theme="list-add">
- <normaloff/>
- </iconset>
+ <normaloff>../../../../../home/rm/.designer/backup</normaloff>../../../../../home/rm/.designer/backup</iconset>
</property>
</widget>
</item>
@@ -64,8 +63,7 @@
</property>
<property name="icon">
<iconset theme="list-remove">
- <normaloff/>
- </iconset>
+ <normaloff>../../../../../home/rm/.designer/backup</normaloff>../../../../../home/rm/.designer/backup</iconset>
</property>
</widget>
</item>
@@ -76,8 +74,7 @@
</property>
<property name="icon">
<iconset theme="up">
- <normaloff/>
- </iconset>
+ <normaloff>../../../../../home/rm/.designer/backup</normaloff>../../../../../home/rm/.designer/backup</iconset>
</property>
</widget>
</item>
@@ -88,8 +85,7 @@
</property>
<property name="icon">
<iconset theme="down">
- <normaloff/>
- </iconset>
+ <normaloff>../../../../../home/rm/.designer/backup</normaloff>../../../../../home/rm/.designer/backup</iconset>
</property>
</widget>
</item>
@@ -291,6 +287,19 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</item>
<item>
@@ -371,6 +380,19 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_6">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</item>
<item>