summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtHistoryWindow.cpp')
-rw-r--r--Swift/QtUI/QtHistoryWindow.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp
index 4b459de..d067190 100644
--- a/Swift/QtUI/QtHistoryWindow.cpp
+++ b/Swift/QtUI/QtHistoryWindow.cpp
@@ -9,6 +9,7 @@
#include <QtSwiftUtil.h>
#include <MessageSnippet.h>
+#include <Swiften/History/HistoryMessage.h>
#include <string>
#include <boost/shared_ptr.hpp>
@@ -19,10 +20,10 @@ namespace Swift {
QtHistoryWindow::QtHistoryWindow(SettingsProvider* settings, UIEventStream* eventStream) {
ui_.setupUi(this);
- QtChatTheme* theme = new QtChatTheme(""); // FIXME: leak
+ theme_ = new QtChatTheme("");
delete ui_.conversation_;
- conversation_ = new QtChatView(theme, this);
+ conversation_ = new QtChatView(theme_, this);
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
sizePolicy.setHorizontalStretch(80);
sizePolicy.setVerticalStretch(0);
@@ -40,18 +41,11 @@ QtHistoryWindow::QtHistoryWindow(SettingsProvider* settings, UIEventStream* even
ui_.bottomLeftLayout_->setDirection(QBoxLayout::BottomToTop);
ui_.bottomLeftLayout_->addWidget(conversationRoster_);
- conversation_->addMessage(boost::make_shared<MessageSnippet>("Hi", "Me", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/swift/iron-man.png", false, false, theme, "id"));
- conversation_->addMessage(boost::make_shared<MessageSnippet>("Hi", "You", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/swift/putin.png", true, false, theme, "id2"));
- conversation_->addMessage(boost::make_shared<MessageSnippet>("How is it going?", "Me", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/swift/iron-man.png", false, false, theme, "id"));
- conversation_->addMessage(boost::make_shared<MessageSnippet>("Fine, just going through some documents.", "You", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/swift/putin.png", true, false, theme, "id2"));
- conversation_->addMessage(boost::make_shared<MessageSnippet>("Cool. Hey, do you want to go for a beer?", "Me", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/swift/iron-man.png", false, false, theme, "id"));
- conversation_->addMessage(boost::make_shared<MessageSnippet>("Sure. Meet me at the pub around 10?", "You", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/swift/putin.png", true, false, theme, "id2"));
- conversation_->addMessage(boost::make_shared<MessageSnippet>("See you there.", "Me", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/swift/iron-man.png", false, false, theme, "id"));
-
setWindowTitle(tr("History"));
}
QtHistoryWindow::~QtHistoryWindow() {
+ delete theme_;
}
void QtHistoryWindow::activate() {
@@ -73,4 +67,9 @@ void QtHistoryWindow::setRosterModel(Roster* model) {
conversationRoster_->setRosterModel(model);
}
+void QtHistoryWindow::addMessage(const HistoryMessage& message) {
+ boost::shared_ptr<MessageSnippet> snippet(new MessageSnippet(QString::fromStdString(message.getMessage()), QString::fromStdString(message.getDisplayNick()), QDateTime::currentDateTime(), "", false, false, theme_, "id"));
+ conversation_->addMessage(snippet);
+}
+
}