diff options
| -rw-r--r-- | Swift/QtUI/QtHighlightEditor.cpp | 73 | ||||
| -rw-r--r-- | Swift/QtUI/QtHighlightEditor.h | 4 | 
2 files changed, 76 insertions, 1 deletions
| diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp index bc07158..75756b2 100644 --- a/Swift/QtUI/QtHighlightEditor.cpp +++ b/Swift/QtUI/QtHighlightEditor.cpp @@ -60,6 +60,14 @@ 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())); +	connect(ui_.radioButton, SIGNAL(clicked()), SLOT(colorOtherSelect())); +	connect(ui_.radioButton_2, SIGNAL(clicked()), SLOT(colorOtherSelect())); +	connect(ui_.radioButton_7, SIGNAL(clicked()), SLOT(colorCustomSelect())); + +	connect(ui_.radioButton_4, SIGNAL(clicked()), SLOT(soundOtherSelect())); +	connect(ui_.radioButton_5, SIGNAL(clicked()), SLOT(soundOtherSelect())); +	connect(ui_.radioButton_6, SIGNAL(clicked()), SLOT(soundCustomSelect())); +  	ui_.lineEdit->setVisible(false);  	ui_.horizontalLayout_2->addWidget(new QtSuggestingJIDInput(this, settings)); @@ -105,6 +113,30 @@ void QtHighlightEditor::setHighlightManager(HighlightManager* highlightManager)  	//ui_.moveDownButton->setEnabled(false);  } +void QtHighlightEditor::colorOtherSelect() +{ +	ui_.foreground_2->setEnabled(false); +	ui_.background->setEnabled(false); +} + +void QtHighlightEditor::colorCustomSelect() +{ +	ui_.foreground_2->setEnabled(true); +	ui_.background->setEnabled(true); +} + +void QtHighlightEditor::soundOtherSelect() +{ +	ui_.soundFile->setEnabled(false); +	ui_.soundFileButton->setEnabled(false); +} + +void QtHighlightEditor::soundCustomSelect() +{ +	ui_.soundFile->setEnabled(true); +	ui_.soundFileButton->setEnabled(true); +} +  void QtHighlightEditor::onNewButtonClicked()  {  	int row = getSelectedRow() + 1; @@ -192,6 +224,45 @@ HighlightRule QtHighlightEditor::ruleFromDialog()  {  	HighlightRule rule; +	rule.setMatchChat(ui_.checkBox->isChecked()); +	rule.setMatchMUC(ui_.checkBox_2->isChecked()); + +	if (ui_.checkBox_3->isChecked()) { +		QString senderName = ui_.lineEdit->text(); +		if (!senderName.isEmpty()) { +			std::vector<std::string> senders; +			senders.push_back(Q2PSTRING(senderName)); +			rule.setSenders(senders); +		} +	} + +	if (ui_.checkBox_4->isChecked()) { +		QString keywordString = ui_.lineEdit_2->text(); +		if (!keywordString.isEmpty()) { +			std::vector<std::string> keywords; +			keywords.push_back(Q2PSTRING(keywordString)); +			rule.setSenders(keywords); +		} +	} + +	rule.setNickIsKeyword(ui_.nickIsKeyword->isChecked()); +	rule.setMatchWholeWords(ui_.matchWholeWords_2->isChecked()); +	rule.setMatchCase(ui_.matchCase_2->isChecked()); + +	HighlightAction& action = rule.getAction(); + +	if (ui_.radioButton->isChecked()) { +		action.setHighlightText(false); +	} else if (ui_.radioButton_2->isChecked()) { +		action.setHighlightText(true); +		action.setTextColor(""); +		action.setTextBackground(""); +	} else { +		action.setHighlightText(true); +		action.setTextColor("#ffffffff"); +		action.setTextBackground("#ffffffff"); +	} +  	return rule;  } @@ -226,7 +297,7 @@ void QtHighlightEditor::ruleToDialog(const HighlightRule& rule)  	ui_.matchWholeWords_2->setChecked(rule.getMatchWholeWords());  	ui_.matchCase_2->setChecked(rule.getMatchCase()); -	const HighlightAction &action = rule.getAction(); +	const HighlightAction& action = rule.getAction();  	if (action.highlightText()) {  		if (action.getTextColor().empty() && action.getTextBackground().empty()) { diff --git a/Swift/QtUI/QtHighlightEditor.h b/Swift/QtUI/QtHighlightEditor.h index 3d52cd7..792adab 100644 --- a/Swift/QtUI/QtHighlightEditor.h +++ b/Swift/QtUI/QtHighlightEditor.h @@ -31,6 +31,10 @@ namespace Swift {  			virtual void setHighlightManager(HighlightManager* highlightManager);  		private slots: +			void colorOtherSelect(); +			void colorCustomSelect(); +			void soundOtherSelect(); +			void soundCustomSelect();  			void onNewButtonClicked();  			void onDeleteButtonClicked();  			void onMoveUpButtonClicked(); | 
 Swift
 Swift