diff options
author | Thomas McGuire <thomas.mcguire.qnx@kdab.com> | 2013-01-10 17:37:33 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-15 17:39:06 +0100 |
commit | 96d5cec1e18aad8335f165bca77b84235b0ebda1 (patch) | |
tree | 28844dbf9786c6809ed18aefeb7ac7b53d76ea77 | |
parent | 91030f1ac36c5b4f6a5cd7333fd8965446f7a203 (diff) | |
download | qtsensors-96d5cec1e18aad8335f165bca77b84235b0ebda1.tar.gz |
Actually enable loading of the generic tilt sensor
Also, disable loading of all other generic plugins on the BlackBerry
platform.
Change-Id: I7c969fdb224daf1016162ad597edac81e967105e
Reviewed-by: Sérgio Martins <sergio.martins.qnx@kdab.com>
Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
-rw-r--r-- | src/plugins/sensors/generic/generic.pro | 20 | ||||
-rw-r--r-- | src/plugins/sensors/generic/main.cpp | 17 | ||||
-rw-r--r-- | src/plugins/sensors/sensors.pro | 4 |
3 files changed, 29 insertions, 12 deletions
diff --git a/src/plugins/sensors/generic/generic.pro b/src/plugins/sensors/generic/generic.pro index 2d4f9f9..5bfeff6 100644 --- a/src/plugins/sensors/generic/generic.pro +++ b/src/plugins/sensors/generic/generic.pro @@ -4,15 +4,19 @@ QT = core sensors PLUGIN_TYPE = sensors load(qt_plugin) -HEADERS += genericorientationsensor.h\ - genericrotationsensor.h\ - genericalssensor.h\ - generictiltsensor.h +HEADERS += generictiltsensor.h -SOURCES += genericorientationsensor.cpp\ - main.cpp\ - genericrotationsensor.cpp\ - genericalssensor.cpp\ +SOURCES += main.cpp\ generictiltsensor.cpp +!blackberry { + HEADERS += genericorientationsensor.h\ + genericrotationsensor.h\ + genericalssensor.h + + SOURCES += genericorientationsensor.cpp\ + genericrotationsensor.cpp\ + genericalssensor.cpp +} + OTHER_FILES = plugin.json diff --git a/src/plugins/sensors/generic/main.cpp b/src/plugins/sensors/generic/main.cpp index c455489..a69c279 100644 --- a/src/plugins/sensors/generic/main.cpp +++ b/src/plugins/sensors/generic/main.cpp @@ -39,9 +39,12 @@ ** ****************************************************************************/ +#ifndef Q_OS_BLACKBERRY #include "genericorientationsensor.h" #include "genericrotationsensor.h" #include "genericalssensor.h" +#endif +#include "generictiltsensor.h" #include <qsensorplugin.h> #include <qsensorbackend.h> #include <qsensormanager.h> @@ -64,26 +67,33 @@ public: { if (!QSensor::defaultSensorForType(QAccelerometer::type).isEmpty()) { // There is an accelerometer available. Register the backends +#ifndef Q_OS_BLACKBERRY if (!QSensorManager::isBackendRegistered(QOrientationSensor::type, genericorientationsensor::id)) QSensorManager::registerBackend(QOrientationSensor::type, genericorientationsensor::id, this); if (!QSensorManager::isBackendRegistered(QRotationSensor::type, genericrotationsensor::id)) QSensorManager::registerBackend(QRotationSensor::type, genericrotationsensor::id, this); if (!QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id)) QSensorManager::registerBackend(QAmbientLightSensor::type, genericalssensor::id, this); - if (!QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id)) - QSensorManager::registerBackend(QAmbientLightSensor::type, genericalssensor::id, this); +#endif + if (!QSensorManager::isBackendRegistered(QTiltSensor::type, GenericTiltSensor::id)) + QSensorManager::registerBackend(QTiltSensor::type, GenericTiltSensor::id, this); } else { +#ifndef Q_OS_BLACKBERRY if (QSensorManager::isBackendRegistered(QOrientationSensor::type, genericorientationsensor::id)) QSensorManager::unregisterBackend(QOrientationSensor::type, genericorientationsensor::id); if (QSensorManager::isBackendRegistered(QRotationSensor::type, genericrotationsensor::id)) QSensorManager::unregisterBackend(QRotationSensor::type, genericrotationsensor::id); if (QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id)) QSensorManager::unregisterBackend(QAmbientLightSensor::type, genericalssensor::id); +#endif + if (QSensorManager::isBackendRegistered(QTiltSensor::type, GenericTiltSensor::id)) + QSensorManager::unregisterBackend(QTiltSensor::type, GenericTiltSensor::id); } } QSensorBackend *createBackend(QSensor *sensor) { +#ifndef Q_OS_BLACKBERRY if (sensor->identifier() == genericorientationsensor::id) return new genericorientationsensor(sensor); @@ -92,6 +102,9 @@ public: if (sensor->identifier() == genericalssensor::id) return new genericalssensor(sensor); +#endif + if (sensor->identifier() == GenericTiltSensor::id) + return new GenericTiltSensor(sensor); return 0; } diff --git a/src/plugins/sensors/sensors.pro b/src/plugins/sensors/sensors.pro index 41fc6fd..2edbb36 100644 --- a/src/plugins/sensors/sensors.pro +++ b/src/plugins/sensors/sensors.pro @@ -1,9 +1,9 @@ TEMPLATE = subdirs -# Don't build dummy and generic plugins by default, the Blackberry backend has real implementations +# Don't build dummy plugins, the Blackberry backend has real implementations # of these. This reduces compile time and plugin loading time. blackberry { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = blackberry + isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = blackberry generic } isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, dummy):SUBDIRS += dummy |