From b249c74338a69a7441708833565a6197412e55fa Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Fri, 4 Apr 2014 10:41:06 +0200 Subject: Simplify building of simulator based code There is no need for the CONFIG+=simulator logic anymore. qtHaveModule() is an automatic way of doing the same. Change-Id: Ibe87abb93e036a82fae3a752d9886c58ccebeec1 Reviewed-by: Rainer Keller Reviewed-by: Alex Blasche --- src/plugins/sensors/sensors.pro | 8 +++++--- src/sensors/sensors.pro | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/sensors/sensors.pro b/src/plugins/sensors/sensors.pro index a566716a..3f35db5a 100644 --- a/src/plugins/sensors/sensors.pro +++ b/src/plugins/sensors/sensors.pro @@ -1,7 +1,5 @@ TEMPLATE = subdirs -# 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 generic } @@ -22,9 +20,13 @@ winrt { isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = winrt generic } +qtHaveModule(simulator) { + isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = simulator generic +} + isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, dummy):SUBDIRS += dummy isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, generic):SUBDIRS += generic -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, simulator):simulator:SUBDIRS += simulator +isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, simulator):qtHaveModule(simulator):SUBDIRS += simulator isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, blackberry):blackberry:SUBDIRS += blackberry isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, linux):linux:SUBDIRS += linux isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, android):android:SUBDIRS += android diff --git a/src/sensors/sensors.pro b/src/sensors/sensors.pro index e7ad05f5..13e83151 100644 --- a/src/sensors/sensors.pro +++ b/src/sensors/sensors.pro @@ -5,7 +5,7 @@ QT = core-private CONFIG(debug,debug|release):DEFINES += ENABLE_RUNTIME_SENSORLOG !isEmpty(SENSORS_CONFIG_PATH):DEFINES += "QTSENSORS_CONFIG_PATH=\\\"$$SENSORS_CONFIG_PATH\\\"" -simulator { +qtHaveModule(simulator) { DEFINES += SIMULATOR_BUILD QT += simulator } @@ -52,7 +52,7 @@ GESTURE_HEADERS += \ gestures/qsensorgesturemanagerprivate_p.h \ gestures/qsensorgestureplugininterface.h -simulator { +qtHaveModule(simulator) { SOURCES += gestures/simulatorgesturescommon.cpp GESTURE_HEADERS += gestures/simulatorgesturescommon_p.h } -- cgit v1.2.3 From a4e86e21d540ab642ba02d8e060a6154114da701 Mon Sep 17 00:00:00 2001 From: Andrew Inwood Date: Thu, 3 Apr 2014 10:43:21 -0400 Subject: BlackBerry: update plugin key The plugin key for both the Generic backend and the BlackBerry backend were set to "notused". This ultimately caused the Generic backend not to be loaded, which is why QTiltSensor wasn't being exposed. The duplicate keys caused a collision in a QMap in QFactoryLoader, making it look like the generic backend had been created, when it hadn't. Tested on a BlackBerry Z10. Change-Id: Ie5e40586751e7c3b9683a94a39b07efd4fc7fc82 Reviewed-by: Bernd Weimer Reviewed-by: Fabian Bumberger --- src/plugins/sensors/android/src/plugin.json | 2 +- src/plugins/sensors/blackberry/plugin.json | 2 +- src/plugins/sensors/dummy/plugin.json | 2 +- src/plugins/sensors/generic/plugin.json | 2 +- src/plugins/sensors/ios/plugin.json | 2 +- src/plugins/sensors/linux/plugin.json | 2 +- src/plugins/sensors/sensorfw/plugin.json | 2 +- src/plugins/sensors/simulator/plugin.json | 2 +- src/plugins/sensors/winrt/plugin.json | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/sensors/android/src/plugin.json b/src/plugins/sensors/android/src/plugin.json index 8a55b3ae..ef0cbb62 100644 --- a/src/plugins/sensors/android/src/plugin.json +++ b/src/plugins/sensors/android/src/plugin.json @@ -1 +1 @@ -{ "Keys": [ "notused" ] } +{ "Keys": [ "android" ] } diff --git a/src/plugins/sensors/blackberry/plugin.json b/src/plugins/sensors/blackberry/plugin.json index 8a55b3ae..5350abb1 100644 --- a/src/plugins/sensors/blackberry/plugin.json +++ b/src/plugins/sensors/blackberry/plugin.json @@ -1 +1 @@ -{ "Keys": [ "notused" ] } +{ "Keys": [ "blackberry" ] } diff --git a/src/plugins/sensors/dummy/plugin.json b/src/plugins/sensors/dummy/plugin.json index 8a55b3ae..5485029b 100644 --- a/src/plugins/sensors/dummy/plugin.json +++ b/src/plugins/sensors/dummy/plugin.json @@ -1 +1 @@ -{ "Keys": [ "notused" ] } +{ "Keys": [ "dummy" ] } diff --git a/src/plugins/sensors/generic/plugin.json b/src/plugins/sensors/generic/plugin.json index 8a55b3ae..d3e579e7 100644 --- a/src/plugins/sensors/generic/plugin.json +++ b/src/plugins/sensors/generic/plugin.json @@ -1 +1 @@ -{ "Keys": [ "notused" ] } +{ "Keys": [ "generic" ] } diff --git a/src/plugins/sensors/ios/plugin.json b/src/plugins/sensors/ios/plugin.json index 8a55b3ae..c9f07668 100644 --- a/src/plugins/sensors/ios/plugin.json +++ b/src/plugins/sensors/ios/plugin.json @@ -1 +1 @@ -{ "Keys": [ "notused" ] } +{ "Keys": [ "ios" ] } diff --git a/src/plugins/sensors/linux/plugin.json b/src/plugins/sensors/linux/plugin.json index 8a55b3ae..f3863f11 100644 --- a/src/plugins/sensors/linux/plugin.json +++ b/src/plugins/sensors/linux/plugin.json @@ -1 +1 @@ -{ "Keys": [ "notused" ] } +{ "Keys": [ "linux" ] } diff --git a/src/plugins/sensors/sensorfw/plugin.json b/src/plugins/sensors/sensorfw/plugin.json index 8a55b3ae..a418c7dd 100644 --- a/src/plugins/sensors/sensorfw/plugin.json +++ b/src/plugins/sensors/sensorfw/plugin.json @@ -1 +1 @@ -{ "Keys": [ "notused" ] } +{ "Keys": [ "sensorfw" ] } diff --git a/src/plugins/sensors/simulator/plugin.json b/src/plugins/sensors/simulator/plugin.json index 8a55b3ae..77f47afe 100644 --- a/src/plugins/sensors/simulator/plugin.json +++ b/src/plugins/sensors/simulator/plugin.json @@ -1 +1 @@ -{ "Keys": [ "notused" ] } +{ "Keys": [ "simulator" ] } diff --git a/src/plugins/sensors/winrt/plugin.json b/src/plugins/sensors/winrt/plugin.json index 8a55b3ae..0b1b6642 100644 --- a/src/plugins/sensors/winrt/plugin.json +++ b/src/plugins/sensors/winrt/plugin.json @@ -1 +1 @@ -{ "Keys": [ "notused" ] } +{ "Keys": [ "winrt" ] } -- cgit v1.2.3 From 5bdeb53a9b1e2543539e637c72dfaf3b91fdb60c Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 8 Apr 2014 14:17:43 +0200 Subject: Accelbubble example only really works with a locked UI to portrait On Android we have to do that via a custom AndroidManifest. Change-Id: If436bdd494b3d167121bd8ee80f81c031a81f5d5 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Leena Miettinen --- examples/sensors/accelbubble/accelbubble.pro | 5 ++- .../accelbubble/android/AndroidManifest.xml | 48 ++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 examples/sensors/accelbubble/android/AndroidManifest.xml diff --git a/examples/sensors/accelbubble/accelbubble.pro b/examples/sensors/accelbubble/accelbubble.pro index b183bf41..cdb6ab75 100644 --- a/examples/sensors/accelbubble/accelbubble.pro +++ b/examples/sensors/accelbubble/accelbubble.pro @@ -9,7 +9,10 @@ RESOURCES += \ OTHER_FILES = \ $$files(*.qml) \ content \ - images + images \ + android/AndroidManifest.xml target.path = $$[QT_INSTALL_EXAMPLES]/sensors/accelbubble INSTALLS += target + +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android diff --git a/examples/sensors/accelbubble/android/AndroidManifest.xml b/examples/sensors/accelbubble/android/AndroidManifest.xml new file mode 100644 index 00000000..cbebcdd0 --- /dev/null +++ b/examples/sensors/accelbubble/android/AndroidManifest.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 2a503c28e4b9c9c05ee69e115f3530bb764844e3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 7 Apr 2014 17:32:24 +0200 Subject: add PLUGIN_CLASS_NAME declarations to plugin projects needed for automatic static linking (and later deployment). the gesture plugins are excluded from the automation based on the assumption that they are usually not needed. the example and the test plugin are also excluded for obvious reasons. Change-Id: I7645aa0daf216ce430989e13d4380dbe6dd2bbd1 Reviewed-by: Fawzi Mohamed Reviewed-by: Alex Blasche --- examples/sensors/qmlsensorgestures/plugin/plugin.pro | 2 ++ src/plugins/sensorgestures/qtsensors/qtsensors.pro | 2 ++ src/plugins/sensorgestures/shake/shake.pro | 2 ++ src/plugins/sensors/android/src/src.pro | 1 + src/plugins/sensors/blackberry/blackberry.pro | 1 + src/plugins/sensors/dummy/dummy.pro | 1 + src/plugins/sensors/linux/linux.pro | 1 + src/plugins/sensors/sensorfw/sensorfw.pro | 1 + src/plugins/sensors/simulator/simulator.pro | 1 + src/plugins/sensors/winrt/winrt.pro | 1 + tests/auto/qsensorgestures/plugins/test1/test1.pro | 2 ++ 11 files changed, 15 insertions(+) diff --git a/examples/sensors/qmlsensorgestures/plugin/plugin.pro b/examples/sensors/qmlsensorgestures/plugin/plugin.pro index 9d5f26b9..23ece17b 100644 --- a/examples/sensors/qmlsensorgestures/plugin/plugin.pro +++ b/examples/sensors/qmlsensorgestures/plugin/plugin.pro @@ -4,6 +4,8 @@ TARGET = qtsensorgestures_counterplugin QTDIR_build { # This is only for the Qt build. Do not use externally. We mean it. PLUGIN_TYPE = sensorgestures +PLUGIN_CLASS_NAME = QCounterGesturePlugin +PLUGIN_EXTENDS = - load(qt_plugin) } else { diff --git a/src/plugins/sensorgestures/qtsensors/qtsensors.pro b/src/plugins/sensorgestures/qtsensors/qtsensors.pro index de6c2780..3f8df039 100644 --- a/src/plugins/sensorgestures/qtsensors/qtsensors.pro +++ b/src/plugins/sensorgestures/qtsensors/qtsensors.pro @@ -2,6 +2,8 @@ TARGET = qtsensorgestures_plugin QT = core sensors PLUGIN_TYPE = sensorgestures +PLUGIN_CLASS_NAME = QtSensorGesturePlugin +PLUGIN_EXTENDS = - load(qt_plugin) # Input diff --git a/src/plugins/sensorgestures/shake/shake.pro b/src/plugins/sensorgestures/shake/shake.pro index 82031c62..d7d8f92e 100644 --- a/src/plugins/sensorgestures/shake/shake.pro +++ b/src/plugins/sensorgestures/shake/shake.pro @@ -2,6 +2,8 @@ TARGET = qtsensorgestures_shakeplugin QT = core sensors PLUGIN_TYPE = sensorgestures +PLUGIN_CLASS_NAME = QShakeSensorGesturePlugin +PLUGIN_EXTENDS = - load(qt_plugin) # Input diff --git a/src/plugins/sensors/android/src/src.pro b/src/plugins/sensors/android/src/src.pro index a184aae7..21423efb 100644 --- a/src/plugins/sensors/android/src/src.pro +++ b/src/plugins/sensors/android/src/src.pro @@ -2,6 +2,7 @@ TARGET = qtsensors_android QT = sensors core PLUGIN_TYPE = sensors +PLUGIN_CLASS_NAME = QCounterGesturePlugin load(qt_plugin) # STATICPLUGIN needed because there's a Q_IMPORT_PLUGIN in main.cpp diff --git a/src/plugins/sensors/blackberry/blackberry.pro b/src/plugins/sensors/blackberry/blackberry.pro index 902239c4..8095cf16 100644 --- a/src/plugins/sensors/blackberry/blackberry.pro +++ b/src/plugins/sensors/blackberry/blackberry.pro @@ -3,6 +3,7 @@ QT = sensors core DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII PLUGIN_TYPE = sensors +PLUGIN_CLASS_NAME = BbSensorPlugin load(qt_plugin) config_bbsensor_header { diff --git a/src/plugins/sensors/dummy/dummy.pro b/src/plugins/sensors/dummy/dummy.pro index f54588af..93f54dc0 100644 --- a/src/plugins/sensors/dummy/dummy.pro +++ b/src/plugins/sensors/dummy/dummy.pro @@ -2,6 +2,7 @@ TARGET = qtsensors_dummy QT = sensors core PLUGIN_TYPE = sensors +PLUGIN_CLASS_NAME = dummySensorPlugin load(qt_plugin) HEADERS += dummycommon.h\ diff --git a/src/plugins/sensors/linux/linux.pro b/src/plugins/sensors/linux/linux.pro index 25c4f2d9..636bd1b3 100644 --- a/src/plugins/sensors/linux/linux.pro +++ b/src/plugins/sensors/linux/linux.pro @@ -2,6 +2,7 @@ TARGET = qtsensors_linuxsys QT = core sensors PLUGIN_TYPE = sensors +PLUGIN_CLASS_NAME = LinuxSensorPlugin load(qt_plugin) OTHER_FILES = plugin.json diff --git a/src/plugins/sensors/sensorfw/sensorfw.pro b/src/plugins/sensors/sensorfw/sensorfw.pro index f875f593..6c1408b2 100644 --- a/src/plugins/sensors/sensorfw/sensorfw.pro +++ b/src/plugins/sensors/sensorfw/sensorfw.pro @@ -2,6 +2,7 @@ TARGET = qtsensors_sensorfw QT = core sensors network dbus PLUGIN_TYPE = sensors +PLUGIN_CLASS_NAME = sensorfwSensorPlugin load(qt_plugin) include(sensorfw.pri) diff --git a/src/plugins/sensors/simulator/simulator.pro b/src/plugins/sensors/simulator/simulator.pro index 2c1d933f..b110137b 100644 --- a/src/plugins/sensors/simulator/simulator.pro +++ b/src/plugins/sensors/simulator/simulator.pro @@ -1,6 +1,7 @@ TARGET = qtsensors_simulator PLUGIN_TYPE = sensors +PLUGIN_CLASS_NAME = SimulatorSensorPlugin load(qt_plugin) QT=core gui network sensors simulator diff --git a/src/plugins/sensors/winrt/winrt.pro b/src/plugins/sensors/winrt/winrt.pro index 494e1bf0..e9f3274f 100644 --- a/src/plugins/sensors/winrt/winrt.pro +++ b/src/plugins/sensors/winrt/winrt.pro @@ -2,6 +2,7 @@ TARGET = qtsensors_winrt QT = sensors core PLUGIN_TYPE = sensors +PLUGIN_CLASS_NAME = WinRtSensorPlugin load(qt_plugin) HEADERS += \ diff --git a/tests/auto/qsensorgestures/plugins/test1/test1.pro b/tests/auto/qsensorgestures/plugins/test1/test1.pro index e0dab443..f35af0d0 100644 --- a/tests/auto/qsensorgestures/plugins/test1/test1.pro +++ b/tests/auto/qsensorgestures/plugins/test1/test1.pro @@ -3,6 +3,8 @@ TARGET = qtsensorgestures_testplugin1 QT += sensors sensorgestures PLUGIN_TYPE = sensorgestures +PLUGIN_CLASS_NAME = QTestSensorGestureDupPlugin +PLUGIN_EXTENDS = - load(qt_plugin) # Input -- cgit v1.2.3 From e60743e095b8bb7fcc3f0de823d2a46aa68343d3 Mon Sep 17 00:00:00 2001 From: Andrew Inwood Date: Tue, 1 Apr 2014 13:40:08 -0400 Subject: Android, Fix generic access to QAccelerometer Generic access to QAccelerometer through QSensor was broken by my previous change: 971fc95eca1d9db93aa4bdb75793dfe83e4a97db When using a QSensor* to access the accelerometer, the qobject_cast would fail, and return 0. I fix this by defaulting the accelerationMode to Combined when a QSensor* is used. Change-Id: If8389808a416807b72709a13ca315aa23bbf94a0 Reviewed-by: Bernd Weimer Reviewed-by: Fabian Bumberger Reviewed-by: Lorn Potter --- src/plugins/sensors/android/src/androidaccelerometer.cpp | 2 +- src/plugins/sensors/android/src/main.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/sensors/android/src/androidaccelerometer.cpp b/src/plugins/sensors/android/src/androidaccelerometer.cpp index 5a42d0cb..76aa0278 100644 --- a/src/plugins/sensors/android/src/androidaccelerometer.cpp +++ b/src/plugins/sensors/android/src/androidaccelerometer.cpp @@ -89,8 +89,8 @@ AndroidSensors::AndroidSensorType AndroidAccelerometer::modeToSensor(QAccelerome case QAccelerometer::User: type = AndroidSensors::TYPE_LINEAR_ACCELERATION; break; - default: case QAccelerometer::Combined: + default: type = AndroidSensors::TYPE_ACCELEROMETER; break; } diff --git a/src/plugins/sensors/android/src/main.cpp b/src/plugins/sensors/android/src/main.cpp index 3326208b..3d8604fe 100644 --- a/src/plugins/sensors/android/src/main.cpp +++ b/src/plugins/sensors/android/src/main.cpp @@ -112,10 +112,11 @@ public: { AndroidSensorType type = static_cast(sensor->identifier().toInt()); switch (type) { - case TYPE_ACCELEROMETER: - { + case TYPE_ACCELEROMETER: { QAccelerometer * const accelerometer = qobject_cast(sensor); - AndroidSensors::AndroidSensorType type = AndroidAccelerometer::modeToSensor(accelerometer->accelerationMode()); + AndroidSensors::AndroidSensorType type + = accelerometer ? AndroidAccelerometer::modeToSensor(accelerometer->accelerationMode()) + : AndroidSensors::TYPE_ACCELEROMETER; return new AndroidAccelerometer(type, sensor); } case TYPE_AMBIENT_TEMPERATURE: -- cgit v1.2.3