diff options
author | Lincoln Ramsay <lincoln.ramsay@nokia.com> | 2012-06-19 11:45:09 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-09-26 00:29:37 +0200 |
commit | f9d52ca1c093d8997d44cd8356b43b2665fdbf20 (patch) | |
tree | 45fd29bd91c67794bf3e1aefbf232bbd1d2f7b8f /src/imports/sensors2 | |
parent | 1d253860f9863fd015115d728c3f1bd04c5119c6 (diff) |
QtMobility.sensors has a new implementation
This implementation fixes the limitations the original code had
and separates the QtSensors C++ API from the QML API so that
changes to one don't need to affect the other.
Change-Id: I519463f3c7cfbad3bce5c291ce166b8793d5ed4a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/imports/sensors2')
-rw-r--r-- | src/imports/sensors2/qsensor2ambientlight.cpp | 2 | ||||
-rw-r--r-- | src/imports/sensors2/qsensor2common.cpp | 4 | ||||
-rw-r--r-- | src/imports/sensors2/qsensor2gesture.cpp | 16 | ||||
-rw-r--r-- | src/imports/sensors2/qsensor2proximity.cpp | 2 | ||||
-rw-r--r-- | src/imports/sensors2/qsensor2tilt.cpp | 14 |
5 files changed, 19 insertions, 19 deletions
diff --git a/src/imports/sensors2/qsensor2ambientlight.cpp b/src/imports/sensors2/qsensor2ambientlight.cpp index 8c021c33..a670a5ff 100644 --- a/src/imports/sensors2/qsensor2ambientlight.cpp +++ b/src/imports/sensors2/qsensor2ambientlight.cpp @@ -108,7 +108,7 @@ bool QSensor2AmbientLight::filter(QAmbientLightReading *reading) QSensor2AmbientLight::LightLevel lv = (QSensor2AmbientLight::LightLevel)reading->lightLevel(); if (lv != _lightLevel){ _lightLevel = lv; - emit lightLevelChanged(); + Q_EMIT lightLevelChanged(); } return false; } diff --git a/src/imports/sensors2/qsensor2common.cpp b/src/imports/sensors2/qsensor2common.cpp index 1db2ab8d..a151b864 100644 --- a/src/imports/sensors2/qsensor2common.cpp +++ b/src/imports/sensors2/qsensor2common.cpp @@ -86,7 +86,7 @@ void qsensor2common::setEnabled(bool val) } else sensor()->stop(); - emit enabledChanged(); + Q_EMIT enabledChanged(); } } @@ -104,7 +104,7 @@ void qsensor2common::setAlwaysOn(bool alwaysOn) { if (sensor()->isAlwaysOn() == alwaysOn) return; sensor()->setAlwaysOn(alwaysOn); - emit alwaysOnChanged(); + Q_EMIT alwaysOnChanged(); } QT_END_NAMESPACE diff --git a/src/imports/sensors2/qsensor2gesture.cpp b/src/imports/sensors2/qsensor2gesture.cpp index 8356a5c7..d68966cd 100644 --- a/src/imports/sensors2/qsensor2gesture.cpp +++ b/src/imports/sensors2/qsensor2gesture.cpp @@ -160,7 +160,7 @@ void QSensor2Gesture::setGestures(const QStringList& value) _gestures.clear(); _gestures = value; createGesture(); - emit gesturesChanged(); + Q_EMIT gesturesChanged(); } @@ -207,19 +207,19 @@ void QSensor2Gesture::setEnabled(bool value) _oldEnabled = _enabled; if (_sensorGesture){ if (_enabled){ -#ifdef LOGGESTURQMLAPI +#ifdef LOGGESTUREQMLAPI qDebug() << "start detection" << _gestureIds; #endif _sensorGesture->startDetection(); } else { -#ifdef LOGGESTURQMLAPI +#ifdef LOGGESTUREQMLAPI qDebug() << "stop detection" << _gestureIds; #endif _sensorGesture->stopDetection(); } } - emit enabledChanged(); + Q_EMIT enabledChanged(); } } @@ -245,10 +245,10 @@ void QSensor2Gesture::deleteGesture() _sensorGesture = 0; if (emitinvalidchange){ - emit invalidGesturesChanged(); + Q_EMIT invalidGesturesChanged(); } if (emitvalidchange){ - emit validGesturesChanged(); + Q_EMIT validGesturesChanged(); } } } @@ -268,10 +268,10 @@ void QSensor2Gesture::createGesture() , SIGNAL(detected(QString)) , this , SIGNAL(detected(QString))); - emit validGesturesChanged(); + Q_EMIT validGesturesChanged(); } if (!invalidGestures().isEmpty()) - emit invalidGesturesChanged(); + Q_EMIT invalidGesturesChanged(); } /* diff --git a/src/imports/sensors2/qsensor2proximity.cpp b/src/imports/sensors2/qsensor2proximity.cpp index 840d9b21..b5e3dd71 100644 --- a/src/imports/sensors2/qsensor2proximity.cpp +++ b/src/imports/sensors2/qsensor2proximity.cpp @@ -89,7 +89,7 @@ bool QSensor2Proximity::filter(QProximityReading *reading) bool cl = reading->close(); if (_near != cl){ _near = cl; - emit nearChanged(); + Q_EMIT nearChanged(); } return false; diff --git a/src/imports/sensors2/qsensor2tilt.cpp b/src/imports/sensors2/qsensor2tilt.cpp index bb4b4ce7..1314d6dc 100644 --- a/src/imports/sensors2/qsensor2tilt.cpp +++ b/src/imports/sensors2/qsensor2tilt.cpp @@ -173,7 +173,7 @@ void QSensor2Tilt::setSpeed(const QSensor2Tilt::Speed val) if (_dataRate.keys().contains(val)){ if (_dataRate.value(val) != _accel->dataRate()){ _accel->setDataRate(_dataRate.value(val)); - emit speedChanged(); + Q_EMIT speedChanged(); } } _speed = val; @@ -195,7 +195,7 @@ void QSensor2Tilt::setEnabled(const bool val) } else _accel->stop(); - emit enabledChanged(); + Q_EMIT enabledChanged(); } } @@ -221,7 +221,7 @@ void QSensor2Tilt::setUnit(const QSensor2Tilt::Unit val) { if (_unit != val){ _unit = val; - emit unitChanged(); + Q_EMIT unitChanged(); } } @@ -431,19 +431,19 @@ bool QSensor2Tilt::filter(QAccelerometerReading* reading) bool change = false; if (dxrot >= _radAccuracy){ _xRotation = xrot; - emit xRotationChanged(); + Q_EMIT xRotationChanged(); change = true; } if (dyrot >= _radAccuracy){ _yRotation = yrot; - emit yRotationChanged(); + Q_EMIT yRotationChanged(); change = true; } if (change){ if (_unit == QSensor2Tilt::Degrees) - emit tiltChanged(dxrot * 180 / M_PI, dyrot * 180 / M_PI); + Q_EMIT tiltChanged(dxrot * 180 / M_PI, dyrot * 180 / M_PI); else - emit tiltChanged(dxrot, dyrot); + Q_EMIT tiltChanged(dxrot, dyrot); } return false; } |