src/hbcore/gestures/hbgesturerecognizers_p.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
--- a/src/hbcore/gestures/hbgesturerecognizers_p.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbcore/gestures/hbgesturerecognizers_p.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -25,15 +25,16 @@
 
 #include "hbgestures_p.h"
 #include "hbgesturerecognizers_p.h"
+
+#include "hbtapgesture.h"
 #include "hbpangesture.h"
-#include "hbtapgesture.h"
 #include "hbtapandholdgesture.h"
+#include "hbswipegesture.h"
 #include "hbpinchgesture.h"
-#include "hbswipegesture.h"
 
 #include <QGesture>
-#include <QTime>
 #include <QGraphicsObject>
+#include <QDebug>
 
 //#define RECOGNIZERS_DEBUG
 #ifdef RECOGNIZERS_DEBUG
@@ -42,6 +43,8 @@
 #define DEBUG if (0) qDebug
 #endif
 
+#define GESTURE_D(Class, ptr) Class##Private * const d = static_cast<Class *>(ptr)->d_func()
+
 ////////////////////////////////////////////////////////////////////////////
 // Pan gesture
 ////////////////////////////////////////////////////////////////////////////
@@ -98,7 +101,9 @@
     // this is to enable testability within logic classes.
     // QGesture contains gesture state, which cannot be modified by
     // anything else, but QGestureManager itself.
-    return HbPanGestureLogic::recognize(state->state(), static_cast<HbPanGesture *>(state), watched, event, QTime::currentTime());
+    GESTURE_D(HbPanGesture, state);
+    Q_ASSERT(d->mTime.isValid());
+    return HbPanGestureLogic::recognize(state->state(), static_cast<HbPanGesture *>(state), watched, event, d->mTime.elapsed());
 }
 
 /*!
@@ -109,6 +114,8 @@
 */
 void HbPanGestureRecognizer::reset(QGesture *state)
 {
+    GESTURE_D(HbPanGesture, state);
+    d->mTime.restart();
     HbPanGestureLogic::resetGesture(static_cast<HbPanGesture *>(state));
     QGestureRecognizer::reset(state);
 }
@@ -367,7 +374,9 @@
     // this is to enable testability within logic classes.
     // QGesture contains gesture state, which cannot be modified by
     // anything else, but QGestureManager itself.
-    return HbSwipeGestureLogic::recognize(state->state(), static_cast<HbSwipeGesture *>(state), watched, event, QTime::currentTime());
+    GESTURE_D(HbSwipeGesture, state);
+    Q_ASSERT(d->mTime.isValid());
+    return HbSwipeGestureLogic::recognize(state->state(), static_cast<HbSwipeGesture *>(state), watched, event, d->mTime.elapsed());
 }
 
 /*!
@@ -378,6 +387,8 @@
 */
 void HbSwipeGestureRecognizer::reset(QGesture *state)
 {
+    GESTURE_D(HbSwipeGesture, state);
+    d->mTime.restart();
     HbSwipeGestureLogic::resetGesture(static_cast<HbSwipeGesture *>(state));
     QGestureRecognizer::reset(state);
 }