/* * Copyright (c) 2012 Catalin Badea * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ #include #include #include #include #include namespace Swift { QtHistoryWindow::QtHistoryWindow() { ui_.setupUi(this); QtChatTheme* theme = new QtChatTheme(""); // FIXME: leak 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_); conversation_->addMessage(boost::make_shared("hey", "Me", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/storage/iron_man.png", false, false, theme, "id")); conversation_->addMessage(boost::make_shared("hey", "You", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/storage/war_machine.png", true, false, theme, "id2")); conversation_->addMessage(boost::make_shared("knock knock", "Me", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/storage/iron_man.png", false, false, theme, "id")); conversation_->addMessage(boost::make_shared("who's there?", "You", QDateTime::currentDateTime(), "http://swarm.cs.pub.ro/~cbadea/storage/war_machine.png", true, false, theme, "id2")); setWindowTitle(tr("History")); } QtHistoryWindow::~QtHistoryWindow() { } void QtHistoryWindow::activate() { emit wantsToActivate(); } void QtHistoryWindow::showEvent(QShowEvent* event) { emit windowOpening(); emit titleUpdated(); QWidget::showEvent(event); } void QtHistoryWindow::closeEvent(QCloseEvent* event) { emit windowClosing(); event->accept(); } }