diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-10-14 19:51:54 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-10-14 19:51:54 +0200 |
commit | 5efb5dac71baf7910be0ebf5debb2b0236adf8fe (patch) | |
tree | e01842e7e0c86c57096a49012381bd37f69dad52 /src | |
parent | 8bd96b78bdf3598549d9de4256af4df93781c528 (diff) | |
parent | d8e357f75a05bce5e1286c94e2b1954f6591218e (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I4286dcb9262bf38960ff3852932012718aaa5d65
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/sensors/generic/main.cpp | 20 | ||||
-rw-r--r-- | src/plugins/sensors/sensorfw/main.cpp | 3 | ||||
-rw-r--r-- | src/sensors/doc/src/compatmap.qdoc | 2 | ||||
-rw-r--r-- | src/sensors/doc/src/qtsensors-backend.qdoc | 14 | ||||
-rw-r--r-- | src/sensors/doc/src/qtsensors5.qdoc | 8 |
5 files changed, 26 insertions, 21 deletions
diff --git a/src/plugins/sensors/generic/main.cpp b/src/plugins/sensors/generic/main.cpp index 257e47e4..0fe3126d 100644 --- a/src/plugins/sensors/generic/main.cpp +++ b/src/plugins/sensors/generic/main.cpp @@ -72,10 +72,6 @@ public: if (!QSensorManager::isBackendRegistered(QRotationSensor::type, genericrotationsensor::id)) QSensorManager::registerBackend(QRotationSensor::type, genericrotationsensor::id, this); #endif -#ifdef QTSENSORS_GENERICALSSENSOR - if (!QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id)) - QSensorManager::registerBackend(QAmbientLightSensor::type, genericalssensor::id, this); -#endif #ifdef QTSENSORS_GENERICTILTSENSOR if (!QSensorManager::isBackendRegistered(QTiltSensor::type, GenericTiltSensor::id)) QSensorManager::registerBackend(QTiltSensor::type, GenericTiltSensor::id, this); @@ -89,15 +85,23 @@ public: if (QSensorManager::isBackendRegistered(QRotationSensor::type, genericrotationsensor::id)) QSensorManager::unregisterBackend(QRotationSensor::type, genericrotationsensor::id); #endif -#ifdef QTSENSORS_GENERICALSSENSOR - if (QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id)) - QSensorManager::unregisterBackend(QAmbientLightSensor::type, genericalssensor::id); -#endif #ifdef QTSENSORS_GENERICTILTSENSOR if (QSensorManager::isBackendRegistered(QTiltSensor::type, GenericTiltSensor::id)) QSensorManager::unregisterBackend(QTiltSensor::type, GenericTiltSensor::id); #endif } + + if (!QSensor::defaultSensorForType(QLightSensor::type).isEmpty()) { +#ifdef QTSENSORS_GENERICALSSENSOR + if (!QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id)) + QSensorManager::registerBackend(QAmbientLightSensor::type, genericalssensor::id, this); +#endif + } else { +#ifdef QTSENSORS_GENERICALSSENSOR + if (QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id)) + QSensorManager::unregisterBackend(QAmbientLightSensor::type, genericalssensor::id); +#endif + } } QSensorBackend *createBackend(QSensor *sensor) diff --git a/src/plugins/sensors/sensorfw/main.cpp b/src/plugins/sensors/sensorfw/main.cpp index b22b6474..9951f096 100644 --- a/src/plugins/sensors/sensorfw/main.cpp +++ b/src/plugins/sensors/sensorfw/main.cpp @@ -65,7 +65,8 @@ public: QStringList keys = settings.allKeys(); for (int i=0,l=keys.size(); i<l; i++) { QString type = keys.at(i); - QSensorManager::registerBackend(type.toLocal8Bit(), settings.value(type).toByteArray(), this); + if (settings.value(type).toString().contains(QStringLiteral("sensorfw")))//register only ones we know + QSensorManager::registerBackend(type.toLocal8Bit(), settings.value(type).toByteArray(), this); } } diff --git a/src/sensors/doc/src/compatmap.qdoc b/src/sensors/doc/src/compatmap.qdoc index f6a99a9e..4f45fcbc 100644 --- a/src/sensors/doc/src/compatmap.qdoc +++ b/src/sensors/doc/src/compatmap.qdoc @@ -88,7 +88,7 @@ <td bgcolor="gray"></td> <td bgcolor="green"></td> <td bgcolor="gray"></td> - <td bgcolor="gray"></td> + <td bgcolor="green"></td> <td bgcolor="green"></td> </tr> <tr> diff --git a/src/sensors/doc/src/qtsensors-backend.qdoc b/src/sensors/doc/src/qtsensors-backend.qdoc index 98fcd741..65ea612b 100644 --- a/src/sensors/doc/src/qtsensors-backend.qdoc +++ b/src/sensors/doc/src/qtsensors-backend.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! -\group sensors_backend_topics +\page sensors-backend-topics.html \title Qt Sensors Backend \brief Describes how to use the Qt Sensors backend. @@ -37,8 +37,6 @@ hardware sensors. \section1 Overview -\section1 Backend API - QSensor instances talk to a backend object. Backends are usually supplied with the Qt Sensors library for a specific device, although third-party backends may be used as well. A backend can talk directly to hardware, or @@ -53,14 +51,16 @@ classes to use. \section1 Backend Topics -\generatelist related - +\list +\li \l{Creating a sensor plugin} +\li \l{Determining the default sensor for a type} +\li \l{Dynamic Sensor Backend Registration} +\endlist */ /*! \page creating-a-sensor-plugin.html \title Creating a sensor plugin -\ingroup sensors_backend_topics \section1 How a Sensor Plugin is Loaded @@ -83,7 +83,6 @@ An example follows. /*! \page determining-the-default-sensor-for-a-type.html \title Determining the default sensor for a type -\ingroup sensors_backend_topics \section1 Multiple Sensors Can Exist for a Type @@ -141,7 +140,6 @@ it is specified in \c{Sensors.conf}. /*! \page dynamic-sensor-backend-registration.html \title Dynamic Sensor Backend Registration -\ingroup sensors_backend_topics \section1 Static Backend Registration diff --git a/src/sensors/doc/src/qtsensors5.qdoc b/src/sensors/doc/src/qtsensors5.qdoc index 69e7abb0..bf7fa982 100644 --- a/src/sensors/doc/src/qtsensors5.qdoc +++ b/src/sensors/doc/src/qtsensors5.qdoc @@ -51,14 +51,14 @@ If the module is imported into a namespace, some additional methods become available. - \code + \qml import QtSensors 5.0 - ... + // ... Component.onCompleted: { var types = QmlSensors.sensorTypes(); console.log(types.join(", ")); } - \endcode + \endqml The documentation for the module API can be found in SensorGlobal. @@ -75,4 +75,6 @@ The data from a sensor comes via a reading class. \annotatedlist qml-sensors_reading + + \section1 All QML Types */ |