summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index 5223ddb..e4cb004 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -652,23 +652,36 @@ void QtChatWindow::addSystemMessage(const std::string& message) {
QString messageHTML(Qt::escape(P2QSTRING(message)));
messageHTML = P2QSTRING(Linkify::linkify(Q2PSTRING(messageHTML)));
messageHTML.replace("\n","<br/>");
messageLog_->addMessage(boost::shared_ptr<ChatSnippet>(new SystemMessageSnippet(messageHTML, QDateTime::currentDateTime(), false, theme_)));
previousMessageKind_ = PreviousMessageWasSystem;
}
+void QtChatWindow::replaceWithAction(const std::string& message, const std::string& id, const boost::posix_time::ptime& time) {
+ replaceMessage(" *" + message + "*", id, time, "font-style:italic ");
+}
+
void QtChatWindow::replaceMessage(const std::string& message, const std::string& id, const boost::posix_time::ptime& time) {
+ replaceMessage(message, id, time, "");
+}
+
+void QtChatWindow::replaceMessage(const std::string& message, const std::string& id, const boost::posix_time::ptime& time, const QString& style) {
if (!id.empty()) {
QString messageHTML(Qt::escape(P2QSTRING(message)));
messageHTML = P2QSTRING(Linkify::linkify(Q2PSTRING(messageHTML)));
messageHTML.replace("\n","<br/>");
+
+ QString styleSpanStart = style == "" ? "" : "<span style=\"" + style + "\">";
+ QString styleSpanEnd = style == "" ? "" : "</span>";
+ messageHTML = styleSpanStart + messageHTML + styleSpanEnd;
+
messageLog_->replaceMessage(messageHTML, P2QSTRING(id), B2QDATE(time));
}
else {
qWarning() << "Trying to replace a message with no id";
}
}
void QtChatWindow::addPresenceMessage(const std::string& message) {
if (isWidgetSelected()) {