summaryrefslogtreecommitdiffstats
path: root/src/plugins/sensorgestures/shake/qshakerecognizer.h
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2012-02-01 10:28:51 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-01 06:24:50 +0100
commit89fbd66b01bab3eca2ed9591f158f28d6e43e9e2 (patch)
treee41f9c52421a9e011851720f628638870b9d1de0 /src/plugins/sensorgestures/shake/qshakerecognizer.h
parentb643afb7845d4fc15eb469d0d9a1ec18b0dbb254 (diff)
try harder to make sure gesture dont fire too easily
some gestures will fire when trying other gestures. Make sure they don't collide and provide false positives as much. Change-Id: I4abd7d9ee876b77a211ae1b46bcc56f4fdc64ec0 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
Diffstat (limited to 'src/plugins/sensorgestures/shake/qshakerecognizer.h')
-rw-r--r--src/plugins/sensorgestures/shake/qshakerecognizer.h30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/plugins/sensorgestures/shake/qshakerecognizer.h b/src/plugins/sensorgestures/shake/qshakerecognizer.h
index 4292c664..dfba26b3 100644
--- a/src/plugins/sensorgestures/shake/qshakerecognizer.h
+++ b/src/plugins/sensorgestures/shake/qshakerecognizer.h
@@ -51,6 +51,12 @@
#include <qsensorgesturerecognizer.h>
+ struct AccelData {
+ qreal x;
+ qreal y;
+ qreal z;
+};
+
class QShakeSensorGestureRecognizer : public QSensorGestureRecognizer
{
Q_OBJECT
@@ -67,32 +73,24 @@ public:
bool stop();
bool isActive();
- int thresholdTime() const;
- void setThresholdTime(int msec);
-
Q_SIGNALS:
void shake();
private slots:
void accelChanged();
- void timeout();
private:
QAccelerometer *accel;
+ bool active;
+ int accelRange;
- qreal pXaxis;
- qreal nXaxis;
-
- qreal pYaxis;
- qreal nYaxis;
+ AccelData prevData;
+ AccelData currentData;
- qreal pZaxis;
- qreal nZaxis;
+ bool checkForShake(AccelData prevSensorData, AccelData currentSensorData, qreal threshold);
+ bool shaking;
+ int shakeCount;
+ int threshold;
- bool detectingState;
- QTimer *timer;
- int timerTimeout;
- bool active;
- int accelRange;
};
#endif // QSHAKERECOGNIZER_H