diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-03-22 15:32:13 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-23 01:16:47 +0100 |
commit | 53a555053376bbad0a21649464370772447475c5 (patch) | |
tree | 6a79e309f7b8fd13f2b1c1b3ff34a417b2516593 /src | |
parent | 2c46fea5848ffdfef2a21d01076625a6f2e547bd (diff) | |
download | qtsensors-53a555053376bbad0a21649464370772447475c5.tar.gz |
qshake[2]recognizer: Fix MSVC compiler warnings.
Warnings about conversion from qreal to bool, which is
unintended.
Change-Id: Iab668747d5d7cdeda57f934b90991e7b00914eac
Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp | 15 | ||||
-rw-r--r-- | src/plugins/sensorgestures/shake/qshakerecognizer.cpp | 11 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp b/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp index c7686c8..738d720 100644 --- a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp +++ b/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp @@ -115,10 +115,15 @@ void QShake2SensorGestureRecognizer::accelChanged(QAccelerometerReading *reading currentData.y = y; currentData.z = z; - if ( (qAbs(currentData.x - prevData.x) - || qAbs(currentData.y - prevData.y) - || qAbs(currentData.z - prevData.z)) < 1) + if (qAbs(prevData.x - currentData.x) < 1 + && qAbs(prevData.y - currentData.y) < 1 + && qAbs(prevData.z - currentData.z) < 1) { + + prevData.x = currentData.x; + prevData.y = currentData.y; + prevData.z = currentData.z; return; + } if (!shaking && checkForShake(prevData, currentData, THRESHOLD) && shakeCount >= NUMBER_SHAKES) { @@ -150,8 +155,8 @@ void QShake2SensorGestureRecognizer::accelChanged(QAccelerometerReading *reading if (shakeCount == 0 && shakeDirection == QShake2SensorGestureRecognizer::ShakeUndefined) { - const int xdiff = currentData.x - prevData.x; - const int ydiff = currentData.y - prevData.y; + const int xdiff = prevData.x - currentData.x; + const int ydiff = prevData.x - currentData.y; const int max = qMax(qAbs(ydiff), qAbs(xdiff)); diff --git a/src/plugins/sensorgestures/shake/qshakerecognizer.cpp b/src/plugins/sensorgestures/shake/qshakerecognizer.cpp index 41df859..df64402 100644 --- a/src/plugins/sensorgestures/shake/qshakerecognizer.cpp +++ b/src/plugins/sensorgestures/shake/qshakerecognizer.cpp @@ -106,10 +106,15 @@ void QShakeSensorGestureRecognizer::accelChanged() currentData.y = y; currentData.z = z; - if ((qAbs(currentData.x - prevData.x) - || qAbs(currentData.y - prevData.y) - || qAbs(currentData.z - prevData.z)) < 1) + if (qAbs(prevData.x - currentData.x) < 1 + && qAbs(prevData.y - currentData.y) < 1 + && qAbs(prevData.z - currentData.z) < 1) { + + prevData.x = currentData.x; + prevData.y = currentData.y; + prevData.z = currentData.z; return; + } if (!shaking && checkForShake(prevData, currentData, THRESHOLD) && |