diff options
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/MainController.cpp | 30 | ||||
-rw-r--r-- | Swift/Controllers/MainController.h | 24 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/ChatListWindowFactory.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindowFactory.cpp | 22 | ||||
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindowFactory.h | 20 | ||||
-rw-r--r-- | Swift/QtUI/EventViewer/QtEventWindowFactory.cpp | 22 | ||||
-rw-r--r-- | Swift/QtUI/EventViewer/QtEventWindowFactory.h | 22 | ||||
-rw-r--r-- | Swift/QtUI/MUCSearch/QtMUCSearchWindowFactory.h | 22 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindowFactory.cpp | 39 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindowFactory.h | 34 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindowFactory.cpp | 27 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindowFactory.h | 24 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 55 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.h | 21 | ||||
-rw-r--r-- | Swift/QtUI/QtXMLConsoleWidgetFactory.cpp | 28 | ||||
-rw-r--r-- | Swift/QtUI/QtXMLConsoleWidgetFactory.h | 22 | ||||
-rw-r--r-- | Swift/QtUI/SConscript | 8 |
18 files changed, 32 insertions, 392 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 6bd7597..814d87d 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -42,7 +42,7 @@ ChatsManager::ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRo mucBookmarkManager_ = NULL; presenceOracle_->onPresenceChange.connect(boost::bind(&ChatsManager::handlePresenceChange, this, _1)); uiEventConnection_ = uiEventStream_->onUIEvent.connect(boost::bind(&ChatsManager::handleUIEvent, this, _1)); - chatListWindow_ = chatListWindowFactory->createWindow(uiEventStream_); + chatListWindow_ = chatListWindowFactory->createChatListWindow(uiEventStream_); setupBookmarks(); } diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index de7009c..c965c1c 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -4,13 +4,14 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swift/Controllers/MainController.h" +#include <Swift/Controllers/MainController.h> #include <boost/bind.hpp> #include <boost/lexical_cast.hpp> #include <boost/shared_ptr.hpp> #include <stdlib.h> +#include <Swift/Controllers/UIInterfaces/UIFactory.h> #include "Swiften/Network/TimerFactory.h" #include "Swift/Controllers/BuildVersion.h" #include "Swift/Controllers/StoragesFactory.h" @@ -69,16 +70,10 @@ static const String SHOW_NOTIFICATIONS = "showNotifications"; MainController::MainController( EventLoop* eventLoop, NetworkFactories* networkFactories, - ChatWindowFactory* chatWindowFactory, - MainWindowFactory *mainWindowFactory, - LoginWindowFactory *loginWindowFactory, - EventWindowFactory* eventWindowFactory, + UIFactory* uiFactories, SettingsProvider *settings, SystemTray* systemTray, SoundPlayer* soundPlayer, - XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, - ChatListWindowFactory* chatListWindowFactory, - MUCSearchWindowFactory* mucSearchWindowFactory, StoragesFactory* storagesFactory, CertificateStorageFactory* certificateStorageFactory, Dock* dock, @@ -86,12 +81,10 @@ MainController::MainController( bool useDelayForLatency) : eventLoop_(eventLoop), networkFactories_(networkFactories), + uiFactory_(uiFactories), idleDetector_(&idleQuerier_, networkFactories_->getTimerFactory(), 100), storagesFactory_(storagesFactory), certificateStorageFactory_(certificateStorageFactory), - chatWindowFactory_(chatWindowFactory), - mainWindowFactory_(mainWindowFactory), - loginWindowFactory_(loginWindowFactory), settings_(settings), loginWindow_(NULL) , useDelayForLatency_(useDelayForLatency) { @@ -108,10 +101,7 @@ MainController::MainController( quitRequested_ = false; timeBeforeNextReconnect_ = -1; - mucSearchWindowFactory_ = mucSearchWindowFactory; - eventWindowFactory_ = eventWindowFactory; dock_ = dock; - chatListWindowFactory_ = chatListWindowFactory; uiEventStream_ = new UIEventStream(); notifier_ = new TogglableNotifier(notifier); @@ -119,7 +109,7 @@ MainController::MainController( eventController_->onEventQueueLengthChange.connect(boost::bind(&MainController::handleEventQueueLengthChange, this, _1)); systemTrayController_ = new SystemTrayController(eventController_, systemTray); - loginWindow_ = loginWindowFactory_->createLoginWindow(uiEventStream_); + loginWindow_ = uiFactory_->createLoginWindow(uiEventStream_); soundEventController_ = new SoundEventController(eventController_, soundPlayer, settings, uiEventStream_); String selectedLoginJID = settings_->getStringSetting("lastLoginJID"); @@ -147,7 +137,7 @@ MainController::MainController( idleDetector_.setIdleTimeSeconds(600); idleDetector_.onIdleChanged.connect(boost::bind(&MainController::handleInputIdleChanged, this, _1)); - xmlConsoleController_ = new XMLConsoleController(uiEventStream_, xmlConsoleWidgetFactory); + xmlConsoleController_ = new XMLConsoleController(uiEventStream_, uiFactory_); uiEventStream_->onUIEvent.connect(boost::bind(&MainController::handleUIEvent, this, _1)); bool enabled = settings_->getBoolSetting(SHOW_NOTIFICATIONS, true); @@ -232,15 +222,15 @@ void MainController::handleConnected() { bool freshLogin = rosterController_ == NULL; myStatusLooksOnline_ = true; if (freshLogin) { - rosterController_ = new RosterController(jid_, client_->getRoster(), client_->getAvatarManager(), mainWindowFactory_, client_->getNickManager(), client_->getNickResolver(), client_->getPresenceOracle(), client_->getSubscriptionManager(), eventController_, uiEventStream_, client_->getIQRouter(), settings_); + rosterController_ = new RosterController(jid_, client_->getRoster(), client_->getAvatarManager(), uiFactory_, client_->getNickManager(), client_->getNickResolver(), client_->getPresenceOracle(), client_->getSubscriptionManager(), eventController_, uiEventStream_, client_->getIQRouter(), settings_); rosterController_->onChangeStatusRequest.connect(boost::bind(&MainController::handleChangeStatusRequest, this, _1, _2)); rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this)); - chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, chatWindowFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, chatListWindowFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager()); + chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager()); client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1)); chatsManager_->setAvatarManager(client_->getAvatarManager()); - eventWindowController_ = new EventWindowController(eventController_, eventWindowFactory_); + eventWindowController_ = new EventWindowController(eventController_, uiFactory_); loginWindow_->morphInto(rosterController_->getWindow()); @@ -251,7 +241,7 @@ void MainController::handleConnected() { client_->getDiscoManager()->setCapsNode(CLIENT_NODE); client_->getDiscoManager()->setDiscoInfo(discoInfo); - mucSearchController_ = new MUCSearchController(jid_, uiEventStream_, mucSearchWindowFactory_, client_->getIQRouter(), settings_); + mucSearchController_ = new MUCSearchController(jid_, uiEventStream_, uiFactory_, client_->getIQRouter(), settings_); } client_->requestRoster(); diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index 0427307..2f101a5 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -6,7 +6,7 @@ #pragma once -#include "Swiften/Base/boost_bsignals.h" +#include <Swiften/Base/boost_bsignals.h> #include <boost/shared_ptr.hpp> #include <vector> @@ -27,22 +27,19 @@ #include "Swift/Controllers/UIEvents/UIEvent.h" namespace Swift { + class UIFactory; class EventLoop; class Client; - class ChatWindowFactory; class ChatController; class ChatsManager; class CertificateStorageFactory; class CertificateStorage; class CertificateStorageTrustChecker; - class ChatListWindowFactory; class EventController; - class MainWindowFactory; class MainWindow; class RosterController; class LoginWindow; class EventLoop; - class LoginWindowFactory; class MUCController; class Notifier; class TogglableNotifier; @@ -54,11 +51,9 @@ namespace Swift { class SoundPlayer; class XMLConsoleController; class UIEventStream; - class XMLConsoleWidgetFactory; class EventWindowFactory; class EventWindowController; class MUCSearchController; - class MUCSearchWindowFactory; class StatusTracker; class Dock; class Storages; @@ -70,16 +65,10 @@ namespace Swift { MainController( EventLoop* eventLoop, NetworkFactories* networkFactories, - ChatWindowFactory* chatWindowFactory, - MainWindowFactory *mainWindowFactory, - LoginWindowFactory *loginWindowFactory, - EventWindowFactory* eventWindowFactory, + UIFactory* uiFactories, SettingsProvider *settings, SystemTray* systemTray, SoundPlayer* soundPlayer, - XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, - ChatListWindowFactory* chatListWindowFactory_, - MUCSearchWindowFactory* mucSearchWindowFactory, StoragesFactory* storagesFactory, CertificateStorageFactory* certificateStorageFactory, Dock* dock, @@ -116,6 +105,7 @@ namespace Swift { private: EventLoop* eventLoop_; NetworkFactories* networkFactories_; + UIFactory* uiFactory_; PlatformIdleQuerier idleQuerier_; ActualIdleDetector idleDetector_; StoragesFactory* storagesFactory_; @@ -124,10 +114,6 @@ namespace Swift { CertificateStorage* certificateStorage_; CertificateStorageTrustChecker* certificateTrustChecker_; Client* client_; - ChatWindowFactory* chatWindowFactory_; - MainWindowFactory* mainWindowFactory_; - LoginWindowFactory* loginWindowFactory_; - EventWindowFactory* eventWindowFactory_; SettingsProvider *settings_; ProfileSettingsProvider* profileSettings_; Dock* dock_; @@ -148,11 +134,9 @@ namespace Swift { String vCardPhotoHash_; String password_; String certificateFile_; - ChatListWindowFactory* chatListWindowFactory_; boost::shared_ptr<ErrorEvent> lastDisconnectError_; bool useDelayForLatency_; MUCSearchController* mucSearchController_; - MUCSearchWindowFactory* mucSearchWindowFactory_; int timeBeforeNextReconnect_; Timer::ref reconnectTimer_; StatusTracker* statusTracker_; diff --git a/Swift/Controllers/UIInterfaces/ChatListWindowFactory.h b/Swift/Controllers/UIInterfaces/ChatListWindowFactory.h index b920e43..cf8409e 100644 --- a/Swift/Controllers/UIInterfaces/ChatListWindowFactory.h +++ b/Swift/Controllers/UIInterfaces/ChatListWindowFactory.h @@ -13,6 +13,6 @@ namespace Swift { class ChatListWindowFactory { public: virtual ~ChatListWindowFactory() {} - virtual ChatListWindow* createWindow(UIEventStream* uiEventStream) = 0; + virtual ChatListWindow* createChatListWindow(UIEventStream* uiEventStream) = 0; }; } diff --git a/Swift/QtUI/ChatList/QtChatListWindowFactory.cpp b/Swift/QtUI/ChatList/QtChatListWindowFactory.cpp deleted file mode 100644 index 0e9d324..0000000 --- a/Swift/QtUI/ChatList/QtChatListWindowFactory.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2010 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include "Swift/QtUI/ChatList/QtChatListWindowFactory.h" - -#include "Swift/QtUI/QtMainWindowFactory.h" -#include "Swift/QtUI/QtMainWindow.h" - -namespace Swift { - -QtChatListWindowFactory::QtChatListWindowFactory(QtMainWindowFactory* mainWindowFactory) { - mainWindowFactory_ = mainWindowFactory; -} - -ChatListWindow* QtChatListWindowFactory::createWindow(UIEventStream* /*uiEventStream*/) { - return static_cast<QtMainWindow*>(mainWindowFactory_->getLastCreatedWindow())->getChatListWindow(); -} - -} diff --git a/Swift/QtUI/ChatList/QtChatListWindowFactory.h b/Swift/QtUI/ChatList/QtChatListWindowFactory.h deleted file mode 100644 index 604ce2e..0000000 --- a/Swift/QtUI/ChatList/QtChatListWindowFactory.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2010 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include "Swift/Controllers/UIInterfaces/ChatListWindowFactory.h" - -namespace Swift { - class QtMainWindowFactory; - class QtChatListWindowFactory : public ChatListWindowFactory{ - public: - QtChatListWindowFactory(QtMainWindowFactory* mainWindowFactory); - ChatListWindow* createWindow(UIEventStream* uiEventStream); - private: - QtMainWindowFactory* mainWindowFactory_; - }; -} diff --git a/Swift/QtUI/EventViewer/QtEventWindowFactory.cpp b/Swift/QtUI/EventViewer/QtEventWindowFactory.cpp deleted file mode 100644 index 45f6da0..0000000 --- a/Swift/QtUI/EventViewer/QtEventWindowFactory.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2010 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include "Swift/QtUI/EventViewer/QtEventWindowFactory.h" - -#include "Swift/QtUI/QtMainWindowFactory.h" -#include "Swift/QtUI/QtMainWindow.h" - -namespace Swift { - -QtEventWindowFactory::QtEventWindowFactory(QtMainWindowFactory* mainWindowFactory) { - mainWindowFactory_ = mainWindowFactory; -} - -EventWindow* QtEventWindowFactory::createEventWindow() { - return static_cast<QtMainWindow*>(mainWindowFactory_->getLastCreatedWindow())->getEventWindow(); -} - -} diff --git a/Swift/QtUI/EventViewer/QtEventWindowFactory.h b/Swift/QtUI/EventViewer/QtEventWindowFactory.h deleted file mode 100644 index af64a58..0000000 --- a/Swift/QtUI/EventViewer/QtEventWindowFactory.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2010 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include "Swift/Controllers/UIInterfaces/EventWindowFactory.h" - -namespace Swift { - class QtMainWindowFactory; - class QtEventWindowFactory : public EventWindowFactory { - public: - QtEventWindowFactory(QtMainWindowFactory* mainWindowFactory); - virtual EventWindow* createEventWindow(); - private: - QtMainWindowFactory* mainWindowFactory_; - }; -} - - diff --git a/Swift/QtUI/MUCSearch/QtMUCSearchWindowFactory.h b/Swift/QtUI/MUCSearch/QtMUCSearchWindowFactory.h deleted file mode 100644 index 9bcb53f..0000000 --- a/Swift/QtUI/MUCSearch/QtMUCSearchWindowFactory.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2010 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include "Swift/Controllers/UIInterfaces/MUCSearchWindowFactory.h" -#include "Swift/QtUI/MUCSearch/QtMUCSearchWindow.h" - -namespace Swift { - class UIEventStream; - class QtMUCSearchWindowFactory : public MUCSearchWindowFactory { - public: - virtual ~QtMUCSearchWindowFactory() {}; - - MUCSearchWindow* createMUCSearchWindow(UIEventStream* eventStream) { - return new QtMUCSearchWindow(eventStream); - }; - }; -} diff --git a/Swift/QtUI/QtLoginWindowFactory.cpp b/Swift/QtUI/QtLoginWindowFactory.cpp deleted file mode 100644 index 2ac3dec..0000000 --- a/Swift/QtUI/QtLoginWindowFactory.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2010 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include "QtLoginWindowFactory.h" -#include "QtLoginWindow.h" - -#include <QDesktopWidget> - -namespace Swift { - -QtLoginWindowFactory::QtLoginWindowFactory(QSplitter* splitter, QtSystemTray* systemTray, QtSettingsProvider* settings) : QObject() { - settings_ = settings; - splitter_ = splitter; - systemTray_ = systemTray; -} - -LoginWindow* QtLoginWindowFactory::createLoginWindow(UIEventStream* uiEventStream) { - window_ = new QtLoginWindow(uiEventStream); - if (splitter_) { - splitter_->insertWidget(0, window_); - //return window_; - } - connect(systemTray_, SIGNAL(clicked()), window_, SLOT(bringToFront())); - QVariant loginWindowGeometryVariant = settings_->getQSettings()->value("loginWindowGeometry"); - if (loginWindowGeometryVariant.isValid()) { - window_->restoreGeometry(loginWindowGeometryVariant.toByteArray()); - } - connect(window_, SIGNAL(geometryChanged()), this, SLOT(handleWindowGeometryChanged())); - return window_; -} - -void QtLoginWindowFactory::handleWindowGeometryChanged() { - settings_->getQSettings()->setValue("loginWindowGeometry", window_->saveGeometry()); -} - -} diff --git a/Swift/QtUI/QtLoginWindowFactory.h b/Swift/QtUI/QtLoginWindowFactory.h deleted file mode 100644 index 0a90e05..0000000 --- a/Swift/QtUI/QtLoginWindowFactory.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2010 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#ifndef SWIFT_QtLoginWindowFactory_H -#define SWIFT_QtLoginWindowFactory_H - -#include "Swift/Controllers/UIInterfaces/LoginWindowFactory.h" -#include "Swift/QtUI/QtSystemTray.h" - -#include <QSplitter> - -#include "QtSettingsProvider.h" - -namespace Swift { - class QtLoginWindow; - class QtLoginWindowFactory : public QObject, public LoginWindowFactory { - Q_OBJECT - public: - QtLoginWindowFactory(QSplitter* splitter, QtSystemTray* systemTray, QtSettingsProvider* settings); - LoginWindow* createLoginWindow(UIEventStream* uiEventStream); - private slots: - void handleWindowGeometryChanged(); - private: - QSplitter* splitter_; - QtSystemTray* systemTray_; - QtSettingsProvider* settings_; - QtLoginWindow* window_; - }; -} - -#endif diff --git a/Swift/QtUI/QtMainWindowFactory.cpp b/Swift/QtUI/QtMainWindowFactory.cpp deleted file mode 100644 index 8833e03..0000000 --- a/Swift/QtUI/QtMainWindowFactory.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2010 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include "QtMainWindowFactory.h" -#include "QtMainWindow.h" - -namespace Swift { - -QtMainWindowFactory::QtMainWindowFactory(QtSettingsProvider* settings) { - settings_ = settings; - lastWindow_ = NULL; -} - -MainWindow* QtMainWindowFactory::createMainWindow(UIEventStream* eventStream) { - lastWindow_ = new QtMainWindow(settings_, eventStream); - return lastWindow_; -} - -MainWindow* QtMainWindowFactory::getLastCreatedWindow() { - assert(lastWindow_); - return lastWindow_;; -} - -} diff --git a/Swift/QtUI/QtMainWindowFactory.h b/Swift/QtUI/QtMainWindowFactory.h deleted file mode 100644 index c6658a9..0000000 --- a/Swift/QtUI/QtMainWindowFactory.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2010 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include "Swift/Controllers/UIInterfaces/MainWindowFactory.h" - -namespace Swift { - class QtTreeWidgetFactory; - class QtSettingsProvider; - - class QtMainWindowFactory : public MainWindowFactory{ - public: - QtMainWindowFactory(QtSettingsProvider* settings); - MainWindow* createMainWindow(UIEventStream* eventStream); - MainWindow* getLastCreatedWindow(); - private: - QtSettingsProvider* settings_; - MainWindow* lastWindow_; - }; -} diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 65eb534..9a1788f 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -7,22 +7,16 @@ #include "QtSwift.h" #include <string> +#include <QSplitter> +#include <boost/bind.hpp> -#include "QtLoginWindowFactory.h" -#include "QtChatWindowFactory.h" #include "QtLoginWindow.h" #include "QtChatTabs.h" -#include "QtMainWindowFactory.h" #include "QtSystemTray.h" #include "QtSoundPlayer.h" #include "QtSwiftUtil.h" -#include "QtXMLConsoleWidgetFactory.h" -#include "ChatList/QtChatListWindowFactory.h" -#include "EventViewer/QtEventWindowFactory.h" -#include "MUCSearch/QtMUCSearchWindowFactory.h" -#include <boost/bind.hpp> -#include <QSplitter> - +#include "QtUIFactory.h" +#include "QtChatWindowFactory.h" #include <Swiften/Base/Log.h> #include <Swift/Controllers/CertificateFileStorageFactory.h> #include "SwifTools/Application/PlatformApplicationPathProvider.h" @@ -129,31 +123,15 @@ QtSwift::QtSwift(po::variables_map options) : networkFactories_(&clientMainThrea for (int i = 0; i < numberOfAccounts; i++) { QtSystemTray* systemTray = new QtSystemTray(); systemTrays_.push_back(systemTray); - QtLoginWindowFactory* loginWindowFactory = new QtLoginWindowFactory(splitter_, systemTray, settings_); - loginWindowFactories_.push_back(loginWindowFactory); - QtMainWindowFactory* rosterWindowFactory = new QtMainWindowFactory(settings_); - rosterWindowFactories_.push_back(rosterWindowFactory); - QtEventWindowFactory* eventWindowFactory = new QtEventWindowFactory(rosterWindowFactory); - eventWindowFactories_.push_back(eventWindowFactory); - QtXMLConsoleWidgetFactory* xmlConsoleWidgetFactory = new QtXMLConsoleWidgetFactory(tabs_); - xmlConsoleWidgetFactories_.push_back(xmlConsoleWidgetFactory); - QtChatListWindowFactory* chatListWindowFactory = new QtChatListWindowFactory(rosterWindowFactory); - chatListWindowFactories_.push_back(chatListWindowFactory); - QtMUCSearchWindowFactory* mucSearchWindowFactory = new QtMUCSearchWindowFactory(); - mucSearchWindowFactories_.push_back(mucSearchWindowFactory); + QtUIFactory* uiFactory = new QtUIFactory(settings_, tabs_, splitter_, systemTray, chatWindowFactory_); + uiFactories_.push_back(uiFactory); MainController* mainController = new MainController( &clientMainThreadCaller_, &networkFactories_, - chatWindowFactory_, - rosterWindowFactory, - loginWindowFactory, - eventWindowFactory, + uiFactory, settings_, systemTray, soundPlayer_, - xmlConsoleWidgetFactory, - chatListWindowFactory, - mucSearchWindowFactory, storagesFactory_, certificateStorageFactory_, dock_, @@ -173,14 +151,7 @@ QtSwift::QtSwift(po::variables_map options) : networkFactories_(&clientMainThrea QtSwift::~QtSwift() { delete notifier_; delete autoUpdater_; - delete chatWindowFactory_; - foreach (QtMainWindowFactory* factory, rosterWindowFactories_) { - delete factory; - } - foreach (QtLoginWindowFactory* factory, loginWindowFactories_) { - delete factory; - } - foreach (MUCSearchWindowFactory* factory, mucSearchWindowFactories_) { + foreach (QtUIFactory* factory, uiFactories_) { delete factory; } foreach (MainController* controller, mainControllers_) { @@ -194,15 +165,7 @@ QtSwift::~QtSwift() { delete splitter_; delete dock_; delete soundPlayer_; - foreach (QtXMLConsoleWidgetFactory* factory, xmlConsoleWidgetFactories_) { - delete factory; - } - foreach (QtEventWindowFactory* factory, eventWindowFactories_) { - delete factory; - } - foreach (QtChatListWindowFactory* factory, chatListWindowFactories_) { - delete factory; - } + delete chatWindowFactory_; delete certificateStorageFactory_; delete storagesFactory_; } diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h index 68933dd..f241fd0 100644 --- a/Swift/QtUI/QtSwift.h +++ b/Swift/QtUI/QtSwift.h @@ -14,9 +14,6 @@ #include "Swiften/Base/String.h" #include "Swiften/Base/Platform.h" #include "Swiften/EventLoop/Qt/QtEventLoop.h" -#include "QtLoginWindowFactory.h" -#include "QtMainWindowFactory.h" -#include "QtChatWindowFactory.h" #include "QtSettingsProvider.h" #if defined(SWIFTEN_PLATFORM_MACOSX) #include "SwifTools/Application/CocoaApplication.h" @@ -30,6 +27,7 @@ namespace po = boost::program_options; class QSplitter; namespace Swift { + class QtUIFactory; class CertificateStorageFactory; class Dock; class Notifier; @@ -39,14 +37,10 @@ namespace Swift { class AvatarStorage; class CapsStorage; class MainController; - class QtChatWindowFactory; - class QtMainWindowFactory; - class QtLoginWindowFactory; - class QtXMLConsoleWidgetFactory; class QtSystemTray; + class QtChatTabs; + class QtChatWindowFactory; class QtSoundPlayer; - class QtEventWindowFactory; - class QtChatListWindowFactory; class QtMUCSearchWindowFactory; class EventLoop; @@ -60,15 +54,10 @@ namespace Swift { QtEventLoop clientMainThreadCaller_; PlatformTLSFactories tlsFactories_; BoostNetworkFactories networkFactories_; + QtChatWindowFactory* chatWindowFactory_; std::vector<MainController*> mainControllers_; - QtChatWindowFactory *chatWindowFactory_; - std::vector<QtMainWindowFactory*> rosterWindowFactories_; - std::vector<QtLoginWindowFactory*> loginWindowFactories_; - std::vector<QtXMLConsoleWidgetFactory*> xmlConsoleWidgetFactories_; - std::vector<QtEventWindowFactory*> eventWindowFactories_; std::vector<QtSystemTray*> systemTrays_; - std::vector<QtChatListWindowFactory*> chatListWindowFactories_; - std::vector<QtMUCSearchWindowFactory*> mucSearchWindowFactories_; + std::vector<QtUIFactory*> uiFactories_; QtSettingsProvider *settings_; QSplitter* splitter_; QtSoundPlayer* soundPlayer_; diff --git a/Swift/QtUI/QtXMLConsoleWidgetFactory.cpp b/Swift/QtUI/QtXMLConsoleWidgetFactory.cpp deleted file mode 100644 index e3f9e0a..0000000 --- a/Swift/QtUI/QtXMLConsoleWidgetFactory.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#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 deleted file mode 100644 index b54c4b2..0000000 --- a/Swift/QtUI/QtXMLConsoleWidgetFactory.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#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 864fdb5..377b949 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -63,12 +63,11 @@ sources = [ "main.cpp", "QtAboutWidget.cpp", "QtAddContactDialog.cpp", - "QtChatWindow.cpp", + "QtUIFactory.cpp", "QtChatWindowFactory.cpp", + "QtChatWindow.cpp", "QtLoginWindow.cpp", - "QtLoginWindowFactory.cpp", "QtMainWindow.cpp", - "QtMainWindowFactory.cpp", "QtNameWidget.cpp", "QtSettingsProvider.cpp", "QtStatusWidget.cpp", @@ -82,7 +81,6 @@ sources = [ "QtTabbable.cpp", "QtTabWidget.cpp", "QtTextEdit.cpp", - "QtXMLConsoleWidgetFactory.cpp", "QtXMLConsoleWidget.cpp", "QtUtilities.cpp", "QtBookmarkDetailWindow.cpp", @@ -103,11 +101,9 @@ sources = [ "EventViewer/EventModel.cpp", "EventViewer/EventDelegate.cpp", "EventViewer/TwoLineDelegate.cpp", - "EventViewer/QtEventWindowFactory.cpp", "EventViewer/QtEventWindow.cpp", "EventViewer/QtEvent.cpp", "ChatList/QtChatListWindow.cpp", - "ChatList/QtChatListWindowFactory.cpp", "ChatList/ChatListModel.cpp", "ChatList/ChatListDelegate.cpp", "ChatList/ChatListMUCItem.cpp", |