summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-07-11 11:37:43 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-07-11 11:37:43 (GMT)
commit127355ccda505bbfcfa93d1f1304e6027c55516c (patch)
tree6236bcc102cdffd7cf88d639ef4daeae618dfd64 /Swift
parent1a88be2c3755de25464e403049a95ddd7fca327c (diff)
downloadswift-contrib-127355ccda505bbfcfa93d1f1304e6027c55516c.zip
swift-contrib-127355ccda505bbfcfa93d1f1304e6027c55516c.tar.bz2
Make IdleDetector a parameter of MainController.
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/MainController.cpp10
-rw-r--r--Swift/Controllers/MainController.h7
-rw-r--r--Swift/QtUI/QtSwift.cpp3
-rw-r--r--Swift/QtUI/QtSwift.h4
4 files changed, 16 insertions, 8 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 58b2dbe..92bec85 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -67,6 +67,7 @@
#include <Swift/Controllers/ContactEditController.h>
#include <Swift/Controllers/XMPPURIController.h>
#include "Swift/Controllers/AdHocManager.h"
+#include <SwifTools/Idle/IdleDetector.h>
namespace Swift {
@@ -87,16 +88,17 @@ MainController::MainController(
Dock* dock,
Notifier* notifier,
URIHandler* uriHandler,
+ IdleDetector* idleDetector,
bool useDelayForLatency,
bool eagleMode) :
eventLoop_(eventLoop),
networkFactories_(networkFactories),
uiFactory_(uiFactories),
- idleDetector_(&idleQuerier_, networkFactories_->getTimerFactory(), 1000),
storagesFactory_(storagesFactory),
certificateStorageFactory_(certificateStorageFactory),
settings_(settings),
uriHandler_(uriHandler),
+ idleDetector_(idleDetector),
loginWindow_(NULL) ,
useDelayForLatency_(useDelayForLatency),
eagleMode_(eagleMode) {
@@ -157,8 +159,8 @@ MainController::MainController(
loginWindow_->onCancelLoginRequest.connect(boost::bind(&MainController::handleCancelLoginRequest, this));
loginWindow_->onQuitRequest.connect(boost::bind(&MainController::handleQuitRequest, this));
- idleDetector_.setIdleTimeSeconds(600);
- idleDetector_.onIdleChanged.connect(boost::bind(&MainController::handleInputIdleChanged, this, _1));
+ idleDetector_->setIdleTimeSeconds(600);
+ idleDetector_->onIdleChanged.connect(boost::bind(&MainController::handleInputIdleChanged, this, _1));
xmlConsoleController_ = new XMLConsoleController(uiEventStream_, uiFactory_);
@@ -175,6 +177,8 @@ MainController::MainController(
}
MainController::~MainController() {
+ idleDetector_->onIdleChanged.disconnect(boost::bind(&MainController::handleInputIdleChanged, this, _1));
+
purgeCachedCredentials();
//setManagersOffline();
eventController_->disconnectAll();
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index 21460ec..7ac6648 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -11,8 +11,6 @@
#include <vector>
#include "Swiften/Network/Timer.h"
-#include "SwifTools/Idle/PlatformIdleQuerier.h"
-#include "SwifTools/Idle/ActualIdleDetector.h"
#include <string>
#include "Swiften/Client/ClientError.h"
#include "Swiften/JID/JID.h"
@@ -27,6 +25,7 @@
#include "Swift/Controllers/UIEvents/UIEvent.h"
namespace Swift {
+ class IdleDetector;
class UIFactory;
class EventLoop;
class Client;
@@ -81,6 +80,7 @@ namespace Swift {
Dock* dock,
Notifier* notifier,
URIHandler* uriHandler,
+ IdleDetector* idleDetector,
bool useDelayForLatency,
bool eagleMode);
~MainController();
@@ -118,8 +118,6 @@ namespace Swift {
EventLoop* eventLoop_;
NetworkFactories* networkFactories_;
UIFactory* uiFactory_;
- PlatformIdleQuerier idleQuerier_;
- ActualIdleDetector idleDetector_;
StoragesFactory* storagesFactory_;
Storages* storages_;
CertificateStorageFactory* certificateStorageFactory_;
@@ -131,6 +129,7 @@ namespace Swift {
ProfileSettingsProvider* profileSettings_;
Dock* dock_;
URIHandler* uriHandler_;
+ IdleDetector* idleDetector_;
TogglableNotifier* notifier_;
PresenceNotifier* presenceNotifier_;
EventNotifier* eventNotifier_;
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 1d820b1..398150e 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -80,7 +80,7 @@ po::options_description QtSwift::getOptionsDescription() {
}
-QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMainThreadCaller_), autoUpdater_(NULL) {
+QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMainThreadCaller_), autoUpdater_(NULL), idleDetector_(&idleQuerier_, networkFactories_->getTimerFactory(), 1000) {
if (options.count("netbook-mode")) {
splitter_ = new QSplitter();
} else {
@@ -165,6 +165,7 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
dock_,
notifier_,
uriHandler_,
+ &idleDetector_,
options.count("latency-debug") > 0,
eagleMode);
mainControllers_.push_back(mainController);
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index 4bf5c97..7f33475 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -21,6 +21,8 @@
#if defined(SWIFTEN_PLATFORM_WINDOWS)
#include "WindowsNotifier.h"
#endif
+#include "SwifTools/Idle/PlatformIdleQuerier.h"
+#include "SwifTools/Idle/ActualIdleDetector.h"
namespace po = boost::program_options;
@@ -71,6 +73,8 @@ namespace Swift {
CertificateStorageFactory* certificateStorageFactory_;
AutoUpdater* autoUpdater_;
Notifier* notifier_;
+ PlatformIdleQuerier idleQuerier_;
+ ActualIdleDetector idleDetector_;
#if defined(SWIFTEN_PLATFORM_MACOSX)
CocoaApplication cocoaApplication_;
#endif