summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp2
-rw-r--r--src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp2
-rw-r--r--src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp12
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp8
-rw-r--r--src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp6
5 files changed, 15 insertions, 15 deletions
diff --git a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp
index 0f488cc..9053be0 100644
--- a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp
+++ b/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp
@@ -102,7 +102,7 @@ void QCoverSensorGestureRecognizer::proximityChanged()
qreal refl = proximity->reading()->reflectance();
qreal difference = lastProx - refl;
- if (fabs(difference) < .15) {
+ if (qAbs(difference) < .15) {
return;
}
diff --git a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp
index c0b8f4b..6724190 100644
--- a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp
+++ b/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp
@@ -130,7 +130,7 @@ void QPickupSensorGestureRecognizer::accelChanged()
atRest = false;
}
if (roll > PICKUP_BOTTOM_THRESHOLD
- && (fabs(lastRoll - roll) > PICKUP_BOTTOM_THRESHOLD)) {
+ && (qAbs(lastRoll - roll) > PICKUP_BOTTOM_THRESHOLD)) {
okToSignal = true;
detectedRoll = roll;
}
diff --git a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp b/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp
index cd77582..80b19d8 100644
--- a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp
+++ b/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp
@@ -110,9 +110,9 @@ void QShake2SensorGestureRecognizer::accelChanged()
currentData.y = y;
currentData.z = z;
- if ( (abs(currentData.x - prevData.x)
- || abs(currentData.y - prevData.y)
- || abs(currentData.z - prevData.z)) < 1)
+ if ( (qAbs(currentData.x - prevData.x)
+ || qAbs(currentData.y - prevData.y)
+ || qAbs(currentData.z - prevData.z)) < 1)
return;
if (!shaking && checkForShake(prevData, currentData, THRESHOLD) &&
@@ -148,15 +148,15 @@ void QShake2SensorGestureRecognizer::accelChanged()
int xdiff = currentData.x - prevData.x;
int ydiff = currentData.y - prevData.y;
- int max = qMax(abs(ydiff), abs(xdiff));
+ int max = qMax(qAbs(ydiff), qAbs(xdiff));
- if (max == abs(xdiff)) {
+ if (max == qAbs(xdiff)) {
if (isNegative(xdiff))
shakeDirection = QShake2SensorGestureRecognizer::ShakeLeft;
else
shakeDirection = QShake2SensorGestureRecognizer::ShakeRight;
- } else if (max == abs(ydiff)) {
+ } else if (max == qAbs(ydiff)) {
if (isNegative(ydiff))
shakeDirection = QShake2SensorGestureRecognizer::ShakeDown;
else
diff --git a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
index 8fdc2ef..ced3a4e 100644
--- a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
+++ b/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
@@ -151,9 +151,9 @@ void QTwistSensorGestureRecognizer::accelChanged()
}
if (detecting
- && abs(degrees) < RESTING_VARIANCE
- && abs(calc(roll)) < RESTING_VARIANCE
- && (abs(lastX + degrees) > (degrees / 2))
+ && qAbs(degrees) < RESTING_VARIANCE
+ && qAbs(calc(roll)) < RESTING_VARIANCE
+ && (qAbs(lastX + degrees) > (degrees / 2))
) {
if (lastX < 0 ) {
Q_EMIT twistLeft();
@@ -168,7 +168,7 @@ void QTwistSensorGestureRecognizer::accelChanged()
lastX = degrees;
}
- if (!detecting && abs(degrees) > THRESHOLD_DEGREES
+ if (!detecting && qAbs(degrees) > THRESHOLD_DEGREES
&& calc(roll) < RESTING_VARIANCE) {
detecting = true;
diff --git a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp
index 3ed4b90..e6ebe19 100644
--- a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp
+++ b/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp
@@ -127,7 +127,7 @@ void QWhipSensorGestureRecognizer::accelChanged()
{
qreal x = accel->reading()->x();
qreal difference = lastX - x;
- if (abs(difference) < 1)
+ if (qAbs(difference) < 1)
return;
qreal y = accel->reading()->y();
@@ -138,7 +138,7 @@ void QWhipSensorGestureRecognizer::accelChanged()
if (whipIt) {
if (((!wasNegative && difference > accelRange * WHIP_THRESHOLD_FACTOR)
|| (wasNegative && difference < -accelRange * WHIP_THRESHOLD_FACTOR))
- && abs(degreesZ) < WHIP_DEGREES) {
+ && qAbs(degreesZ) < WHIP_DEGREES) {
Q_EMIT whip();
Q_EMIT detected("whip");
whipIt = false;
@@ -146,7 +146,7 @@ void QWhipSensorGestureRecognizer::accelChanged()
} else if (((difference > 0 && difference < accelRange * WHIP_DETECTION_FACTOR)
|| (difference < 0 && difference > -accelRange * WHIP_DETECTION_FACTOR))
- && abs(degreesZ) < WHIP_DEGREES
+ && qAbs(degreesZ) < WHIP_DEGREES
&& orientation->reading()->orientation() != QOrientationReading::FaceUp) {
detectedX = x;
// start of gesture