summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/Controllers/HistoryController.cpp13
-rw-r--r--Swift/Controllers/HistoryController.h2
-rw-r--r--Swift/Controllers/UIInterfaces/HistoryWindow.h3
-rw-r--r--Swift/Controllers/UIInterfaces/HistoryWindowFactory.h2
-rw-r--r--Swift/QtUI/QtHistoryWindow.cpp32
-rw-r--r--Swift/QtUI/QtHistoryWindow.h5
-rw-r--r--Swift/QtUI/QtHistoryWindow.ui84
-rw-r--r--Swift/QtUI/QtUIFactory.cpp4
-rw-r--r--Swift/QtUI/QtUIFactory.h2
9 files changed, 97 insertions, 50 deletions
diff --git a/Swift/Controllers/HistoryController.cpp b/Swift/Controllers/HistoryController.cpp
index 4f97006..6d8e68e 100644
--- a/Swift/Controllers/HistoryController.cpp
+++ b/Swift/Controllers/HistoryController.cpp
@@ -18,13 +18,24 @@ HistoryController::HistoryController(UIEventStream* uiEventStream, HistoryWindow
HistoryController::~HistoryController() {
uiEventStream_->onUIEvent.disconnect(boost::bind(&HistoryController::handleUIEvent, this, _1));
delete historyWindow_;
+ delete roster_;
}
void HistoryController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) {
boost::shared_ptr<RequestHistoryUIEvent> event = boost::dynamic_pointer_cast<RequestHistoryUIEvent>(rawEvent);
if (event != NULL) {
if (historyWindow_ == NULL) {
- historyWindow_ = historyWindowFactory_->createHistoryWindow();
+ historyWindow_ = historyWindowFactory_->createHistoryWindow(uiEventStream_);
+ roster_ = new Roster(false, true);
+ historyWindow_->setRosterModel(roster_);
+
+ JID putin("vputin@karla.com");
+ JID medvedev("dmedvedev@karla.com");
+ JID kev("kevin@doomsong.co.uk");
+ const std::set<ContactRosterItem::Feature> none;
+ roster_->addContact(putin, putin, "Vladimir Putin", "Recent", "");
+ roster_->addContact(medvedev, medvedev, "Dmitri Medvedev", "Recent", "");
+ roster_->addContact(kev, kev, "Kev", "Recent", "");
}
historyWindow_->activate();
}
diff --git a/Swift/Controllers/HistoryController.h b/Swift/Controllers/HistoryController.h
index 47ae361..320b26e 100644
--- a/Swift/Controllers/HistoryController.h
+++ b/Swift/Controllers/HistoryController.h
@@ -15,6 +15,7 @@
namespace Swift {
class HistoryWindowFactory;
class HistoryWindow;
+ class Roster;
class HistoryController {
public:
@@ -28,5 +29,6 @@ namespace Swift {
UIEventStream* uiEventStream_;
HistoryWindowFactory* historyWindowFactory_;
HistoryWindow* historyWindow_;
+ Roster* roster_;
};
}
diff --git a/Swift/Controllers/UIInterfaces/HistoryWindow.h b/Swift/Controllers/UIInterfaces/HistoryWindow.h
index cb29120..713f986 100644
--- a/Swift/Controllers/UIInterfaces/HistoryWindow.h
+++ b/Swift/Controllers/UIInterfaces/HistoryWindow.h
@@ -6,11 +6,14 @@
#pragma once
+#include <Swift/Controllers/Roster/Roster.h>
+
namespace Swift {
class HistoryWindow {
public:
virtual ~HistoryWindow() {};
virtual void activate() = 0;
+ virtual void setRosterModel(Roster*) = 0;
};
}
diff --git a/Swift/Controllers/UIInterfaces/HistoryWindowFactory.h b/Swift/Controllers/UIInterfaces/HistoryWindowFactory.h
index 135438b..e91bc37 100644
--- a/Swift/Controllers/UIInterfaces/HistoryWindowFactory.h
+++ b/Swift/Controllers/UIInterfaces/HistoryWindowFactory.h
@@ -13,6 +13,6 @@ namespace Swift {
class HistoryWindowFactory {
public:
virtual ~HistoryWindowFactory() {};
- virtual HistoryWindow* createHistoryWindow() = 0;
+ virtual HistoryWindow* createHistoryWindow(UIEventStream* eventStream) = 0;
};
}
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();