コード例 #1
0
std::vector<HighlightRule> HighlightManager::getDefaultRules()
{
	std::vector<HighlightRule> rules;

	HighlightRule chatNotificationRule;
	chatNotificationRule.setMatchChat(true);
	chatNotificationRule.getAction().setPlaySound(true);
	chatNotificationRule.setMatchWholeWords(true);
	rules.push_back(chatNotificationRule);

	HighlightRule selfMentionMUCRule;
	selfMentionMUCRule.setMatchMUC(true);
	selfMentionMUCRule.getAction().setPlaySound(true);
	selfMentionMUCRule.setNickIsKeyword(true);
	selfMentionMUCRule.setMatchCase(true);
	selfMentionMUCRule.setMatchWholeWords(true);
	rules.push_back(selfMentionMUCRule);

	return rules;
}
コード例 #2
0
	static HighlightRule ruleFromKeyword(const std::string& keyword, bool matchCase, bool matchWholeWord)
	{
		HighlightRule rule;
		std::vector<std::string> keywords;
		keywords.push_back(keyword);
		rule.setKeywords(keywords);
		rule.setMatchCase(matchCase);
		rule.setMatchWholeWords(matchWholeWord);
		rule.setMatchChat(true);
		rule.getAction().setTextBackground("white");
		return rule;
	}
コード例 #3
0
	static HighlightRulesListPtr ruleListWithNickHighlight(bool withHighlightColour = true)
	{
		HighlightRule rule;
		rule.setMatchChat(true);
		rule.setNickIsKeyword(true);
		rule.setMatchCase(true);
		rule.setMatchWholeWords(true);
		if (withHighlightColour) {
			rule.getAction().setTextBackground("white");
		}
		boost::shared_ptr<HighlightManager::HighlightRulesList> list = boost::make_shared<HighlightManager::HighlightRulesList>();
		list->addRule(rule);
		return list;
	}
コード例 #4
0
ファイル: QtHighlightEditor.cpp プロジェクト: jyhong836/swift
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());
	}

	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;
}