summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-24 20:03:09 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-24 20:03:09 (GMT)
commit48fc9e9fb0abd42d47a95042837a026730f20f34 (patch)
tree3390dbf200fcde18c2b1c6877c29a143e80671fd /Swift/QtUI
parent3b7e581ad1d57170d9809e27437ee3c468c5702f (diff)
downloadswift-48fc9e9fb0abd42d47a95042837a026730f20f34.zip
swift-48fc9e9fb0abd42d47a95042837a026730f20f34.tar.bz2
Integrated new IdleDetector.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtIdleDetector.cpp38
-rw-r--r--Swift/QtUI/QtIdleDetector.h25
-rw-r--r--Swift/QtUI/QtSwift.cpp6
-rw-r--r--Swift/QtUI/QtSwift.h2
-rw-r--r--Swift/QtUI/SConscript1
5 files changed, 1 insertions, 71 deletions
diff --git a/Swift/QtUI/QtIdleDetector.cpp b/Swift/QtUI/QtIdleDetector.cpp
deleted file mode 100644
index 783cc14..0000000
--- a/Swift/QtUI/QtIdleDetector.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "QtIdleDetector.h"
-
-#include <QCursor>
-
-namespace Swift {
-
-QtIdleDetector::QtIdleDetector() {
- signalled_ = false;
- lastMoveTime_ = QDateTime::currentDateTime();
- lastPosition_ = QCursor::pos();
- connect(&timer_, SIGNAL(timeout()), this, SLOT(handleTimerTick()));
- timer_.start(1000);
-}
-
-QtIdleDetector::~QtIdleDetector() {
-}
-
-void QtIdleDetector::forceNotIdle() {
-
-}
-
-void QtIdleDetector::handleTimerTick() {
- QPoint position = QCursor::pos();
- QDateTime now = QDateTime::currentDateTime();
- if (position != lastPosition_) {
- if (signalled_) {
- onInputNotIdle();
- }
- lastPosition_ = position;
- lastMoveTime_ = now;
- signalled_ = false;
- } else if (!signalled_ && now > lastMoveTime_.addSecs(600) && position == lastPosition_) {
- signalled_ = true;
- onInputIdle();
- }
-}
-
-}
diff --git a/Swift/QtUI/QtIdleDetector.h b/Swift/QtUI/QtIdleDetector.h
deleted file mode 100644
index 444fb15..0000000
--- a/Swift/QtUI/QtIdleDetector.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#pragma once
-
-#include "Swift/Controllers/IdleDetector.h"
-
-#include <QObject>
-#include <QPoint>
-#include <QTimer>
-#include <QDateTime>
-
-namespace Swift {
-class QtIdleDetector : public QObject, public IdleDetector {
- Q_OBJECT
- public:
- QtIdleDetector();
- virtual ~QtIdleDetector();
- virtual void forceNotIdle();
- private slots:
- void handleTimerTick();
- private:
- QPoint lastPosition_;
- QDateTime lastMoveTime_;
- QTimer timer_;
- bool signalled_;
-};
-}
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 0def66f..2aaa27e 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -8,8 +8,6 @@
#include "Roster/QtTreeWidgetFactory.h"
#include "QtSystemTray.h"
#include "QtSoundPlayer.h"
-#include "QtIdleDetector.h"
-
#include <boost/bind.hpp>
#include <QSplitter>
@@ -42,11 +40,10 @@ QtSwift::QtSwift(bool netbookMode) {
chatWindowFactory_ = new QtChatWindowFactory(treeWidgetFactory_, splitter_, settings_);
rosterWindowFactory_ = new QtMainWindowFactory(treeWidgetFactory_);
soundPlayer_ = new QtSoundPlayer();
- idleDetector_ = new QtIdleDetector();
if (splitter_) {
splitter_->show();
}
- mainController_ = new MainController(chatWindowFactory_, rosterWindowFactory_, loginWindowFactory_, treeWidgetFactory_, settings_, application_, systemTray_, soundPlayer_, idleDetector_);
+ mainController_ = new MainController(chatWindowFactory_, rosterWindowFactory_, loginWindowFactory_, treeWidgetFactory_, settings_, application_, systemTray_, soundPlayer_);
}
QtSwift::~QtSwift() {
@@ -60,7 +57,6 @@ QtSwift::~QtSwift() {
delete systemTray_;
delete splitter_;
delete soundPlayer_;
- delete idleDetector_;
}
}
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index 60ff5a7..263dc05 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -7,7 +7,6 @@
#include "QtMainWindowFactory.h"
#include "QtChatWindowFactory.h"
#include "QtSettingsProvider.h"
-#include "QtIdleDetector.h"
class QSplitter;
@@ -37,7 +36,6 @@ namespace Swift {
QtSystemTray* systemTray_;
QSplitter* splitter_;
QtSoundPlayer* soundPlayer_;
- QtIdleDetector* idleDetector_;
Application* application_;
};
}
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index d30f3b9..800a009 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -52,7 +52,6 @@ sources = [
"QtAddContactDialog.cpp",
"QtChatWindow.cpp",
"QtChatWindowFactory.cpp",
- "QtIdleDetector.cpp",
"QtJoinMUCDialog.cpp",
"QtLoginWindow.cpp",
"QtLoginWindowFactory.cpp",