diff options
author | Catalin Badea <catalin.badea392@gmail.com> | 2012-06-19 20:16:09 (GMT) |
---|---|---|
committer | Catalin Badea <catalin.badea392@gmail.com> | 2012-06-19 20:21:54 (GMT) |
commit | cba5a2aa6db557102998028977e4d84d25181304 (patch) | |
tree | 91736a7baadbbdee6a5e64396fd034fb15f43b69 /Swift/QtUI | |
parent | 063e2e2f59d294bd632942266773d61f5a815e27 (diff) | |
download | swift-contrib-cba5a2aa6db557102998028977e4d84d25181304.zip swift-contrib-cba5a2aa6db557102998028977e4d84d25181304.tar.bz2 |
Added contact roster
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtHistoryWindow.cpp | 32 | ||||
-rw-r--r-- | Swift/QtUI/QtHistoryWindow.h | 5 | ||||
-rw-r--r-- | Swift/QtUI/QtHistoryWindow.ui | 84 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.h | 2 |
5 files changed, 79 insertions, 48 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); +} + } diff --git a/Swift/QtUI/QtHistoryWindow.h b/Swift/QtUI/QtHistoryWindow.h index 08db473..d61fb49 100644 --- a/Swift/QtUI/QtHistoryWindow.h +++ b/Swift/QtUI/QtHistoryWindow.h @@ -10,6 +10,7 @@ #include <Swift/QtUI/ui_QtHistoryWindow.h> #include <QtChatView.h> #include <QtTabbable.h> +#include <Swift/QtUI/Roster/QtRosterWidget.h> class QTextEdit; class QCheckBox; @@ -20,9 +21,10 @@ namespace Swift { Q_OBJECT public: - QtHistoryWindow(); + QtHistoryWindow(SettingsProvider*, UIEventStream*); ~QtHistoryWindow(); void activate(); + void setRosterModel(Roster*); private: virtual void closeEvent(QCloseEvent* event); @@ -30,5 +32,6 @@ namespace Swift { Ui::QtHistoryWindow ui_; QtChatView* conversation_; + QtRosterWidget* conversationRoster_; }; } diff --git a/Swift/QtUI/QtHistoryWindow.ui b/Swift/QtUI/QtHistoryWindow.ui index 83168ab..77d592f 100644 --- a/Swift/QtUI/QtHistoryWindow.ui +++ b/Swift/QtUI/QtHistoryWindow.ui @@ -13,18 +13,18 @@ <property name="windowTitle"> <string>Form</string> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="topLayout"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="topLayout_"> <item> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="label_"> <property name="text"> <string>Search:</string> </property> </widget> </item> <item> - <widget class="QComboBox" name="searchBox"> + <widget class="QComboBox" name="searchBox_"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -36,43 +36,55 @@ </property> </widget> </item> - </layout> - </item> - <item> - <widget class="QSplitter" name="bottomLayout"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <widget class="QListWidget" name="conversationList"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>5</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>180</width> - <height>0</height> - </size> - </property> - <item> + <item> + <widget class="QPushButton" name="nextButton_"> <property name="text"> - <string>War Machine</string> + <string>Next</string> </property> - </item> - <item> - <property name="text"> - <string>Nick Fury</string> + <property name="flat"> + <bool>false</bool> </property> - </item> - <item> + </widget> + </item> + <item> + <widget class="QPushButton" name="previousButton_"> <property name="text"> - <string>Hawkeye</string> + <string>Previous</string> </property> - </item> + </widget> + </item> + </layout> + </item> + <item row="1" column="0"> + <widget class="QSplitter" name="bottomLayout_"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <widget class="QWidget" name="layoutWidget"> + <layout class="QVBoxLayout" name="bottomLeftLayout_" stretch="0,0"> + <item> + <widget class="QWidget" name="conversationRoster_" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>5</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item> + <widget class="QCalendarWidget" name="calendarWidget_"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> </widget> - <widget class="QWidget" name="conversation" native="true"> + <widget class="QWidget" name="conversation_" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>85</horstretch> diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index 03a2929..7963205 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -45,8 +45,8 @@ XMLConsoleWidget* QtUIFactory::createXMLConsoleWidget() { return widget; } -HistoryWindow* QtUIFactory::createHistoryWindow() { - QtHistoryWindow* window = new QtHistoryWindow(); +HistoryWindow* QtUIFactory::createHistoryWindow(UIEventStream* uiEventStream) { + QtHistoryWindow* window = new QtHistoryWindow(settings, uiEventStream); tabs->addTab(window); if (!tabs->isVisible()) { tabs->show(); diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h index 0fa95b8..b30eecb 100644 --- a/Swift/QtUI/QtUIFactory.h +++ b/Swift/QtUI/QtUIFactory.h @@ -31,7 +31,7 @@ namespace Swift { QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabs* tabs, QSplitter* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, bool startMinimized, bool emoticonsExist); virtual XMLConsoleWidget* createXMLConsoleWidget(); - virtual HistoryWindow* createHistoryWindow(); + virtual HistoryWindow* createHistoryWindow(UIEventStream*); virtual MainWindow* createMainWindow(UIEventStream* eventStream); virtual LoginWindow* createLoginWindow(UIEventStream* eventStream); virtual EventWindow* createEventWindow(); |