summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/ChatSnippet.h')
-rw-r--r--Swift/QtUI/ChatSnippet.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/Swift/QtUI/ChatSnippet.h b/Swift/QtUI/ChatSnippet.h
index f79f487..f60d486 100644
--- a/Swift/QtUI/ChatSnippet.h
+++ b/Swift/QtUI/ChatSnippet.h
@@ -1,4 +1,4 @@
/*
- * Copyright (c) 2010 Kevin Smith
+ * Copyright (c) 2010-2013 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
@@ -11,9 +11,18 @@
#include <QString>
#include <QDateTime>
-#include "QtChatTheme.h"
+
+#include <Swiften/Base/foreach.h>
+#include <Swift/Controllers/UIInterfaces/ChatWindow.h>
+#include <Swift/QtUI/QtChatTheme.h>
+
namespace Swift {
class ChatSnippet {
public:
+ enum Direction {
+ RTL,
+ LTR
+ };
+
ChatSnippet(bool appendToPrevious);
virtual ~ChatSnippet();
@@ -32,7 +41,9 @@ namespace Swift {
result.replace("%message%", "&#37;message&#37;");
result.replace("%sender%", "&#37;sender&#37;");
+ result.replace("%wrapped_sender%", "&#37;wrapped_sender&#37;");
result.replace("%time%", "%&#37;time&#37;");
result.replace("%shortTime%", "%&#37;shortTime&#37;");
result.replace("%userIconPath%", "&#37;userIconPath&#37;");
+ result.replace("\t", " ");
result.replace(" ", "&nbsp;&nbsp;");
return result;
@@ -41,5 +52,11 @@ namespace Swift {
static QString timeToEscapedString(const QDateTime& time);
+ static Direction getDirection(const std::string& message);
+ static Direction getDirection(const ChatWindow::ChatMessage& message);
+ static Direction getDirection(const QString& message);
+
protected:
+ static QString directionToCSS(Direction direction);
+
QString wrapResizable(const QString& text);
void setContinuationFallbackSnippet(boost::shared_ptr<ChatSnippet> continuationFallback) {