diff options
Diffstat (limited to 'Swift/QtUI/QtHistoryWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtHistoryWindow.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index 192406e..4b459de 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -16,25 +16,37 @@ namespace Swift { -QtHistoryWindow::QtHistoryWindow() { +QtHistoryWindow::QtHistoryWindow(SettingsProvider* settings, UIEventStream* eventStream) { ui_.setupUi(this); QtChatTheme* theme = new QtChatTheme(""); // FIXME: leak - delete ui_.conversation; + delete ui_.conversation_; conversation_ = new QtChatView(theme, this); QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(80); sizePolicy.setVerticalStretch(0); conversation_->setSizePolicy(sizePolicy); - ui_.conversation = conversation_; - ui_.bottomLayout->addWidget(conversation_); + ui_.conversation_ = conversation_; + ui_.bottomLayout_->addWidget(conversation_); - conversation_->addMessage(boost::make_shared<MessageSnippet>("hey", "Me", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/storage/iron_man.png", false, false, theme, "id")); - conversation_->addMessage(boost::make_shared<MessageSnippet>("hey", "You", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/storage/war_machine.png", true, false, theme, "id2")); - conversation_->addMessage(boost::make_shared<MessageSnippet>("knock knock", "Me", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/storage/iron_man.png", false, false, theme, "id")); - conversation_->addMessage(boost::make_shared<MessageSnippet>("who's there?", "You", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/storage/war_machine.png", true, false, theme, "id2")); + delete ui_.conversationRoster_; + conversationRoster_ = new QtRosterWidget(eventStream, settings, this); + QSizePolicy sizePolicy2(QSizePolicy::Preferred, QSizePolicy::Expanding); + sizePolicy2.setVerticalStretch(80); + conversationRoster_->setSizePolicy(sizePolicy2); + ui_.conversationRoster_ = conversationRoster_; + 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")); } @@ -57,4 +69,8 @@ void QtHistoryWindow::closeEvent(QCloseEvent* event) { event->accept(); } +void QtHistoryWindow::setRosterModel(Roster* model) { + conversationRoster_->setRosterModel(model); +} + } |