summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/MainController.cpp8
-rw-r--r--Swift/Controllers/MainController.h5
-rw-r--r--Swift/QtUI/QtSwift.cpp10
-rw-r--r--Swift/QtUI/QtSwift.h4
4 files changed, 18 insertions, 9 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 22e78fe..f010c49 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -64,9 +64,8 @@ static const String CLIENT_VERSION = "1.0-devel";
static const String CLIENT_NODE = "http://swift.im";
-MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory, MUCSearchWindowFactory* mucSearchWindowFactory, bool useDelayForLatency)
+MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorage* avatarStorage, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency)
: timerFactory_(&boostIOServiceThread_.getIOService()), idleDetector_(&idleQuerier_, &timerFactory_, 100), chatWindowFactory_(chatWindowFactory), mainWindowFactory_(mainWindowFactory), loginWindowFactory_(loginWindowFactory), settings_(settings), loginWindow_(NULL), useDelayForLatency_(useDelayForLatency) {
- application_ = application;
presenceOracle_ = NULL;
avatarManager_ = NULL;
chatsManager_ = NULL;
@@ -86,10 +85,11 @@ MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowF
timeBeforeNextReconnect_ = -1;
mucSearchWindowFactory_ = mucSearchWindowFactory;
eventWindowFactory_ = eventWindowFactory;
+ applicationMessageDisplay_ = applicationMessageDisplay;
chatListWindowFactory_ = chatListWindowFactory;
uiEventStream_ = new UIEventStream();
- avatarStorage_ = new AvatarFileStorage(application_->getAvatarDir());
+ avatarStorage_ = avatarStorage;
eventController_ = new EventController();
eventController_->onEventQueueLengthChange.connect(boost::bind(&MainController::handleEventQueueLengthChange, this, _1));
@@ -249,7 +249,7 @@ void MainController::handleConnected() {
}
void MainController::handleEventQueueLengthChange(int count) {
- application_->getApplicationMessageDisplay()->setMessage(count == 0 ? "" : boost::lexical_cast<std::string>(count).c_str());
+ applicationMessageDisplay_->setMessage(count == 0 ? "" : boost::lexical_cast<std::string>(count).c_str());
}
void MainController::reconnectAfterError() {
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index f17bc9b..2bda61a 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -42,6 +42,7 @@ namespace Swift {
class XMPPRosterController;
class PresenceSender;
class DiscoInfoResponder;
+ class ApplicationMessageDisplay;
class AvatarManager;
class LoginWindow;
class EventLoop;
@@ -64,7 +65,7 @@ namespace Swift {
class MainController {
public:
- MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory_, MUCSearchWindowFactory* mucSearchWindowFactory, bool useDelayForLatency);
+ MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory_, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorage* avatarStorage, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency);
~MainController();
@@ -101,8 +102,8 @@ namespace Swift {
LoginWindowFactory* loginWindowFactory_;
EventWindowFactory* eventWindowFactory_;
SettingsProvider *settings_;
- Application* application_;
AvatarStorage* avatarStorage_;
+ ApplicationMessageDisplay* applicationMessageDisplay_;
ChatController* chatController_;
XMPPRosterController* xmppRosterController_;
RosterController* rosterController_;
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 57b4edf..84ae3a1 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -21,7 +21,9 @@
#include <QSplitter>
#include "Swiften/Application/Application.h"
-#include "Swiften/Application/Platform/PlatformApplication.h"
+#include "Swiften/Application/PlatformApplication.h"
+#include "Swiften/Application/PlatformApplicationPathProvider.h"
+#include "Swiften/Avatars/AvatarFileStorage.h"
#include "Swiften/Base/String.h"
#include "Swiften/Base/Platform.h"
#include "Swiften/Elements/Presence.h"
@@ -66,9 +68,11 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) {
int numberOfAccounts = options["multi-account"].as<int>();
- tabs_ = options.count("no-tabs") && !splitter_ > 0 ? NULL : new QtChatTabs();
+ tabs_ = options.count("no-tabs") && !(splitter_ > 0) ? NULL : new QtChatTabs();
settings_ = new QtSettingsProvider();
application_ = new PlatformApplication(SWIFT_APPLICATION_NAME);
+ applicationPathProvider_ = new PlatformApplicationPathProvider(SWIFT_APPLICATION_NAME);
+ avatarStorage_ = new AvatarFileStorage(applicationPathProvider_->getAvatarDir());
chatWindowFactory_ = new QtChatWindowFactory(splitter_, settings_, tabs_);
soundPlayer_ = new QtSoundPlayer();
if (splitter_) {
@@ -90,7 +94,7 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) {
chatListWindowFactories_.push_back(chatListWindowFactory);
QtMUCSearchWindowFactory* mucSearchWindowFactory = new QtMUCSearchWindowFactory();
mucSearchWindowFactories_.push_back(mucSearchWindowFactory);
- MainController* mainController = new MainController(chatWindowFactory_, rosterWindowFactory, loginWindowFactory, eventWindowFactory, settings_, application_, systemTray, soundPlayer_, xmlConsoleWidgetFactory, chatListWindowFactory, mucSearchWindowFactory, options.count("latency-debug") > 0);
+ MainController* mainController = new MainController(chatWindowFactory_, rosterWindowFactory, loginWindowFactory, eventWindowFactory, settings_, application_, systemTray, soundPlayer_, xmlConsoleWidgetFactory, chatListWindowFactory, mucSearchWindowFactory, avatarStorage_, application_->getApplicationMessageDisplay(), options.count("latency-debug") > 0);
mainControllers_.push_back(mainController);
}
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index 567af32..d205f9f 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -24,6 +24,8 @@ class QSplitter;
namespace Swift {
class AutoUpdater;
class Application;
+ class ApplicationPathProvider;
+ class AvatarStorage;
class MainController;
class QtChatWindowFactory;
class QtMainWindowFactory;
@@ -57,6 +59,8 @@ namespace Swift {
QtSoundPlayer* soundPlayer_;
QtChatTabs* tabs_;
Application* application_;
+ ApplicationPathProvider* applicationPathProvider_;
+ AvatarStorage* avatarStorage_;
AutoUpdater* autoUpdater_;
};