summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-02-17 16:53:24 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-02-17 16:53:24 (GMT)
commitde6cb039589e8dc06bf7a5ded562cbc8ce8fff8a (patch)
treed19bf2c5cbe675ffd6b7a62118cd39d48a597d77 /Swift/QtUI
parentca9652bededa2b2d65f0203f467ca801dc5199dc (diff)
downloadswift-de6cb039589e8dc06bf7a5ded562cbc8ce8fff8a.zip
swift-de6cb039589e8dc06bf7a5ded562cbc8ce8fff8a.tar.bz2
Add /me support it QtUI
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp10
-rw-r--r--Swift/QtUI/QtChatWindow.h1
2 files changed, 9 insertions, 2 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index 6765e8a..915e941 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -165,6 +165,10 @@ void QtChatWindow::updateTitleWithUnreadCount() {
}
void QtChatWindow::addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath) {
+ addMessage(message, senderName, senderIsSelf, label, avatarPath, "");
+}
+
+void QtChatWindow::addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const QString& style) {
if (isWidgetSelected()) {
onAllMessagesRead();
}
@@ -177,7 +181,9 @@ void QtChatWindow::addMessage(const String &message, const String &senderName, b
QString messageHTML(Qt::escape(P2QSTRING(message)));
messageHTML.replace("\n","<br/>");
messageHTML = P2QSTRING(Linkify::linkify(Q2PSTRING(messageHTML)));
- htmlString += messageHTML;
+ QString styleSpanStart = style == "" ? "" : "<span style=\"" + style + "\">";
+ QString styleSpanEnd = style == "" ? "" : "</span>";
+ htmlString += styleSpanStart + messageHTML + styleSpanEnd;
bool appendToPrevious = !previousMessageWasSystem_ && ((senderIsSelf && previousMessageWasSelf_) || (!senderIsSelf && !previousMessageWasSelf_ && previousSenderName_ == P2QSTRING(senderName)));
QString qAvatarPath = avatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(P2QSTRING(avatarPath)).toEncoded();
@@ -189,7 +195,7 @@ void QtChatWindow::addMessage(const String &message, const String &senderName, b
}
void QtChatWindow::addAction(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath) {
- addMessage(message, senderName, senderIsSelf, label, avatarPath);
+ addMessage(" *" + message + "*", senderName, senderIsSelf, label, avatarPath, "font-style:italic ");
}
void QtChatWindow::addErrorMessage(const String& errorMessage) {
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index bde91e1..80d2868 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -50,6 +50,7 @@ namespace Swift {
private:
void updateTitleWithUnreadCount();
+ void addMessage(const String &message, const String &senderName, bool senderIsSelf, const boost::optional<SecurityLabel>& label, const String& avatarPath, const QString& style);
int unreadCount_;
bool contactIsTyping_;