From 1d3d73e81fa08a588036bbd1b9c896f9eefd7644 Mon Sep 17 00:00:00 2001 From: Richard Maudsley Date: Thu, 16 Jan 2014 16:52:29 +0000 Subject: Started natural language display of rule as text. Change-Id: Iaf973f96652175b6167e369cd74c1223697070a4 diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp index 75756b2..18101d5 100644 --- a/Swift/QtUI/QtHighlightEditor.cpp +++ b/Swift/QtUI/QtHighlightEditor.cpp @@ -89,7 +89,22 @@ void QtHighlightEditor::show() std::string formatNaturalDescription(const HighlightRule& rule) { - return "(null)"; + //This rule will match messages either in chats or in rooms if the sender + // is called 'Admin', and the message contains 'Urgent' (not case sensitive) + // as a part of any word. + + std::string text = "This rule will match messages "; + if (rule.getMatchChat() && rule.getMatchMUC()) { + text += "either in chats or in rooms"; + } else if (rule.getMatchChat()) { + text += "in chats only"; + } else if (rule.getMatchMUC()) { + text += "in rooms only"; + } else { + return "This rule has not been marked as a chat or room rule!"; + } + + return text; } void QtHighlightEditor::setHighlightManager(HighlightManager* highlightManager) @@ -188,7 +203,8 @@ void QtHighlightEditor::onCurrentRowChanged(int currentRow) void QtHighlightEditor::onApplyButtonClick() { - close(); + ui_.textEdit_2->setText(P2QSTRING(formatNaturalDescription(ruleFromDialog()))); +// close(); } void QtHighlightEditor::onCancelButtonClick() -- cgit v0.10.2-6-g49f6