summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/MainController.cpp16
-rw-r--r--Swift/Controllers/MainController.h7
-rw-r--r--Swift/Controllers/SConscript4
-rw-r--r--Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h9
-rw-r--r--Swift/Controllers/UIEvents/UIEvent.cpp7
-rw-r--r--Swift/Controllers/UIEvents/UIEvent.h8
-rw-r--r--Swift/Controllers/UIEvents/UIEventStream.h15
-rw-r--r--Swift/Controllers/UIInterfaces/LoginWindow.h (renamed from Swift/Controllers/LoginWindow.h)0
-rw-r--r--Swift/Controllers/UIInterfaces/LoginWindowFactory.h (renamed from Swift/Controllers/LoginWindowFactory.h)5
-rw-r--r--Swift/Controllers/UIInterfaces/XMLConsoleWidget.h7
-rw-r--r--Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h12
-rw-r--r--Swift/Controllers/XMLConsoleController.cpp21
-rw-r--r--Swift/Controllers/XMLConsoleController.h21
-rw-r--r--Swift/QtUI/QtChatWindowFactory.cpp4
-rw-r--r--Swift/QtUI/QtChatWindowFactory.h2
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp16
-rw-r--r--Swift/QtUI/QtLoginWindow.h8
-rw-r--r--Swift/QtUI/QtLoginWindowFactory.cpp4
-rw-r--r--Swift/QtUI/QtLoginWindowFactory.h4
-rw-r--r--Swift/QtUI/QtSwift.cpp10
-rw-r--r--Swift/QtUI/QtSwift.h5
-rw-r--r--Swift/QtUI/QtXMLConsole.cpp0
-rw-r--r--Swift/QtUI/QtXMLConsole.h0
-rw-r--r--Swift/QtUI/QtXMLConsoleWidget.cpp7
-rw-r--r--Swift/QtUI/QtXMLConsoleWidget.h12
-rw-r--r--Swift/QtUI/QtXMLConsoleWidgetFactory.cpp22
-rw-r--r--Swift/QtUI/QtXMLConsoleWidgetFactory.h16
-rw-r--r--Swift/QtUI/SConscript2
28 files changed, 223 insertions, 21 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index e030a31..0705eb4 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -10,8 +10,8 @@
#include "Swift/Controllers/ChatController.h"
#include "Swift/Controllers/ChatWindowFactory.h"
#include "Swift/Controllers/EventController.h"
-#include "Swift/Controllers/LoginWindow.h"
-#include "Swift/Controllers/LoginWindowFactory.h"
+#include "Swift/Controllers/UIInterfaces/LoginWindow.h"
+#include "Swift/Controllers/UIInterfaces/LoginWindowFactory.h"
#include "Swift/Controllers/MainWindow.h"
#include "Swift/Controllers/MainWindowFactory.h"
#include "Swift/Controllers/MUCController.h"
@@ -22,7 +22,10 @@
#include "Swift/Controllers/SoundPlayer.h"
#include "Swift/Controllers/SystemTray.h"
#include "Swift/Controllers/SystemTrayController.h"
+#include "Swift/Controllers/XMLConsoleController.h"
#include "Swift/Controllers/XMPPRosterController.h"
+#include "Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h"
+#include "Swift/Controllers/UIEvents/UIEventStream.h"
#include "Swiften/Base/foreach.h"
#include "Swiften/Base/String.h"
#include "Swiften/Client/Client.h"
@@ -60,11 +63,12 @@ static const String CLIENT_NODE = "http://swift.im";
typedef std::pair<JID, ChatController*> JIDChatControllerPair;
typedef std::pair<JID, MUCController*> JIDMUCControllerPair;
-MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory *treeWidgetFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer)
+MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory *treeWidgetFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory)
: timerFactory_(&boostIOServiceThread_.getIOService()), idleDetector_(&idleQuerier_, &timerFactory_, 100), client_(NULL), presenceSender_(NULL), chatWindowFactory_(chatWindowFactory), mainWindowFactory_(mainWindowFactory), loginWindowFactory_(loginWindowFactory), treeWidgetFactory_(treeWidgetFactory), settings_(settings), xmppRosterController_(NULL), rosterController_(NULL), loginWindow_(NULL), clientVersionResponder_(NULL), nickResolver_(NULL), discoResponder_(NULL) {
application_ = application;
presenceOracle_ = NULL;
avatarManager_ = NULL;
+ uiEventStream_ = new UIEventStream();
avatarStorage_ = new AvatarFileStorage(application_->getAvatarDir());
@@ -72,7 +76,7 @@ MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowF
eventController_->onEventQueueLengthChange.connect(boost::bind(&MainController::handleEventQueueLengthChange, this, _1));
systemTrayController_ = new SystemTrayController(eventController_, systemTray);
soundEventController_ = new SoundEventController(eventController_, soundPlayer, settings->getBoolSetting("playSounds", true));
- loginWindow_ = loginWindowFactory_->createLoginWindow();
+ loginWindow_ = loginWindowFactory_->createLoginWindow(uiEventStream_);
foreach (String profile, settings->getAvailableProfiles()) {
ProfileSettingsProvider* profileSettings = new ProfileSettingsProvider(profile, settings);
loginWindow_->addAvailableAccount(profileSettings->getStringSetting("jid"), profileSettings->getStringSetting("pass"), profileSettings->getStringSetting("certificate"));
@@ -83,6 +87,8 @@ MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowF
idleDetector_.setIdleTimeSeconds(600);
idleDetector_.onIdleChanged.connect(boost::bind(&MainController::handleInputIdleChanged, this, _1));
+
+ xmlConsoleController_ = new XMLConsoleController(uiEventStream_, xmlConsoleWidgetFactory);
}
MainController::~MainController() {
@@ -95,6 +101,8 @@ MainController::~MainController() {
delete systemTrayController_;
delete soundEventController_;
delete avatarStorage_;
+ delete xmlConsoleController_;
+ delete uiEventStream_;
resetClient();
}
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index 78e49a2..c260f33 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -47,10 +47,13 @@ namespace Swift {
class SystemTrayController;
class SoundEventController;
class SoundPlayer;
+ class XMLConsoleController;
+ class UIEventStream;
+ class XMLConsoleWidgetFactory;
class MainController : public MUCRegistry {
public:
- MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory* treeWidgetFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer);
+ MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory* treeWidgetFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory);
~MainController();
@@ -103,6 +106,8 @@ namespace Swift {
SoftwareVersionResponder* clientVersionResponder_;
NickResolver* nickResolver_;
DiscoInfoResponder* discoResponder_;
+ UIEventStream* uiEventStream_;
+ XMLConsoleController* xmlConsoleController_;
boost::shared_ptr<CapsInfo> capsInfo_;
std::map<JID, MUCController*> mucControllers_;
std::map<JID, ChatController*> chatControllers_;
diff --git a/Swift/Controllers/SConscript b/Swift/Controllers/SConscript
index dfcf878..6c9b049 100644
--- a/Swift/Controllers/SConscript
+++ b/Swift/Controllers/SConscript
@@ -17,7 +17,9 @@ myenv.StaticLibrary("SwiftControllers", [
"MUCController.cpp",
"EventController.cpp",
"SoundEventController.cpp",
- "SystemTrayController.cpp"
+ "SystemTrayController.cpp",
+ "XMLConsoleController.cpp",
+ "UIEvents/UIEvent.cpp"
])
env.Append(UNITTEST_SOURCES = [
diff --git a/Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h b/Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h
new file mode 100644
index 0000000..63492b3
--- /dev/null
+++ b/Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#include "Swift/Controllers/UIEvents/UIEvent.h"
+
+namespace Swift {
+ class RequestXMLConsoleUIEvent : public UIEvent {
+
+ };
+}
diff --git a/Swift/Controllers/UIEvents/UIEvent.cpp b/Swift/Controllers/UIEvents/UIEvent.cpp
new file mode 100644
index 0000000..7d29a19
--- /dev/null
+++ b/Swift/Controllers/UIEvents/UIEvent.cpp
@@ -0,0 +1,7 @@
+#include "Swift/Controllers/UIEvents/UIEvent.h"
+
+namespace Swift {
+UIEvent::~UIEvent() {
+
+}
+}
diff --git a/Swift/Controllers/UIEvents/UIEvent.h b/Swift/Controllers/UIEvents/UIEvent.h
new file mode 100644
index 0000000..7e06255
--- /dev/null
+++ b/Swift/Controllers/UIEvents/UIEvent.h
@@ -0,0 +1,8 @@
+#pragma once
+
+namespace Swift {
+ class UIEvent {
+ public:
+ virtual ~UIEvent();
+ };
+}
diff --git a/Swift/Controllers/UIEvents/UIEventStream.h b/Swift/Controllers/UIEvents/UIEventStream.h
new file mode 100644
index 0000000..a20c578
--- /dev/null
+++ b/Swift/Controllers/UIEvents/UIEventStream.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#include <boost/signals.hpp>
+#include <boost/shared_ptr.hpp>
+
+
+#include "Swift/Controllers/UIEvents/UIEvent.h"
+
+namespace Swift {
+ class UIEventStream {
+ public:
+ boost::signal<void (boost::shared_ptr<UIEvent>)> onUIEvent;
+ void send(boost::shared_ptr<UIEvent> event) {onUIEvent(event);};
+ };
+}
diff --git a/Swift/Controllers/LoginWindow.h b/Swift/Controllers/UIInterfaces/LoginWindow.h
index cfa20c7..cfa20c7 100644
--- a/Swift/Controllers/LoginWindow.h
+++ b/Swift/Controllers/UIInterfaces/LoginWindow.h
diff --git a/Swift/Controllers/LoginWindowFactory.h b/Swift/Controllers/UIInterfaces/LoginWindowFactory.h
index 79ad5c0..d2dc31b 100644
--- a/Swift/Controllers/LoginWindowFactory.h
+++ b/Swift/Controllers/UIInterfaces/LoginWindowFactory.h
@@ -5,7 +5,8 @@
namespace Swift {
class LoginWindow;
- class String;
+ class String;
+ class UIEventStream;
class LoginWindowFactory {
public:
@@ -14,7 +15,7 @@ namespace Swift {
/**
* Transfers ownership of result.
*/
- virtual LoginWindow* createLoginWindow() = 0;
+ virtual LoginWindow* createLoginWindow(UIEventStream* uiEventStream) = 0;
};
}
diff --git a/Swift/Controllers/UIInterfaces/XMLConsoleWidget.h b/Swift/Controllers/UIInterfaces/XMLConsoleWidget.h
new file mode 100644
index 0000000..69628df
--- /dev/null
+++ b/Swift/Controllers/UIInterfaces/XMLConsoleWidget.h
@@ -0,0 +1,7 @@
+#pragma once
+
+namespace Swift {
+ class XMLConsoleWidget {
+
+ };
+}
diff --git a/Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h b/Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h
new file mode 100644
index 0000000..fa7707a
--- /dev/null
+++ b/Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "Swift/Controllers/UIInterfaces/XMLConsoleWidget.h"
+
+namespace Swift {
+ class UIEventStream;
+ class XMLConsoleWidgetFactory {
+ public:
+ virtual XMLConsoleWidget* createXMLConsoleWidget() = 0;
+ virtual ~XMLConsoleWidgetFactory() {};
+ };
+}
diff --git a/Swift/Controllers/XMLConsoleController.cpp b/Swift/Controllers/XMLConsoleController.cpp
new file mode 100644
index 0000000..8bd79ed
--- /dev/null
+++ b/Swift/Controllers/XMLConsoleController.cpp
@@ -0,0 +1,21 @@
+#include "Swift/Controllers/XMLConsoleController.h"
+
+#include "Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h"
+
+#include "Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h"
+
+namespace Swift {
+XMLConsoleController::XMLConsoleController(UIEventStream* uiEventStream, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory) {
+ uiEventStream_ = uiEventStream;
+ xmlConsoleWidgetFactory_ = xmlConsoleWidgetFactory;
+ uiEventStream_->onUIEvent.connect(boost::bind(&XMLConsoleController::handleUIEvent, this, _1));
+}
+
+void XMLConsoleController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) {
+ boost::shared_ptr<RequestXMLConsoleUIEvent> event = boost::dynamic_pointer_cast<RequestXMLConsoleUIEvent>(rawEvent);
+ if (event != NULL) {
+ xmlConsoleWidget_ = xmlConsoleWidgetFactory_->createXMLConsoleWidget();
+ }
+}
+
+}
diff --git a/Swift/Controllers/XMLConsoleController.h b/Swift/Controllers/XMLConsoleController.h
new file mode 100644
index 0000000..f97e6c1
--- /dev/null
+++ b/Swift/Controllers/XMLConsoleController.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include <boost/signals.hpp>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include "Swift/Controllers/UIEvents/UIEventStream.h"
+
+namespace Swift {
+ class XMLConsoleWidgetFactory;
+ class XMLConsoleWidget;
+ class XMLConsoleController {
+ public:
+ XMLConsoleController(UIEventStream* uiEventStream, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory);
+ private:
+ void handleUIEvent(boost::shared_ptr<UIEvent> event);
+ UIEventStream* uiEventStream_;
+ XMLConsoleWidgetFactory* xmlConsoleWidgetFactory_;
+ XMLConsoleWidget* xmlConsoleWidget_;
+ };
+}
diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp
index c0f1e09..ff927c9 100644
--- a/Swift/QtUI/QtChatWindowFactory.cpp
+++ b/Swift/QtUI/QtChatWindowFactory.cpp
@@ -9,9 +9,9 @@
namespace Swift {
-QtChatWindowFactory::QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory, QSplitter* splitter, QtSettingsProvider* settings) : treeWidgetFactory_(treeWidgetFactory) {
+QtChatWindowFactory::QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory, QSplitter* splitter, QtSettingsProvider* settings, QtChatTabs* tabs) : treeWidgetFactory_(treeWidgetFactory) {
settings_ = settings;
- tabs_ = new QtChatTabs();
+ tabs_ = tabs;
if (splitter) {
splitter->addWidget(tabs_);
} else {
diff --git a/Swift/QtUI/QtChatWindowFactory.h b/Swift/QtUI/QtChatWindowFactory.h
index 4a5a7fb..0c8a092 100644
--- a/Swift/QtUI/QtChatWindowFactory.h
+++ b/Swift/QtUI/QtChatWindowFactory.h
@@ -13,7 +13,7 @@ namespace Swift {
class QtChatWindowFactory : public QObject, public ChatWindowFactory {
Q_OBJECT
public:
- QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory, QSplitter* splitter, QtSettingsProvider* settings);
+ QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory, QSplitter* splitter, QtSettingsProvider* settings, QtChatTabs* tabs);
ChatWindow* createChatWindow(const JID &contact);
private slots:
void handleWindowGeometryChanged();
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index 6466692..2fd27c6 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -1,5 +1,7 @@
#include "QtLoginWindow.h"
+#include "Swift/Controllers/UIEvents/UIEventStream.h"
+#include "Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h"
#include "QtAboutWidget.h"
#include "QtSwiftUtil.h"
#include "QtMainWindow.h"
@@ -20,7 +22,8 @@
namespace Swift{
-QtLoginWindow::QtLoginWindow() : QMainWindow() {
+QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream) : QMainWindow() {
+ uiEventStream_ = uiEventStream;
setWindowTitle("Swift");
resize(200, 500);
setContentsMargins(0,0,0,0);
@@ -104,6 +107,12 @@ QtLoginWindow::QtLoginWindow() : QMainWindow() {
QAction* aboutAction = new QAction("About Swift", this);
connect(aboutAction, SIGNAL(activated()), SLOT(handleAbout()));
swiftMenu_->addAction(aboutAction);
+
+ toolsMenu_ = new QMenu(tr("Tools"), this);
+
+ QAction* xmlConsoleAction = new QAction(tr("Show Debug Console"), this);
+ connect(xmlConsoleAction, SIGNAL(activated()), SLOT(handleShowXMLConsole()));
+ toolsMenu_->addAction(xmlConsoleAction);
QAction* quitAction = new QAction("Quit", this);
connect(quitAction, SIGNAL(activated()), SLOT(handleQuit()));
@@ -210,6 +219,10 @@ void QtLoginWindow::handleAbout() {
}
}
+void QtLoginWindow::handleShowXMLConsole() {
+ uiEventStream_->send(boost::shared_ptr<RequestXMLConsoleUIEvent>(new RequestXMLConsoleUIEvent()));
+}
+
void QtLoginWindow::handleQuit() {
QApplication::quit();
}
@@ -217,6 +230,7 @@ void QtLoginWindow::handleQuit() {
void QtLoginWindow::setInitialMenus() {
menuBar_->clear();
menuBar_->addMenu(swiftMenu_);
+ menuBar_->addMenu(toolsMenu_);
}
void QtLoginWindow::morphInto(MainWindow *mainWindow) {
diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h
index 5abb10a..491521b 100644
--- a/Swift/QtUI/QtLoginWindow.h
+++ b/Swift/QtUI/QtLoginWindow.h
@@ -9,7 +9,7 @@
#include <QStackedWidget>
#include <QMenuBar>
-#include "Swift/Controllers/LoginWindow.h"
+#include "Swift/Controllers/UIInterfaces/LoginWindow.h"
#include "Swift/Controllers/MainWindow.h"
#include "QtAboutWidget.h"
@@ -18,10 +18,11 @@ class QToolButton;
class QComboBox;
namespace Swift {
+ class UIEventStream;
class QtLoginWindow : public QMainWindow, public LoginWindow {
Q_OBJECT
public:
- QtLoginWindow();
+ QtLoginWindow(UIEventStream* uiEventStream);
void morphInto(MainWindow *mainWindow);
virtual void loggedOut();
@@ -36,6 +37,7 @@ namespace Swift {
void loginClicked();
void handleCertficateChecked(bool);
void handleQuit();
+ void handleShowXMLConsole();
void handleAbout();
void bringToFront();
void handleUsernameTextChanged();
@@ -57,6 +59,8 @@ namespace Swift {
QToolButton* certificateButton_;
QMenuBar* menuBar_;
QMenu* swiftMenu_;
+ QMenu* toolsMenu_;
+ UIEventStream* uiEventStream_;
QPointer<QtAboutWidget> aboutDialog_;
};
}
diff --git a/Swift/QtUI/QtLoginWindowFactory.cpp b/Swift/QtUI/QtLoginWindowFactory.cpp
index c395c57..0453d0f 100644
--- a/Swift/QtUI/QtLoginWindowFactory.cpp
+++ b/Swift/QtUI/QtLoginWindowFactory.cpp
@@ -11,8 +11,8 @@ QtLoginWindowFactory::QtLoginWindowFactory(QSplitter* splitter, QtSystemTray* sy
systemTray_ = systemTray;
}
-LoginWindow* QtLoginWindowFactory::createLoginWindow() {
- window_ = new QtLoginWindow();
+LoginWindow* QtLoginWindowFactory::createLoginWindow(UIEventStream* uiEventStream) {
+ window_ = new QtLoginWindow(uiEventStream);
if (splitter_) {
splitter_->insertWidget(0, window_);
return window_;
diff --git a/Swift/QtUI/QtLoginWindowFactory.h b/Swift/QtUI/QtLoginWindowFactory.h
index dd5bc57..5af8b76 100644
--- a/Swift/QtUI/QtLoginWindowFactory.h
+++ b/Swift/QtUI/QtLoginWindowFactory.h
@@ -1,7 +1,7 @@
#ifndef SWIFT_QtLoginWindowFactory_H
#define SWIFT_QtLoginWindowFactory_H
-#include "Swift/Controllers/LoginWindowFactory.h"
+#include "Swift/Controllers/UIInterfaces/LoginWindowFactory.h"
#include "Swift/QtUI/QtSystemTray.h"
#include <QSplitter>
@@ -14,7 +14,7 @@ namespace Swift {
Q_OBJECT
public:
QtLoginWindowFactory(QSplitter* splitter, QtSystemTray* systemTray, QtSettingsProvider* settings);
- LoginWindow* createLoginWindow();
+ LoginWindow* createLoginWindow(UIEventStream* uiEventStream);
private slots:
void handleWindowGeometryChanged();
private:
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 2aaa27e..7e204e9 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -8,6 +8,7 @@
#include "Roster/QtTreeWidgetFactory.h"
#include "QtSystemTray.h"
#include "QtSoundPlayer.h"
+#include "QtXMLConsoleWidgetFactory.h"
#include <boost/bind.hpp>
#include <QSplitter>
@@ -32,18 +33,21 @@ QtSwift::QtSwift(bool netbookMode) {
QCoreApplication::setOrganizationName("Swift");
QCoreApplication::setOrganizationDomain("swift.im");
QCoreApplication::setApplicationVersion(buildVersion);
+
+ tabs_ = new QtChatTabs();
settings_ = new QtSettingsProvider();
application_ = new PlatformApplication("Swift");
treeWidgetFactory_ = new QtTreeWidgetFactory();
systemTray_ = new QtSystemTray();
loginWindowFactory_ = new QtLoginWindowFactory(splitter_, systemTray_, settings_);
- chatWindowFactory_ = new QtChatWindowFactory(treeWidgetFactory_, splitter_, settings_);
+ chatWindowFactory_ = new QtChatWindowFactory(treeWidgetFactory_, splitter_, settings_, tabs_);
rosterWindowFactory_ = new QtMainWindowFactory(treeWidgetFactory_);
+ xmlConsoleWidgetFactory_ = new QtXMLConsoleWidgetFactory(tabs_);
soundPlayer_ = new QtSoundPlayer();
if (splitter_) {
splitter_->show();
}
- mainController_ = new MainController(chatWindowFactory_, rosterWindowFactory_, loginWindowFactory_, treeWidgetFactory_, settings_, application_, systemTray_, soundPlayer_);
+ mainController_ = new MainController(chatWindowFactory_, rosterWindowFactory_, loginWindowFactory_, treeWidgetFactory_, settings_, application_, systemTray_, soundPlayer_, xmlConsoleWidgetFactory_);
}
QtSwift::~QtSwift() {
@@ -57,6 +61,8 @@ QtSwift::~QtSwift() {
delete systemTray_;
delete splitter_;
delete soundPlayer_;
+ delete tabs_;
+ delete xmlConsoleWidgetFactory_;
}
}
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index 263dc05..ad113d6 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -17,9 +17,10 @@ namespace Swift {
class QtMainWindowFactory;
class QtLoginWindowFactory;
class QtTreeWidgetFactory;
+ class QtXMLConsoleWidgetFactory;
class QtSystemTray;
class QtSoundPlayer;
-
+
class QtSwift : public QObject {
Q_OBJECT
public:
@@ -31,11 +32,13 @@ namespace Swift {
QtChatWindowFactory *chatWindowFactory_;
QtMainWindowFactory *rosterWindowFactory_;
QtLoginWindowFactory *loginWindowFactory_;
+ QtXMLConsoleWidgetFactory* xmlConsoleWidgetFactory_;
QtEventLoop clientMainThreadCaller_;
QtSettingsProvider *settings_;
QtSystemTray* systemTray_;
QSplitter* splitter_;
QtSoundPlayer* soundPlayer_;
+ QtChatTabs* tabs_;
Application* application_;
};
}
diff --git a/Swift/QtUI/QtXMLConsole.cpp b/Swift/QtUI/QtXMLConsole.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsole.cpp
diff --git a/Swift/QtUI/QtXMLConsole.h b/Swift/QtUI/QtXMLConsole.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsole.h
diff --git a/Swift/QtUI/QtXMLConsoleWidget.cpp b/Swift/QtUI/QtXMLConsoleWidget.cpp
new file mode 100644
index 0000000..d2ebb06
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsoleWidget.cpp
@@ -0,0 +1,7 @@
+#include "QtXMLConsoleWidget.h"
+
+namespace Swift {
+QtXMLConsoleWidget::QtXMLConsoleWidget() {
+
+}
+}
diff --git a/Swift/QtUI/QtXMLConsoleWidget.h b/Swift/QtUI/QtXMLConsoleWidget.h
new file mode 100644
index 0000000..f545e18
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsoleWidget.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "Swift/Controllers/UIInterfaces/XMLConsoleWidget.h"
+#include "QtTabbable.h"
+
+namespace Swift {
+ class QtXMLConsoleWidget : public QtTabbable, public XMLConsoleWidget {
+ Q_OBJECT
+ public:
+ QtXMLConsoleWidget();
+ };
+}
diff --git a/Swift/QtUI/QtXMLConsoleWidgetFactory.cpp b/Swift/QtUI/QtXMLConsoleWidgetFactory.cpp
new file mode 100644
index 0000000..9e32b0a
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsoleWidgetFactory.cpp
@@ -0,0 +1,22 @@
+#include "QtXMLConsoleWidgetFactory.h"
+
+#include "QtXMLConsoleWidget.h"
+#include "QtChatTabs.h"
+
+namespace Swift {
+
+QtXMLConsoleWidgetFactory::QtXMLConsoleWidgetFactory(QtChatTabs* tabs) {
+ tabs_ = tabs;
+}
+
+XMLConsoleWidget* QtXMLConsoleWidgetFactory::createXMLConsoleWidget() {
+ QtXMLConsoleWidget* widget = new QtXMLConsoleWidget();
+ tabs_->addTab(widget);
+ if (!tabs_->isVisible()) {
+ tabs_->show();
+ }
+ widget->show();
+ return widget;
+}
+
+}
diff --git a/Swift/QtUI/QtXMLConsoleWidgetFactory.h b/Swift/QtUI/QtXMLConsoleWidgetFactory.h
new file mode 100644
index 0000000..5158949
--- /dev/null
+++ b/Swift/QtUI/QtXMLConsoleWidgetFactory.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h"
+
+#include "QtXMLConsoleWidget.h"
+
+namespace Swift {
+ class QtChatTabs;
+ class QtXMLConsoleWidgetFactory : public XMLConsoleWidgetFactory {
+ public:
+ QtXMLConsoleWidgetFactory(QtChatTabs* tabs);
+ XMLConsoleWidget* createXMLConsoleWidget();
+ private:
+ QtChatTabs* tabs_;
+ };
+}
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 42cf07a..b70832a 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -68,6 +68,8 @@ sources = [
"QtSystemTray.cpp",
"QtTabbable.cpp",
"QtTextEdit.cpp",
+ "QtXMLConsoleWidgetFactory.cpp",
+ "QtXMLConsoleWidget.cpp",
"ChatSnippet.cpp",
"MessageSnippet.cpp",
"SystemMessageSnippet.cpp",