diff options
Diffstat (limited to 'Swift/QtUI')
-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 |
14 files changed, 16 insertions, 350 deletions
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", |