From 45c8ae3232df8955644697ee88c4321f26bb5cf2 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Wed, 6 Jan 2021 07:30:03 +1000 Subject: QtSensors initial cmake support This commit introduces the bare minimum cmake support that should unblock the CI and allow further verification and development on most platforms: macOS, Linux, Win, iOS and Android. Some clarifications: * The support for sensorfw backend is very preliminary and can be enabled later if needed (no Qt6 version of the sensorfw). * The simulator backend is dropped as obsolete / unnecessary. * Three examples are currently commented out and shall be ported with a later commit. Task-number: QTBUG-92502 Change-Id: Id523d43ed3ef177010dc73afc5812ed374cff0dd Reviewed-by: Alexandru Croitor --- .cmake.conf | 1 + .gitignore | 366 +++++++++++++++++---- CMakeLists.txt | 18 + cmake/FindSensorfw.cmake | 10 + coin/module_config.yaml | 12 + configure.cmake | 21 ++ dependencies.yaml | 6 +- examples/CMakeLists.txt | 5 + examples/sensors/CMakeLists.txt | 20 ++ examples/sensors/accelbubble/CMakeLists.txt | 52 +++ examples/sensors/grue/CMakeLists.txt | 56 ++++ examples/sensors/grue/console_app/CMakeLists.txt | 36 ++ examples/sensors/grue/import/import.pro | 1 + examples/sensors/grue/lib/CMakeLists.txt | 38 +++ examples/sensors/grue/plugin/CMakeLists.txt | 56 ++++ examples/sensors/maze/CMakeLists.txt | 65 ++++ examples/sensors/qmlqtsensors/CMakeLists.txt | 54 +++ examples/sensors/qmlsensorgestures/CMakeLists.txt | 51 +++ .../qmlsensorgestures/plugin/CMakeLists.txt | 38 +++ examples/sensors/sensor_explorer/CMakeLists.txt | 54 +++ examples/sensors/sensor_explorer/import/import.pro | 1 + examples/sensors/sensorgestures/CMakeLists.txt | 37 +++ examples/sensors/shakeit/CMakeLists.txt | 53 +++ qt_cmdline.cmake | 1 + qtsensors.pro | 3 - src/CMakeLists.txt | 5 + src/imports/CMakeLists.txt | 2 + src/imports/imports.pro | 4 - src/imports/sensors/CMakeLists.txt | 42 +++ src/imports/sensors/sensors.pro | 56 ---- src/plugins/CMakeLists.txt | 2 + src/plugins/plugins.pro | 3 - src/plugins/sensorgestures/CMakeLists.txt | 2 + .../sensorgestures/qtsensors/CMakeLists.txt | 29 ++ src/plugins/sensorgestures/qtsensors/qtsensors.pro | 37 --- src/plugins/sensorgestures/sensorgestures.pro | 2 - src/plugins/sensorgestures/shake/CMakeLists.txt | 19 ++ src/plugins/sensorgestures/shake/shake.pro | 16 - src/plugins/sensors/CMakeLists.txt | 39 +++ src/plugins/sensors/android/CMakeLists.txt | 32 ++ src/plugins/sensors/android/android.pro | 41 --- src/plugins/sensors/dummy/CMakeLists.txt | 27 ++ src/plugins/sensors/dummy/dummy.pro | 19 -- src/plugins/sensors/generic/CMakeLists.txt | 33 ++ src/plugins/sensors/generic/generic.pro | 29 -- .../sensors/iio-sensor-proxy/CMakeLists.txt | 41 +++ .../sensors/iio-sensor-proxy/iio-sensor-proxy.pro | 31 -- src/plugins/sensors/ios/CMakeLists.txt | 50 +++ src/plugins/sensors/ios/ios.pro | 49 --- src/plugins/sensors/linux/CMakeLists.txt | 25 ++ src/plugins/sensors/linux/linux.pro | 13 - src/plugins/sensors/sensorfw/CMakeLists.txt | 36 ++ src/plugins/sensors/sensorfw/sensorfw.pro | 16 - src/plugins/sensors/sensorfw/sensorfwsensorbase.h | 2 +- src/plugins/sensors/sensors.pro | 45 --- src/plugins/sensors/sensortag/CMakeLists.txt | 26 ++ src/plugins/sensors/sensortag/sensortag.pro | 11 - src/plugins/sensors/simulator/main.cpp | 143 -------- src/plugins/sensors/simulator/plugin.json | 1 - .../sensors/simulator/qsensordata_simulator.cpp | 143 -------- .../sensors/simulator/qsensordata_simulator_p.h | 128 ------- src/plugins/sensors/simulator/simulator.pro | 32 -- .../sensors/simulator/simulatoraccelerometer.cpp | 71 ---- .../sensors/simulator/simulatoraccelerometer.h | 59 ---- .../simulator/simulatorambientlightsensor.cpp | 89 ----- .../simulator/simulatorambientlightsensor.h | 59 ---- src/plugins/sensors/simulator/simulatorcommon.cpp | 252 -------------- src/plugins/sensors/simulator/simulatorcommon.h | 105 ------ src/plugins/sensors/simulator/simulatorcompass.cpp | 69 ---- src/plugins/sensors/simulator/simulatorcompass.h | 59 ---- .../simulator/simulatorirproximitysensor.cpp | 67 ---- .../sensors/simulator/simulatorirproximitysensor.h | 59 ---- .../sensors/simulator/simulatorlightsensor.cpp | 67 ---- .../sensors/simulator/simulatorlightsensor.h | 59 ---- .../sensors/simulator/simulatormagnetometer.cpp | 73 ---- .../sensors/simulator/simulatormagnetometer.h | 59 ---- .../sensors/simulator/simulatorproximitysensor.cpp | 67 ---- .../sensors/simulator/simulatorproximitysensor.h | 59 ---- src/plugins/sensors/winrt/CMakeLists.txt | 26 ++ src/plugins/sensors/winrt/winrt.pro | 29 -- src/sensors/CMakeLists.txt | 108 ++++++ src/sensors/configure.cmake | 38 +++ .../doc/snippets/sensorgestures/CMakeLists.txt | 28 ++ .../doc/snippets/sensorgestures/sensorgestures.pro | 8 - src/sensors/doc/snippets/sensors/CMakeLists.txt | 28 ++ src/sensors/doc/snippets/sensors/sensors.pro | 10 - src/sensors/doc/snippets/snippets.pro | 5 - .../gestures/qsensorgesturemanagerprivate.cpp | 59 ---- .../gestures/qsensorgesturemanagerprivate_p.h | 14 - src/sensors/gestures/qsensorgesturerecognizer.cpp | 17 +- src/sensors/gestures/simulatorgesturescommon.cpp | 121 ------- src/sensors/gestures/simulatorgesturescommon_p.h | 92 ------ src/sensors/qsensor.cpp | 5 +- src/sensors/qt_cmdline.cmake | 0 src/sensors/sensors.pro | 87 ----- src/src.pro | 18 - tests/CMakeLists.txt | 6 + tests/auto/CMakeLists.txt | 10 + tests/auto/auto.pro | 14 - tests/auto/cmake/CMakeLists.txt | 45 ++- tests/auto/cmake/cmake.pro | 7 - tests/auto/legacy_sensors/CMakeLists.txt | 16 + tests/auto/legacy_sensors/legacy_sensors.pro | 15 - tests/auto/qsensor/CMakeLists.txt | 19 ++ tests/auto/qsensor/qsensor.pro | 27 -- tests/auto/qsensorgestureplugins/CMakeLists.txt | 14 + .../qsensorgestureplugins.pro | 17 - tests/auto/qsensorgestures/CMakeLists.txt | 18 + .../qsensorgestures/plugins/test1/CMakeLists.txt | 21 ++ tests/auto/qsensorgestures/plugins/test1/test1.pro | 18 - tests/auto/qsensorgestures/qsensorgestures.pro | 34 -- tests/auto/qsensorgestures_gestures/CMakeLists.txt | 19 ++ .../qsensorgestures_gestures.pro | 21 -- tests/auto/qtsensors5/qtsensors5.pro | 6 - tests/auto/qtsensors5/tst_qtsensors5.cpp | 54 --- tests/auto/sensors2qmlapi/CMakeLists.txt | 17 + tests/auto/sensors2qmlapi/sensors2qmlapi.pro | 20 -- tests/manual/sensor_explorer/CMakeLists.txt | 15 + tests/manual/sensor_explorer/sensor_explorer.pro | 16 - tests/manual/sensorclerk/CMakeLists.txt | 14 + tests/manual/sensorclerk/sensorclerk.pro | 11 - tests/tests.pro | 3 - 122 files changed, 1828 insertions(+), 2901 deletions(-) create mode 100644 .cmake.conf create mode 100644 CMakeLists.txt create mode 100644 cmake/FindSensorfw.cmake create mode 100644 coin/module_config.yaml create mode 100644 configure.cmake create mode 100644 examples/CMakeLists.txt create mode 100644 examples/sensors/CMakeLists.txt create mode 100644 examples/sensors/accelbubble/CMakeLists.txt create mode 100644 examples/sensors/grue/CMakeLists.txt create mode 100644 examples/sensors/grue/console_app/CMakeLists.txt create mode 100644 examples/sensors/grue/lib/CMakeLists.txt create mode 100644 examples/sensors/grue/plugin/CMakeLists.txt create mode 100644 examples/sensors/maze/CMakeLists.txt create mode 100644 examples/sensors/qmlqtsensors/CMakeLists.txt create mode 100644 examples/sensors/qmlsensorgestures/CMakeLists.txt create mode 100644 examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt create mode 100644 examples/sensors/sensor_explorer/CMakeLists.txt create mode 100644 examples/sensors/sensorgestures/CMakeLists.txt create mode 100644 examples/sensors/shakeit/CMakeLists.txt create mode 100644 qt_cmdline.cmake delete mode 100644 qtsensors.pro create mode 100644 src/CMakeLists.txt create mode 100644 src/imports/CMakeLists.txt delete mode 100644 src/imports/imports.pro create mode 100644 src/imports/sensors/CMakeLists.txt delete mode 100644 src/imports/sensors/sensors.pro create mode 100644 src/plugins/CMakeLists.txt delete mode 100644 src/plugins/plugins.pro create mode 100644 src/plugins/sensorgestures/CMakeLists.txt create mode 100644 src/plugins/sensorgestures/qtsensors/CMakeLists.txt delete mode 100644 src/plugins/sensorgestures/qtsensors/qtsensors.pro delete mode 100644 src/plugins/sensorgestures/sensorgestures.pro create mode 100644 src/plugins/sensorgestures/shake/CMakeLists.txt delete mode 100644 src/plugins/sensorgestures/shake/shake.pro create mode 100644 src/plugins/sensors/CMakeLists.txt create mode 100644 src/plugins/sensors/android/CMakeLists.txt delete mode 100644 src/plugins/sensors/android/android.pro create mode 100644 src/plugins/sensors/dummy/CMakeLists.txt delete mode 100644 src/plugins/sensors/dummy/dummy.pro create mode 100644 src/plugins/sensors/generic/CMakeLists.txt delete mode 100644 src/plugins/sensors/generic/generic.pro create mode 100644 src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt delete mode 100644 src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro create mode 100644 src/plugins/sensors/ios/CMakeLists.txt delete mode 100644 src/plugins/sensors/ios/ios.pro create mode 100644 src/plugins/sensors/linux/CMakeLists.txt delete mode 100644 src/plugins/sensors/linux/linux.pro create mode 100644 src/plugins/sensors/sensorfw/CMakeLists.txt delete mode 100644 src/plugins/sensors/sensorfw/sensorfw.pro delete mode 100644 src/plugins/sensors/sensors.pro create mode 100644 src/plugins/sensors/sensortag/CMakeLists.txt delete mode 100644 src/plugins/sensors/sensortag/sensortag.pro delete mode 100644 src/plugins/sensors/simulator/main.cpp delete mode 100644 src/plugins/sensors/simulator/plugin.json delete mode 100644 src/plugins/sensors/simulator/qsensordata_simulator.cpp delete mode 100644 src/plugins/sensors/simulator/qsensordata_simulator_p.h delete mode 100644 src/plugins/sensors/simulator/simulator.pro delete mode 100644 src/plugins/sensors/simulator/simulatoraccelerometer.cpp delete mode 100644 src/plugins/sensors/simulator/simulatoraccelerometer.h delete mode 100644 src/plugins/sensors/simulator/simulatorambientlightsensor.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorambientlightsensor.h delete mode 100644 src/plugins/sensors/simulator/simulatorcommon.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorcommon.h delete mode 100644 src/plugins/sensors/simulator/simulatorcompass.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorcompass.h delete mode 100644 src/plugins/sensors/simulator/simulatorirproximitysensor.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorirproximitysensor.h delete mode 100644 src/plugins/sensors/simulator/simulatorlightsensor.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorlightsensor.h delete mode 100644 src/plugins/sensors/simulator/simulatormagnetometer.cpp delete mode 100644 src/plugins/sensors/simulator/simulatormagnetometer.h delete mode 100644 src/plugins/sensors/simulator/simulatorproximitysensor.cpp delete mode 100644 src/plugins/sensors/simulator/simulatorproximitysensor.h create mode 100644 src/plugins/sensors/winrt/CMakeLists.txt delete mode 100644 src/plugins/sensors/winrt/winrt.pro create mode 100644 src/sensors/CMakeLists.txt create mode 100644 src/sensors/configure.cmake create mode 100644 src/sensors/doc/snippets/sensorgestures/CMakeLists.txt delete mode 100644 src/sensors/doc/snippets/sensorgestures/sensorgestures.pro create mode 100644 src/sensors/doc/snippets/sensors/CMakeLists.txt delete mode 100644 src/sensors/doc/snippets/sensors/sensors.pro delete mode 100644 src/sensors/doc/snippets/snippets.pro delete mode 100644 src/sensors/gestures/simulatorgesturescommon.cpp delete mode 100644 src/sensors/gestures/simulatorgesturescommon_p.h create mode 100644 src/sensors/qt_cmdline.cmake delete mode 100644 src/sensors/sensors.pro delete mode 100644 src/src.pro create mode 100644 tests/CMakeLists.txt create mode 100644 tests/auto/CMakeLists.txt delete mode 100644 tests/auto/auto.pro delete mode 100644 tests/auto/cmake/cmake.pro create mode 100644 tests/auto/legacy_sensors/CMakeLists.txt delete mode 100644 tests/auto/legacy_sensors/legacy_sensors.pro create mode 100644 tests/auto/qsensor/CMakeLists.txt delete mode 100644 tests/auto/qsensor/qsensor.pro create mode 100644 tests/auto/qsensorgestureplugins/CMakeLists.txt delete mode 100644 tests/auto/qsensorgestureplugins/qsensorgestureplugins.pro create mode 100644 tests/auto/qsensorgestures/CMakeLists.txt create mode 100644 tests/auto/qsensorgestures/plugins/test1/CMakeLists.txt delete mode 100644 tests/auto/qsensorgestures/plugins/test1/test1.pro delete mode 100644 tests/auto/qsensorgestures/qsensorgestures.pro create mode 100644 tests/auto/qsensorgestures_gestures/CMakeLists.txt delete mode 100644 tests/auto/qsensorgestures_gestures/qsensorgestures_gestures.pro delete mode 100644 tests/auto/qtsensors5/qtsensors5.pro delete mode 100644 tests/auto/qtsensors5/tst_qtsensors5.cpp create mode 100644 tests/auto/sensors2qmlapi/CMakeLists.txt delete mode 100644 tests/auto/sensors2qmlapi/sensors2qmlapi.pro create mode 100644 tests/manual/sensor_explorer/CMakeLists.txt delete mode 100644 tests/manual/sensor_explorer/sensor_explorer.pro create mode 100644 tests/manual/sensorclerk/CMakeLists.txt delete mode 100644 tests/manual/sensorclerk/sensorclerk.pro delete mode 100644 tests/tests.pro diff --git a/.cmake.conf b/.cmake.conf new file mode 100644 index 00000000..4e73b3d6 --- /dev/null +++ b/.cmake.conf @@ -0,0 +1 @@ +set(QT_REPO_MODULE_VERSION "6.2.0") diff --git a/.gitignore b/.gitignore index 66a88065..e9ac2309 100644 --- a/.gitignore +++ b/.gitignore @@ -1,51 +1,256 @@ # This file is used to ignore files which are generated in the Qt build system # ---------------------------------------------------------------------------- +# Specific files/paths + +# qmake/configure stuff +#/.qmake.cache +#/.qmake.stash +/config.tests/*/*/* +!/config.tests/*/*/*[.]* +/config.tests/.qmake.cache +/config.tests/.qmake.stash +/config.tests/arch/arch +/config.tests/conftest-out +/config.tests/conftest.cpp +/config.opt +/config.status* +/config.summary +/config.log +/config.cache +/mkspecs/modules/qt_*.pri +/mkspecs/modules-inst/ +/mkspecs/qconfig.pri +/mkspecs/qdevice.pri +/mkspecs/qmodule.pri +/src/corelib/global/qconfig.cpp +/src/corelib/global/qconfig.h +/src/corelib/global/qconfig_p.h +/src/gui/vulkan/qvulkanfunctions.h +/src/gui/vulkan/qvulkanfunctions_p.cpp +/src/gui/vulkan/qvulkanfunctions_p.h +/bin/qt.conf +/bin/qmake +/bin/qvkgen +/qmake/qmake +qt*-config.h +qt*-config_p.h +qt*-config.pri +*.pyc +.mypy_cache + +/include/ + +/lib/* +!/lib/README +/plugins/ + +/qml/ + +/doc/*.qch +/doc/activeqt +/doc/qdoc +/doc/qmake +/doc/qt*/* + +# FIXME: Ignore these again? +# /examples/*/*/* +# !/examples/*/*/*[.]* +# !/examples/*/*/README +# !/examples/*/doc/* +# !/examples/*/doc/*/* + +/translations/*.qm +/translations/*_en.ts +/translations/*_untranslated.ts + +# This includes binaries from other modules because of non-prefix builds. +/bin/assistant +/bin/designer +/bin/dumpcpp +/bin/dumpdoc +/bin/idc +/bin/kmap2qmap +/bin/lconvert +/bin/linguist +/bin/lrelease +/bin/lupdate +/bin/moc +/bin/patternist +/bin/phonon +/bin/pixeltool +/bin/qcollectiongenerator +/bin/qdbus +/bin/qdbuscpp2xml +/bin/qdbusviewer +/bin/qdbusxml2cpp +/bin/qdoc +/bin/qev +/bin/qfloat16-tables +/bin/qglinfo +/bin/qgltf +/bin/qhelpconverter +/bin/qhelpgenerator +/bin/qlalr +/bin/qml +/bin/qmleasing +/bin/qmlimportscanner +/bin/qmljs +/bin/qmllint +/bin/qmlmin +/bin/qmlplugindump +/bin/qmlprofiler +/bin/qmlscene +/bin/qmltestrunner +/bin/qtattributionsscanner +/bin/qtdiag +/bin/qtpaths +/bin/qtplugininfo +/bin/rcc +/bin/servicefw +/bin/sfwlisten +/bin/uic +/bin/xmlpatterns +/bin/xmlpatternsvalidator + +# Unit tests libs/plugins/data +/tests/auto/cmake/build/ +/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/mime/ +/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/mime/ +/tests/auto/corelib/plugin/qlibrary/libmylib.so2 +/tests/auto/corelib/plugin/qlibrary/mylib.dl2 +/tests/auto/qlibrary/libmylib.so* +/tests/auto/qmake/testdata/quotedfilenames/test.cpp +/tests/auto/qprocess/fileWriterProcess.txt + +# Unit tests executables (other than those named tst_*) +/tests/auto/corelib/global/qlogging/app/app +/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper +/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication +/tests/auto/corelib/io/qprocess/testForwarding/testForwarding +/tests/auto/corelib/io/qprocess/testProcessHang/testProcessHang +/tests/auto/corelib/io/qresourceengine/qresourceengine +/tests/auto/corelib/kernel/qsharedmemory/helperbinary +/tests/auto/corelib/kernel/qsystemsemaphore/helperbinary +/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness +/tests/auto/corelib/thread/qthreadstorage/crashOnExit +/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit +/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper +/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver +/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger +/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver +/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal +/tests/auto/gui/kernel/qguivariant/no_application/no_application +/tests/auto/network/socket/qlocalsocket/socketprocess/socketprocess +/tests/auto/other/qobjectrace/qobjectrace +/tests/auto/other/qprocess_and_guieventloop/write-read-write/write-read-write +/tests/auto/testlib/selftests/assert/assert +/tests/auto/testlib/selftests/badxml/badxml +/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind +/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting +/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter +/tests/auto/testlib/selftests/benchliboptions/benchliboptions +/tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter +/tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime +/tests/auto/testlib/selftests/blacklisted/blacklisted +/tests/auto/testlib/selftests/cmptest/cmptest +/tests/auto/testlib/selftests/commandlinedata/commandlinedata +/tests/auto/testlib/selftests/counting/counting +/tests/auto/testlib/selftests/crashes/crashes +/tests/auto/testlib/selftests/datatable/datatable +/tests/auto/testlib/selftests/datetime/datetime +/tests/auto/testlib/selftests/differentexec/differentexec +/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow +/tests/auto/testlib/selftests/expectfail/expectfail +/tests/auto/testlib/selftests/failcleanup/failcleanup +/tests/auto/testlib/selftests/failinit/failinit +/tests/auto/testlib/selftests/failinitdata/failinitdata +/tests/auto/testlib/selftests/fetchbogus/fetchbogus +/tests/auto/testlib/selftests/findtestdata/findtestdata +/tests/auto/testlib/selftests/float/float +/tests/auto/testlib/selftests/globaldata/globaldata +/tests/auto/testlib/selftests/longstring/longstring +/tests/auto/testlib/selftests/maxwarnings/maxwarnings +/tests/auto/testlib/selftests/multiexec/multiexec +/tests/auto/testlib/selftests/printdatatags/printdatatags +/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags +/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist +/tests/auto/testlib/selftests/silent/silent +/tests/auto/testlib/selftests/singleskip/singleskip +/tests/auto/testlib/selftests/skip/skip +/tests/auto/testlib/selftests/skipcleanup/skipcleanup +/tests/auto/testlib/selftests/skipglobal/skipglobal +/tests/auto/testlib/selftests/skipinit/skipinit +/tests/auto/testlib/selftests/skipinitdata/skipinitdata +/tests/auto/testlib/selftests/sleep/sleep +/tests/auto/testlib/selftests/strcmp/strcmp +/tests/auto/testlib/selftests/subtest/subtest +/tests/auto/testlib/selftests/verbose1/verbose1 +/tests/auto/testlib/selftests/verbose2/verbose2 +/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown +/tests/auto/testlib/selftests/waitwithoutgui/waitwithoutgui +/tests/auto/testlib/selftests/warnings/warnings +/tests/auto/testlib/selftests/xunit/xunit +/tests/auto/widgets/kernel/qapplication/modal/modal + +QObject.log +tst_* +!tst_*.* +tst_*.log +tst_*.debug +tst_*~ + +# Generic directories +.metadata/ +.pc/ +debug/ +release/ +tmp/ +tmp-debug/ +tmp-debug-shared/ +tmp-release/ +tmp-release-shared/ +qtc-qmldump/ +qtc-qmldbg/ +*.app/ +*.d/ + +# Generic files +.#* +.com.apple.timemachine.supported +.DS_Store +callgrind.out.* +core +Makefile* +!/qmake/Makefile.win32* +!/qmake/Makefile.unix +pcviewer.cfg +tags *~ *.a *.la *.core -*.moc +*.dll +*.exe +*.dylib +*.gcov +*.gcda +*.gcno +*.lib +!Info.plist.lib *.o *.obj *.orig *.swp *.rej *.so +*.so.* *.pbxuser *.mode1 *.mode1v3 -*_pch.h.cpp *_resource.rc -.#* *.*# -core -.qmake.cache -.qmake.vars -config.log -*.prl -tags -.DS_Store *.debug -Makefile* -*.app -*.pro.user -*.qmlproject.user -*.gcov -moc_*.cpp -ui_*.h -qrc_*.cpp - -# Test generated files -QObject.log -tst_* -!tst_*.* -tst_*.log -tst_*.moc -tst_*.o -tst_*.debug -tst_*~ -tests/auto/cmake/build # xemacs temporary files *.flc @@ -60,50 +265,69 @@ tests/auto/cmake/build *.pdb *.sln *.suo -*.vcproj -*vcproj.*.*.user *.ncb *.vcxproj *.vcxproj.filters *.vcxproj.user -*.exe -*.manifest -*.res - -# MinGW generated files -*.Debug -*.Release - -# Generated documentation -doc/src/snippets/sensorgestures/sensorgesturessdocsnippet -doc/src/snippets/sensors/sensorsdocsnippet - -# Generated example binaries -examples/sensors/accel/accel -examples/sensors/accelbubble/accelbubble -examples/sensors/grue/console_app/detect_grue -examples/sensors/grue/grue -examples/sensors/grue/lib/*gruesensor* -examples/sensors/maze/maze -examples/sensors/qmlqtsensors/qmlqtsensors -examples/sensors/qmlsensorgestures/qmlsensorgestures -examples/sensors/sensor_explorer/sensor_explorer -examples/sensors/sensorgestures/gesture -examples/sensors/shakeit/shakeit - -# Generated config test binaries -config.tests/bbsensor_compass/bbsensor_compass -config.tests/bbsensor_header/bbsensor_header -config.tests/bbsensor_holster/bbsensor_holster - -# Directories to ignore -# --------------------- - -include -mkspecs -doc/qtsensors - -# These shouldn't even be in the source directory! -src/sensors/qtsensorsversion.h -src/qtmsensors/qtmsensorsversion.h +*.exe.embed.manifest +*.exe_manifest.rc +*.exe_manifest.res + +# Visual Studio Code generated files +.vscode + +# CLion generated files +.idea + +# Qt Creator generated files +*.pro.user* +*.qmlproject.user* +CMakeLists.txt.user* + +# INTEGRITY generated files +*.ael +*.dla +*.dnm +*.dep +*.map + +# Precompiled headers +*.gch +*.pchi +*.pchi.cpp +*_pch.obj +*_pch.pch + +# Qt-specific files +codeattributions.qdoc +moc_*.cpp +qrc_*.cpp +ui_*.h +*.moc +*.prl +*.rcc + +# Generated by qt_module.prf +*.version +*.version.in + +# Generated by qtPrepareTool() +wrapper.sh +wrapper.bat +*_wrapper.sh +*_wrapper.bat + +# Generated by dbusxml2cpp +*_interface.* +*_adaptor.* + +# Generated by qt.prf +*_plugin_import.cpp +# cmake related artifacts +/build* +CMakeFiles +CTestTestfile.cmake +cmake_install.cmake +*_autogen +tst_*.xml diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..13f1bb9d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,18 @@ + +cmake_minimum_required(VERSION 3.16.0) + +include(.cmake.conf) + +project(QtSensors + VERSION "${QT_REPO_MODULE_VERSION}" + DESCRIPTION "Qt Sensors Libraries" + HOMEPAGE_URL "https://qt.io/" + LANGUAGES CXX C +) + +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) +find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS + Xml Gui Widgets Quick Qml Svg DBus Multimedia +) + +qt_build_repo() diff --git a/cmake/FindSensorfw.cmake b/cmake/FindSensorfw.cmake new file mode 100644 index 00000000..6b7ee507 --- /dev/null +++ b/cmake/FindSensorfw.cmake @@ -0,0 +1,10 @@ +find_package(PkgConfig) +if (PKG_CONFIG_FOUND) + pkg_check_modules(Sensorfw sensord-qt5 IMPORTED_TARGET) + if (NOT TARGET PkgConfig::Sensorfw) + set(Sensorfw_FOUND 0) + endif() +else() + message("Sensorfw pkg not found. Looking for library") + find_library(sensorfw) +endif() diff --git a/coin/module_config.yaml b/coin/module_config.yaml new file mode 100644 index 00000000..16d158c6 --- /dev/null +++ b/coin/module_config.yaml @@ -0,0 +1,12 @@ +version: 2 +accept_configuration: + condition: property + property: features + not_contains_value: Disable + +instructions: + Build: + - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml" + + Test: + - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml" diff --git a/configure.cmake b/configure.cmake new file mode 100644 index 00000000..53e3f110 --- /dev/null +++ b/configure.cmake @@ -0,0 +1,21 @@ + + +#### Inputs + + + +#### Libraries + + + +#### Tests + + + +#### Features + + +qt_extra_definition("QT_VERSION_STR" "\"${PROJECT_VERSION}\"" PUBLIC) +qt_extra_definition("QT_VERSION_MAJOR" ${PROJECT_VERSION_MAJOR} PUBLIC) +qt_extra_definition("QT_VERSION_MINOR" ${PROJECT_VERSION_MINOR} PUBLIC) +qt_extra_definition("QT_VERSION_PATCH" ${PROJECT_VERSION_PATCH} PUBLIC) diff --git a/dependencies.yaml b/dependencies.yaml index 3da704be..ec09dbfd 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,7 +1,7 @@ dependencies: ../qtbase: - ref: 089d54f06ff327f5212cb08fdbcb540066357dd5 + ref: aa84de1afa78cf4b63239b35a4b65f1c9c4eab6c required: true ../qtdeclarative: - ref: 406f15ce0e2707452462ff73b2d660ece960623f - required: false + ref: 4683e7977fa1d5fe9c8c59d58d74ee47c110c800 + required: true diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 00000000..b2d7229c --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,5 @@ +qt_examples_build_begin() + +add_subdirectory(sensors) + +qt_examples_build_end() diff --git a/examples/sensors/CMakeLists.txt b/examples/sensors/CMakeLists.txt new file mode 100644 index 00000000..8112bf57 --- /dev/null +++ b/examples/sensors/CMakeLists.txt @@ -0,0 +1,20 @@ +# TODO Qt 6.2 enable grue example, requires work +# add_subdirectory(grue) + +if(TARGET Qt::Quick) + add_subdirectory(maze) + # TODO Qt 6.2 enable qmlsensorgestures, requires work + # add_subdirectory(qmlsensorgestures) + add_subdirectory(qmlqtsensors) + # TODO Qt 6.2 enable sensor_explorer, requires work + # add_subdirectory(sensor_explorer) + if (TARGET Qt::Multimedia) + add_subdirectory(shakeit) + endif() + if(TARGET Qt::Svg) + add_subdirectory(accelbubble) + endif() +endif() +if(TARGET Qt::Widgets) + add_subdirectory(sensorgestures) +endif() diff --git a/examples/sensors/accelbubble/CMakeLists.txt b/examples/sensors/accelbubble/CMakeLists.txt new file mode 100644 index 00000000..8d752931 --- /dev/null +++ b/examples/sensors/accelbubble/CMakeLists.txt @@ -0,0 +1,52 @@ +cmake_minimum_required(VERSION 3.14) +project(accelbubble LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/accelbubble") + +find_package(Qt6 COMPONENTS Core Gui Quick Sensors Svg Xml) + +qt_add_executable(accelbubble + main.cpp +) +set_target_properties(accelbubble PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(accelbubble PUBLIC + Qt::Core + Qt::Gui + Qt::Quick + Qt::Sensors + Qt::Svg + Qt::Xml +) + + +# Resources: +set(accelbubble_resource_files + "accelbubble.qml" + "content/Bluebubble.svg" +) + +qt6_add_resources(accelbubble "accelbubble" + PREFIX + "/" + FILES + ${accelbubble_resource_files} +) + +install(TARGETS accelbubble + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/grue/CMakeLists.txt b/examples/sensors/grue/CMakeLists.txt new file mode 100644 index 00000000..043330d3 --- /dev/null +++ b/examples/sensors/grue/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.14) +project(grue_app LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/grue") + +find_package(Qt6 COMPONENTS Quick) + +qt_add_executable(grue_app + main.cpp +) +set_target_properties(grue_app PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) + +if(TARGET Qt::Quick) + target_link_libraries(grue_app PUBLIC + Qt::Quick + ) +endif() + +# Resources: +set(qml_resource_files + "grue.png" + "grue.qml" +) + +qt6_add_resources(grue_app "qml" + PREFIX + "/" + FILES + ${qml_resource_files} +) + +install(TARGETS grue_app + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +add_subdirectory(lib) +add_subdirectory(plugin) +add_subdirectory(console_app) +if(TARGET Qt::Quick) + add_subdirectory(import) +endif() diff --git a/examples/sensors/grue/console_app/CMakeLists.txt b/examples/sensors/grue/console_app/CMakeLists.txt new file mode 100644 index 00000000..e6364e48 --- /dev/null +++ b/examples/sensors/grue/console_app/CMakeLists.txt @@ -0,0 +1,36 @@ +# Generated from console_app.pro. + +cmake_minimum_required(VERSION 3.14) +project(detect_grue LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/grue") + +find_package(Qt6 COMPONENTS Core Sensors) + +qt_add_executable(detect_grue + main.cpp +) +set_target_properties(detect_grue PROPERTIES + WIN32_EXECUTABLE FALSE + MACOSX_BUNDLE FALSE +) +target_link_libraries(detect_grue PUBLIC + Qt::Core + Qt::Sensors +) + +install(TARGETS detect_grue + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/grue/import/import.pro b/examples/sensors/grue/import/import.pro index 17d7713e..f9d5108d 100644 --- a/examples/sensors/grue/import/import.pro +++ b/examples/sensors/grue/import/import.pro @@ -1,5 +1,6 @@ TEMPLATE = lib CONFIG += plugin +QML_IMPORT_VERSION = $$QT_VERSION TARGET = $$qtLibraryTarget(declarative_grue) diff --git a/examples/sensors/grue/lib/CMakeLists.txt b/examples/sensors/grue/lib/CMakeLists.txt new file mode 100644 index 00000000..264ffd32 --- /dev/null +++ b/examples/sensors/grue/lib/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.14) +project(gruesensor LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/grue") + +find_package(Qt6 COMPONENTS Core Sensors) + +qt_add_executable(gruesensor + gruesensor.cpp gruesensor.h gruesensor_p.h +) +set_target_properties(gruesensor PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_compile_definitions(gruesensor PUBLIC + QT_BUILD_GRUE_LIB +) + +target_link_libraries(gruesensor PUBLIC + Qt::Core + Qt::Sensors +) + +install(TARGETS gruesensor + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/grue/plugin/CMakeLists.txt b/examples/sensors/grue/plugin/CMakeLists.txt new file mode 100644 index 00000000..d55cc2dc --- /dev/null +++ b/examples/sensors/grue/plugin/CMakeLists.txt @@ -0,0 +1,56 @@ +# Generated from plugin.pro. + +cmake_minimum_required(VERSION 3.14) +project(qtsensors_grue LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/grue/sensors") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Sensors) + +qt_add_plugin(qtsensors_grue) +target_sources(qtsensors_grue PRIVATE + gruesensorimpl.cpp gruesensorimpl.h + main.cpp +) +set_target_properties(qtsensors_grue PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_include_directories(qtsensors_grue PUBLIC + ../lib +) + +target_link_libraries(qtsensors_grue PUBLIC + Qt::Core + Qt::Sensors + gruesensor +) + +if(MACOS) + target_link_libraries(qtsensors_grue PUBLIC + # Remove: L${CMAKE_CURRENT_BINARY_DIR}/../grue_app.app/Contents/Frameworks + ) +endif() + +if(NOT MACOS) + target_link_libraries(qtsensors_grue PUBLIC + # Remove: L${CMAKE_CURRENT_BINARY_DIR}/.. + ) +endif() + +install(TARGETS qtsensors_grue + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/maze/CMakeLists.txt b/examples/sensors/maze/CMakeLists.txt new file mode 100644 index 00000000..a2c484ac --- /dev/null +++ b/examples/sensors/maze/CMakeLists.txt @@ -0,0 +1,65 @@ +cmake_minimum_required(VERSION 3.14) +project(maze LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/maze") + +find_package(Qt6 COMPONENTS Core Gui Quick Sensors) + +qt_add_executable(maze + main.cpp +) +set_target_properties(maze PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(maze PUBLIC + Qt::Core + Qt::Gui + Qt::Quick + Qt::Sensors +) + + +# Resources: +set(maze_resource_files + "Congratulation.qml" + "LabyrinthSquare.qml" + "Mouse.qml" + "components/ApplicationWindow.qml" + "components/Button.qml" + "components/images/button_background_disabled.png" + "components/images/button_background_normal.png" + "components/images/button_background_pressed.png" + "content/00.png" + "content/01.png" + "content/cheese.png" + "content/cheeseeating.gif" + "content/congratulations.gif" + "content/mouse_down.gif" + "content/start.png" + "lib.js" + "maze.qml" +) + +qt6_add_resources(maze "maze" + PREFIX + "/" + FILES + ${maze_resource_files} +) + +install(TARGETS maze + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/qmlqtsensors/CMakeLists.txt b/examples/sensors/qmlqtsensors/CMakeLists.txt new file mode 100644 index 00000000..ab743436 --- /dev/null +++ b/examples/sensors/qmlqtsensors/CMakeLists.txt @@ -0,0 +1,54 @@ +cmake_minimum_required(VERSION 3.14) +project(qmlqtsensors LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/qmlqtsensors") + +find_package(Qt6 COMPONENTS Core Gui Quick) + +qt_add_executable(qmlqtsensors + main.cpp +) +set_target_properties(qmlqtsensors PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(qmlqtsensors PUBLIC + Qt::Core + Qt::Gui + Qt::Quick +) + + +# Resources: +set(qmlqtsensors_resource_files + "components/ApplicationWindow.qml" + "components/Button.qml" + "components/Divider.qml" + "components/images/button_background_disabled.png" + "components/images/button_background_normal.png" + "components/images/button_background_pressed.png" + "qmlqtsensors.qml" +) + +qt6_add_resources(qmlqtsensors "qmlqtsensors" + PREFIX + "/" + FILES + ${qmlqtsensors_resource_files} +) + +install(TARGETS qmlqtsensors + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/qmlsensorgestures/CMakeLists.txt b/examples/sensors/qmlsensorgestures/CMakeLists.txt new file mode 100644 index 00000000..a3f01f0e --- /dev/null +++ b/examples/sensors/qmlsensorgestures/CMakeLists.txt @@ -0,0 +1,51 @@ +cmake_minimum_required(VERSION 3.14) +project(qmlsensorgestures LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/qmlsensorgestures") + +find_package(Qt6 COMPONENTS Quick) + +qt_add_executable(qmlsensorgestures + main.cpp +) +set_target_properties(qmlsensorgestures PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(qmlsensorgestures PUBLIC + Qt::Quick +) + + +# Resources: +set(qml_resource_files + "Button.qml" + "GestureList.qml" + "GestureView.qml" + "GesturesView.qml" + "qmlsensorgestures.qml" +) + +qt6_add_resources(qmlsensorgestures "qml" + PREFIX + "/" + FILES + ${qml_resource_files} +) + +install(TARGETS qmlsensorgestures + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) +add_subdirectory(plugin) diff --git a/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt b/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt new file mode 100644 index 00000000..c5831189 --- /dev/null +++ b/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.14) +project(qtsensorgestures_counterplugin LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Sensors) + +qt_add_executable(qtsensorgestures_counterplugin + qcountergestureplugin.cpp qcountergestureplugin.h + qcounterrecognizer.cpp qcounterrecognizer.h +) +set_target_properties(qtsensorgestures_counterplugin PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(qtsensorgestures_counterplugin PUBLIC + Qt::Core + Qt::Gui + Qt::Sensors +) + +install(TARGETS qtsensorgestures_counterplugin + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/sensor_explorer/CMakeLists.txt b/examples/sensors/sensor_explorer/CMakeLists.txt new file mode 100644 index 00000000..3440f79b --- /dev/null +++ b/examples/sensors/sensor_explorer/CMakeLists.txt @@ -0,0 +1,54 @@ +cmake_minimum_required(VERSION 3.14) +project(sensor_explorer LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/sensor_explorer") + +find_package(Qt6 COMPONENTS Qml Quick) + +qt_add_executable(sensor_explorer + main.cpp +) +set_target_properties(sensor_explorer PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(sensor_explorer PUBLIC + Qt::Qml + Qt::Quick +) + + +# Resources: +set(qml_resource_files + "sensor_explorer.qml" +) + +qt6_add_resources(sensor_explorer "qml" + PREFIX + "/" + FILES + ${qml_resource_files} +) + +if(TARGET Qt::Widgets) + target_link_libraries(sensor_explorer PUBLIC + Qt::Widgets + ) +endif() + +install(TARGETS sensor_explorer + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) +add_subdirectory(import) diff --git a/examples/sensors/sensor_explorer/import/import.pro b/examples/sensors/sensor_explorer/import/import.pro index 48509214..53bf224b 100644 --- a/examples/sensors/sensor_explorer/import/import.pro +++ b/examples/sensors/sensor_explorer/import/import.pro @@ -1,5 +1,6 @@ TEMPLATE = lib CONFIG += plugin +QML_IMPORT_VERSION = $$QT_VERSION TARGET = $$qtLibraryTarget(declarative_explorer) diff --git a/examples/sensors/sensorgestures/CMakeLists.txt b/examples/sensors/sensorgestures/CMakeLists.txt new file mode 100644 index 00000000..a80f70f9 --- /dev/null +++ b/examples/sensors/sensorgestures/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.14) +project(gesture LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/sensorgestures") + +find_package(Qt6 COMPONENTS Core Gui Sensors Widgets) + +qt_add_executable(gesture + main.cpp + mainwindow.cpp mainwindow.h mainwindow.ui +) +set_target_properties(gesture PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(gesture PUBLIC + Qt::Core + Qt::Gui + Qt::Sensors + Qt::Widgets +) + +install(TARGETS gesture + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/shakeit/CMakeLists.txt b/examples/sensors/shakeit/CMakeLists.txt new file mode 100644 index 00000000..aaacd2f1 --- /dev/null +++ b/examples/sensors/shakeit/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.14) +project(shakeit LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/shakeit") + +find_package(Qt6 COMPONENTS Core Gui Quick) + +qt_add_executable(shakeit + main.cpp +) +set_target_properties(shakeit PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(shakeit PUBLIC + Qt::Core + Qt::Gui + Qt::Quick +) + + +# Resources: +set(shakeit_resource_files + "audio/loopy2a_mono.wav" + "audio/phone.wav" + "content/triangle.png" + "content/triangle2.png" + "content/triangle3.png" + "shakeit.qml" +) + +qt6_add_resources(shakeit "shakeit" + PREFIX + "/" + FILES + ${shakeit_resource_files} +) + +install(TARGETS shakeit + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/qt_cmdline.cmake b/qt_cmdline.cmake new file mode 100644 index 00000000..0527bc84 --- /dev/null +++ b/qt_cmdline.cmake @@ -0,0 +1 @@ +qt_commandline_subconfig(src/sensors) diff --git a/qtsensors.pro b/qtsensors.pro deleted file mode 100644 index 2e29e906..00000000 --- a/qtsensors.pro +++ /dev/null @@ -1,3 +0,0 @@ -load(configure) - -load(qt_parts) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..9a363951 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(sensors) +add_subdirectory(plugins) +if(TARGET Qt::Quick) + add_subdirectory(imports) +endif() diff --git a/src/imports/CMakeLists.txt b/src/imports/CMakeLists.txt new file mode 100644 index 00000000..3fdc4441 --- /dev/null +++ b/src/imports/CMakeLists.txt @@ -0,0 +1,2 @@ + +add_subdirectory(sensors) diff --git a/src/imports/imports.pro b/src/imports/imports.pro deleted file mode 100644 index a68f6a5e..00000000 --- a/src/imports/imports.pro +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += sensors - diff --git a/src/imports/sensors/CMakeLists.txt b/src/imports/sensors/CMakeLists.txt new file mode 100644 index 00000000..87414bde --- /dev/null +++ b/src/imports/sensors/CMakeLists.txt @@ -0,0 +1,42 @@ + +# TODO Qt 6.2 split into separate QML library + plugin + +qt_internal_add_qml_module(sensors + URI "QtSensors" + VERSION "${CMAKE_PROJECT_VERSION}" + CLASSNAME QtSensorsDeclarativeModule + SKIP_TYPE_REGISTRATION + SOURCES + qmlaccelerometer.cpp qmlaccelerometer.h + qmlaltimeter.cpp qmlaltimeter.h + qmlambientlightsensor.cpp qmlambientlightsensor.h + qmlambienttemperaturesensor.cpp qmlambienttemperaturesensor.h + qmlcompass.cpp qmlcompass.h + qmldistancesensor.cpp qmldistancesensor.h + qmlgyroscope.cpp qmlgyroscope.h + qmlholstersensor.cpp qmlholstersensor.h + qmlhumiditysensor.cpp qmlhumiditysensor.h + qmlirproximitysensor.cpp qmlirproximitysensor.h + qmllidsensor.cpp qmllidsensor.h + qmllightsensor.cpp qmllightsensor.h + qmlmagnetometer.cpp qmlmagnetometer.h + qmlorientationsensor.cpp qmlorientationsensor.h + qmlpressuresensor.cpp qmlpressuresensor.h + qmlproximitysensor.cpp qmlproximitysensor.h + qmlrotationsensor.cpp qmlrotationsensor.h + qmlsensor.cpp qmlsensor.h + qmlsensorgesture.cpp qmlsensorgesture.h + qmlsensorglobal.cpp qmlsensorglobal.h + qmlsensorrange.cpp qmlsensorrange.h + qmltapsensor.cpp qmltapsensor.h + qmltiltsensor.cpp qmltiltsensor.h + sensors.cpp + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::Qml + Qt::Sensors + LIBRARIES + Qt::CorePrivate + Qt::SensorsPrivate +) diff --git a/src/imports/sensors/sensors.pro b/src/imports/sensors/sensors.pro deleted file mode 100644 index 7d15ec9f..00000000 --- a/src/imports/sensors/sensors.pro +++ /dev/null @@ -1,56 +0,0 @@ -QT += core-private qml sensors sensors-private - -HEADERS += \ - qmlsensor.h \ - qmlsensorrange.h \ - qmlaccelerometer.h \ - qmlaltimeter.h \ - qmlambientlightsensor.h \ - qmlambienttemperaturesensor.h \ - qmlcompass.h \ - qmldistancesensor.h \ - qmlgyroscope.h \ - qmlholstersensor.h \ - qmlirproximitysensor.h \ - qmllightsensor.h \ - qmlmagnetometer.h \ - qmlorientationsensor.h \ - qmlpressuresensor.h\ - qmlproximitysensor.h \ - qmltapsensor.h \ - qmlrotationsensor.h \ - qmlsensorglobal.h \ - qmltiltsensor.h \ - qmlsensorgesture.h \ - qmlhumiditysensor.h \ - qmllidsensor.h - -SOURCES += sensors.cpp \ - qmlsensor.cpp \ - qmlsensorrange.cpp \ - qmlaccelerometer.cpp \ - qmlaltimeter.cpp \ - qmlambientlightsensor.cpp \ - qmlambienttemperaturesensor.cpp \ - qmlcompass.cpp \ - qmldistancesensor.cpp \ - qmlgyroscope.cpp \ - qmlholstersensor.cpp \ - qmlirproximitysensor.cpp \ - qmllightsensor.cpp \ - qmlmagnetometer.cpp \ - qmlorientationsensor.cpp \ - qmlpressuresensor.cpp\ - qmlproximitysensor.cpp \ - qmltapsensor.cpp \ - qmlrotationsensor.cpp \ - qmlsensorglobal.cpp \ - qmltiltsensor.cpp \ - qmlsensorgesture.cpp \ - qmlhumiditysensor.cpp \ - qmllidsensor.cpp - -load(qml_plugin) - -OTHER_FILES += \ - plugin.json qmldir plugins.qmltypes diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt new file mode 100644 index 00000000..fdcb878d --- /dev/null +++ b/src/plugins/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(sensors) +add_subdirectory(sensorgestures) diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro deleted file mode 100644 index c8b9e6ab..00000000 --- a/src/plugins/plugins.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += sensors -SUBDIRS += sensorgestures diff --git a/src/plugins/sensorgestures/CMakeLists.txt b/src/plugins/sensorgestures/CMakeLists.txt new file mode 100644 index 00000000..07fbacc9 --- /dev/null +++ b/src/plugins/sensorgestures/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(shake) +add_subdirectory(qtsensors) diff --git a/src/plugins/sensorgestures/qtsensors/CMakeLists.txt b/src/plugins/sensorgestures/qtsensors/CMakeLists.txt new file mode 100644 index 00000000..16b76086 --- /dev/null +++ b/src/plugins/sensorgestures/qtsensors/CMakeLists.txt @@ -0,0 +1,29 @@ +##################################################################### +## QtSensorGesturePlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QtSensorGesturePlugin + OUTPUT_NAME qtsensorgestures_plugin + TYPE sensorgestures + DEFAULT_IF FALSE + SOURCES + qcoversensorgesturerecognizer.cpp qcoversensorgesturerecognizer.h + qdoubletapsensorgesturerecognizer.cpp qdoubletapsensorgesturerecognizer.h + qfreefallsensorgesturerecognizer.cpp qfreefallsensorgesturerecognizer.h + qhoversensorgesturerecognizer.cpp qhoversensorgesturerecognizer.h + qpickupsensorgesturerecognizer.cpp qpickupsensorgesturerecognizer.h + qshake2recognizer.cpp qshake2recognizer.h + qslamgesturerecognizer.cpp qslamgesturerecognizer.h + qtsensorgestureplugin.cpp qtsensorgestureplugin.h + qtsensorgesturesensorhandler.cpp qtsensorgesturesensorhandler.h + qturnoversensorgesturerecognizer.cpp qturnoversensorgesturerecognizer.h + qtwistsensorgesturerecognizer.cpp qtwistsensorgesturerecognizer.h + qwhipsensorgesturerecognizer.cpp qwhipsensorgesturerecognizer.h + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:qtsensors.pro:: +# OTHER_FILES = "plugin.json" +# PLUGIN_EXTENDS = "-" diff --git a/src/plugins/sensorgestures/qtsensors/qtsensors.pro b/src/plugins/sensorgestures/qtsensors/qtsensors.pro deleted file mode 100644 index 44f18ff5..00000000 --- a/src/plugins/sensorgestures/qtsensors/qtsensors.pro +++ /dev/null @@ -1,37 +0,0 @@ -TARGET = qtsensorgestures_plugin -QT = core sensors - -# Input -HEADERS += qtsensorgestureplugin.h \ - qcoversensorgesturerecognizer.h \ - qdoubletapsensorgesturerecognizer.h \ - qhoversensorgesturerecognizer.h \ - qfreefallsensorgesturerecognizer.h \ - qpickupsensorgesturerecognizer.h \ - qshake2recognizer.h \ - qslamgesturerecognizer.h \ - qturnoversensorgesturerecognizer.h \ - qtwistsensorgesturerecognizer.h \ - qwhipsensorgesturerecognizer.h \ - qtsensorgesturesensorhandler.h - -SOURCES += qtsensorgestureplugin.cpp \ - qcoversensorgesturerecognizer.cpp \ - qdoubletapsensorgesturerecognizer.cpp \ - qhoversensorgesturerecognizer.cpp \ - qfreefallsensorgesturerecognizer.cpp \ - qpickupsensorgesturerecognizer.cpp \ - qshake2recognizer.cpp \ - qslamgesturerecognizer.cpp \ - qturnoversensorgesturerecognizer.cpp \ - qtwistsensorgesturerecognizer.cpp \ - qwhipsensorgesturerecognizer.cpp \ - qtsensorgesturesensorhandler.cpp - -OTHER_FILES += \ - plugin.json - -PLUGIN_TYPE = sensorgestures -PLUGIN_CLASS_NAME = QtSensorGesturePlugin -PLUGIN_EXTENDS = - -load(qt_plugin) diff --git a/src/plugins/sensorgestures/sensorgestures.pro b/src/plugins/sensorgestures/sensorgestures.pro deleted file mode 100644 index 162fb8eb..00000000 --- a/src/plugins/sensorgestures/sensorgestures.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += shake qtsensors diff --git a/src/plugins/sensorgestures/shake/CMakeLists.txt b/src/plugins/sensorgestures/shake/CMakeLists.txt new file mode 100644 index 00000000..489881aa --- /dev/null +++ b/src/plugins/sensorgestures/shake/CMakeLists.txt @@ -0,0 +1,19 @@ +##################################################################### +## QShakeSensorGesturePlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QShakeSensorGesturePlugin + OUTPUT_NAME qtsensorgestures_shakeplugin + TYPE sensorgestures + DEFAULT_IF FALSE + SOURCES + qshakerecognizer.cpp qshakerecognizer.h + qshakesensorgestureplugin.cpp qshakesensorgestureplugin.h + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:shake.pro:: +# OTHER_FILES = "plugin.json" +# PLUGIN_EXTENDS = "-" diff --git a/src/plugins/sensorgestures/shake/shake.pro b/src/plugins/sensorgestures/shake/shake.pro deleted file mode 100644 index efa2a0cb..00000000 --- a/src/plugins/sensorgestures/shake/shake.pro +++ /dev/null @@ -1,16 +0,0 @@ -TARGET = qtsensorgestures_shakeplugin -QT = core sensors - -# Input -HEADERS += qshakesensorgestureplugin.h \ - qshakerecognizer.h -SOURCES += qshakesensorgestureplugin.cpp \ - qshakerecognizer.cpp - -OTHER_FILES += \ - plugin.json - -PLUGIN_TYPE = sensorgestures -PLUGIN_CLASS_NAME = QShakeSensorGesturePlugin -PLUGIN_EXTENDS = - -load(qt_plugin) diff --git a/src/plugins/sensors/CMakeLists.txt b/src/plugins/sensors/CMakeLists.txt new file mode 100644 index 00000000..08bfa26a --- /dev/null +++ b/src/plugins/sensors/CMakeLists.txt @@ -0,0 +1,39 @@ +# all get generic sensor +add_subdirectory(generic) + +if(ANDROID AND NOT SENSORS_PLUGINS OR "sensorfw" IN_LIST SENSORS_PLUGINS) + add_subdirectory(android) +endif() + +# Currently disabled, see src/sensors/configure.cmake +#if (QT_FEATURE_sensorfw AND NOT SENSORS_PLUGINS OR "sensorfw" IN_LIST SENSORS_PLUGINS) +# add_subdirectory(sensorfw) +#endif() + +if (WIN32 AND NOT SENSORS_PLUGINS OR "winrt" IN_LIST SENSORS_PLUGINS) + add_subdirectory(winrt) +endif() + +if (LINUX AND NOT SENSORS_PLUGINS OR "linux" IN_LIST SENSORS_PLUGINS) + add_subdirectory(linux) +endif() + +if (IOS AND NOT SENSORS_PLUGINS OR "ios" IN_LIST SENSORS_PLUGINS) + add_subdirectory(ios) +endif() + +if(LINUX AND TARGET Qt::DBus AND NOT SENSORS_PLUGINS OR "iio-sensor-proxy" IN_LIST SENSORS_PLUGINS) + add_subdirectory(iio-sensor-proxy) +endif() + +if(LINUX AND TARGET Qt::Bluetooth AND NOT SENSORS_PLUGINS OR "sensortag" IN_LIST SENSORS_PLUGINS) + if (TARGET Qt::Bluetooth) + add_subdirectory(sensortag) + else() + message(WARNING "You have configured for sensortag, but Qt Bluetooth module was not found.") + endif() +endif() + +if(NOT SENSORS_PLUGINS OR "dummy" IN_LIST SENSORS_PLUGINS) + add_subdirectory(dummy) +endif() diff --git a/src/plugins/sensors/android/CMakeLists.txt b/src/plugins/sensors/android/CMakeLists.txt new file mode 100644 index 00000000..76ee4091 --- /dev/null +++ b/src/plugins/sensors/android/CMakeLists.txt @@ -0,0 +1,32 @@ +##################################################################### +## QCounterGesturePlugin Plugin: +##################################################################### + +qt_internal_add_plugin(AndroidSensorPlugin + OUTPUT_NAME qtsensors_android + TYPE sensors + SOURCES + androidaccelerometer.cpp androidaccelerometer.h + androidcompass.cpp androidcompass.h + androidgyroscope.cpp androidgyroscope.h + androidlight.cpp androidlight.h + androidmagnetometer.cpp androidmagnetometer.h + androidpressure.cpp androidpressure.h + androidproximity.cpp androidproximity.h + androidrotation.cpp androidrotation.h + androidtemperature.cpp androidtemperature.h + main.cpp + sensoreventqueue.h + sensormanager.cpp sensormanager.h + DEFINES + # STATICPLUGIN needed because there's a Q_IMPORT_PLUGIN in main.cpp + # Yes, the plugin imports itself statically + QT_STATICPLUGIN + PUBLIC_LIBRARIES + Qt::CorePrivate + Qt::Sensors + android +) + +#### Keys ignored in scope 1:.:.:android.pro:: +# OTHER_FILES = "plugin.json" diff --git a/src/plugins/sensors/android/android.pro b/src/plugins/sensors/android/android.pro deleted file mode 100644 index 15e26ee9..00000000 --- a/src/plugins/sensors/android/android.pro +++ /dev/null @@ -1,41 +0,0 @@ -TARGET = qtsensors_android - -QT = sensors core-private - -# STATICPLUGIN needed because there's a Q_IMPORT_PLUGIN in main.cpp -# Yes, the plugin imports itself statically -DEFINES += QT_STATICPLUGIN - -HEADERS = \ - androidaccelerometer.h \ - androidcompass.h \ - androidgyroscope.h \ - androidmagnetometer.h \ - androidpressure.h \ - androidproximity.h \ - androidrotation.h \ - androidtemperature.h \ - androidlight.h \ - sensoreventqueue.h \ - sensormanager.h - -SOURCES = \ - main.cpp \ - androidaccelerometer.cpp \ - androidcompass.cpp \ - androidgyroscope.cpp \ - androidmagnetometer.cpp \ - androidpressure.cpp \ - androidproximity.cpp \ - androidrotation.cpp \ - androidtemperature.cpp \ - androidlight.cpp \ - sensormanager.cpp - -OTHER_FILES = plugin.json - -LIBS += -landroid - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = QCounterGesturePlugin -load(qt_plugin) diff --git a/src/plugins/sensors/dummy/CMakeLists.txt b/src/plugins/sensors/dummy/CMakeLists.txt new file mode 100644 index 00000000..ad245350 --- /dev/null +++ b/src/plugins/sensors/dummy/CMakeLists.txt @@ -0,0 +1,27 @@ +##################################################################### +## dummySensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(dummySensorPlugin + OUTPUT_NAME qtsensors_dummy + TYPE sensors + SOURCES + dummyaccelerometer.cpp dummyaccelerometer.h + dummycommon.cpp dummycommon.h + dummylightsensor.cpp dummylightsensor.h + main.cpp + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:dummy.pro:: +# OTHER_FILES = "plugin.json" + +## Scopes: +##################################################################### + +qt_internal_extend_target(dummySensorPlugin CONDITION UNIX AND NOT ANDROID AND NOT APPLE AND NOT OPENBSD AND NOT QNX + PUBLIC_LIBRARIES + rt +) diff --git a/src/plugins/sensors/dummy/dummy.pro b/src/plugins/sensors/dummy/dummy.pro deleted file mode 100644 index 6eab4912..00000000 --- a/src/plugins/sensors/dummy/dummy.pro +++ /dev/null @@ -1,19 +0,0 @@ -TARGET = qtsensors_dummy -QT = sensors core - -HEADERS += dummycommon.h\ - dummyaccelerometer.h\ - dummylightsensor.h - -SOURCES += dummycommon.cpp\ - dummyaccelerometer.cpp\ - dummylightsensor.cpp\ - main.cpp - -OTHER_FILES = plugin.json - -unix:!darwin:!qnx:!android:!openbsd: LIBS += -lrt - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = dummySensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/generic/CMakeLists.txt b/src/plugins/sensors/generic/CMakeLists.txt new file mode 100644 index 00000000..ccdbe811 --- /dev/null +++ b/src/plugins/sensors/generic/CMakeLists.txt @@ -0,0 +1,33 @@ +##################################################################### +## genericSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(genericSensorPlugin + OUTPUT_NAME qtsensors_generic + TYPE sensors + SOURCES + genericalssensor.cpp genericalssensor.h + genericorientationsensor.cpp genericorientationsensor.h + generictiltsensor.cpp generictiltsensor.h + main.cpp + DEFINES + QTSENSORS_GENERICALSSENSOR + QTSENSORS_GENERICORIENTATIONSENSOR + QTSENSORS_GENERICTILTSENSOR + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:generic.pro:: +# OTHER_FILES = "plugin.json" + +## Scopes: +##################################################################### + +qt_internal_extend_target(genericSensorPlugin CONDITION NOT ANDROID + SOURCES + genericrotationsensor.cpp genericrotationsensor.h + DEFINES + QTSENSORS_GENERICROTATIONSENSOR +) diff --git a/src/plugins/sensors/generic/generic.pro b/src/plugins/sensors/generic/generic.pro deleted file mode 100644 index cf87ccf3..00000000 --- a/src/plugins/sensors/generic/generic.pro +++ /dev/null @@ -1,29 +0,0 @@ -TARGET = qtsensors_generic -QT = core sensors - -HEADERS += generictiltsensor.h - -SOURCES += main.cpp\ - generictiltsensor.cpp -DEFINES += QTSENSORS_GENERICTILTSENSOR - -HEADERS += genericorientationsensor.h\ - genericalssensor.h - -SOURCES += genericorientationsensor.cpp\ - genericalssensor.cpp -DEFINES += QTSENSORS_GENERICORIENTATIONSENSOR QTSENSORS_GENERICALSSENSOR - -!android { - HEADERS += genericrotationsensor.h - - SOURCES += genericrotationsensor.cpp - - DEFINES += QTSENSORS_GENERICROTATIONSENSOR -} - -OTHER_FILES = plugin.json - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = genericSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt b/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt new file mode 100644 index 00000000..2a593e90 --- /dev/null +++ b/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt @@ -0,0 +1,41 @@ +##################################################################### +## IIOSensorProxySensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(IIOSensorProxySensorPlugin + OUTPUT_NAME qtsensors_iio-sensor-proxy + TYPE sensors + SOURCES + iiosensorproxycompass.cpp iiosensorproxycompass.h + iiosensorproxylightsensor.cpp iiosensorproxylightsensor.h + iiosensorproxyorientationsensor.cpp iiosensorproxyorientationsensor.h + iiosensorproxysensorbase.cpp iiosensorproxysensorbase.h + main.cpp + DBUS_INTERFACE_SOURCES + org.freedesktop.DBus.Properties.xml + net.hadess.SensorProxy.xml + net.hadess.SensorProxy.Compass.xml + DBUS_INTERFACE_FLAGS + "-N" + PUBLIC_LIBRARIES + Qt::Core + Qt::DBus + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:iio-sensor-proxy.pro:: +# OTHER_FILES = "plugin.json" "$$DBUS_INTERFACES" +# dbus_properties.files = "org.freedesktop.DBus.Properties.xml" +# dbus_properties.header_flags = "-N" +# sensor_proxy.files = "net.hadess.SensorProxy.xml" +# sensor_proxy.header_flags = "-N" +# sensor_proxy_compass.files = "net.hadess.SensorProxy.Compass.xml" +# sensor_proxy_compass.header_flags = "-N" + +## Scopes: +##################################################################### + +qt_internal_extend_target(IIOSensorProxySensorPlugin CONDITION NOT ANDROID + PUBLIC_LIBRARIES + rt +) diff --git a/src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro b/src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro deleted file mode 100644 index b68d9fbf..00000000 --- a/src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro +++ /dev/null @@ -1,31 +0,0 @@ -TARGET = qtsensors_iio-sensor-proxy -QT = core dbus sensors - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = IIOSensorProxySensorPlugin -load(qt_plugin) - -!android:LIBS += -lrt -HEADERS += iiosensorproxysensorbase.h \ - iiosensorproxylightsensor.h \ - iiosensorproxyorientationsensor.h \ - iiosensorproxycompass.h - -SOURCES += iiosensorproxysensorbase.cpp \ - iiosensorproxylightsensor.cpp \ - iiosensorproxyorientationsensor.cpp \ - iiosensorproxycompass.cpp \ - main.cpp - -DBUS_INTERFACES += sensor_proxy sensor_proxy_compass dbus_properties - -sensor_proxy.files = net.hadess.SensorProxy.xml -sensor_proxy.header_flags = -N - -sensor_proxy_compass.files = net.hadess.SensorProxy.Compass.xml -sensor_proxy_compass.header_flags = -N - -dbus_properties.files = org.freedesktop.DBus.Properties.xml -dbus_properties.header_flags = -N - -OTHER_FILES = plugin.json $$DBUS_INTERFACES diff --git a/src/plugins/sensors/ios/CMakeLists.txt b/src/plugins/sensors/ios/CMakeLists.txt new file mode 100644 index 00000000..9a6b100c --- /dev/null +++ b/src/plugins/sensors/ios/CMakeLists.txt @@ -0,0 +1,50 @@ +##################################################################### +## IOSSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(IOSSensorPlugin + OUTPUT_NAME qtsensors_ios + TYPE sensors + SOURCES + main.mm + PUBLIC_LIBRARIES + ${FWFoundation} + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:ios.pro:: +# OTHER_FILES = "plugin.json" + +## Scopes: +##################################################################### + +qt_internal_extend_target(IOSSensorPlugin CONDITION IOS AND UIKIT + SOURCES + ioscompass.h ioscompass.mm + DEFINES + HAVE_COMPASS + PUBLIC_LIBRARIES + ${FWCoreLocation} +) + +qt_internal_extend_target(IOSSensorPlugin CONDITION UIKIT AND NOT TVOS + SOURCES + iosaccelerometer.h iosaccelerometer.mm + iosgyroscope.h iosgyroscope.mm + iosmagnetometer.h iosmagnetometer.mm + iosmotionmanager.h iosmotionmanager.mm + DEFINES + HAVE_COREMOTION + PUBLIC_LIBRARIES + ${FWCoreMotion} +) + +qt_internal_extend_target(IOSSensorPlugin CONDITION UIKIT AND NOT WATCHOS + SOURCES + iosproximitysensor.h iosproximitysensor.mm + DEFINES + HAVE_UIDEVICE + PUBLIC_LIBRARIES + ${FWUIKit} +) diff --git a/src/plugins/sensors/ios/ios.pro b/src/plugins/sensors/ios/ios.pro deleted file mode 100644 index 91ec3ae0..00000000 --- a/src/plugins/sensors/ios/ios.pro +++ /dev/null @@ -1,49 +0,0 @@ -TARGET = qtsensors_ios -QT = core sensors - -OTHER_FILES = plugin.json - -OBJECTIVE_SOURCES += main.mm -LIBS += -framework Foundation - -uikit { - ios { - HEADERS += \ - ioscompass.h - OBJECTIVE_SOURCES += \ - ioscompass.mm - - DEFINES += HAVE_COMPASS - LIBS += -framework CoreLocation - } - - !tvos { - HEADERS += \ - iosaccelerometer.h \ - iosgyroscope.h \ - iosmagnetometer.h \ - iosmotionmanager.h - OBJECTIVE_SOURCES += \ - iosaccelerometer.mm \ - iosgyroscope.mm \ - iosmagnetometer.mm \ - iosmotionmanager.mm - - DEFINES += HAVE_COREMOTION - LIBS += -framework CoreMotion - } - - !watchos { - HEADERS += \ - iosproximitysensor.h - OBJECTIVE_SOURCES += \ - iosproximitysensor.mm - - DEFINES += HAVE_UIDEVICE - LIBS += -framework UIKit - } -} - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = IOSSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/linux/CMakeLists.txt b/src/plugins/sensors/linux/CMakeLists.txt new file mode 100644 index 00000000..aa3950ad --- /dev/null +++ b/src/plugins/sensors/linux/CMakeLists.txt @@ -0,0 +1,25 @@ +##################################################################### +## LinuxSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(LinuxSensorPlugin + OUTPUT_NAME qtsensors_linuxsys + TYPE sensors + SOURCES + linuxsysaccelerometer.cpp linuxsysaccelerometer.h + main.cpp + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors +) + +#### Keys ignored in scope 1:.:.:linux.pro:: +# OTHER_FILES = "plugin.json" + +## Scopes: +##################################################################### + +qt_internal_extend_target(LinuxSensorPlugin CONDITION NOT ANDROID + PUBLIC_LIBRARIES + rt +) diff --git a/src/plugins/sensors/linux/linux.pro b/src/plugins/sensors/linux/linux.pro deleted file mode 100644 index 33706e7d..00000000 --- a/src/plugins/sensors/linux/linux.pro +++ /dev/null @@ -1,13 +0,0 @@ -TARGET = qtsensors_linuxsys -QT = core sensors - -OTHER_FILES = plugin.json - -!android:LIBS += -lrt -HEADERS += linuxsysaccelerometer.h -SOURCES += linuxsysaccelerometer.cpp \ -main.cpp - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = LinuxSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/sensorfw/CMakeLists.txt b/src/plugins/sensors/sensorfw/CMakeLists.txt new file mode 100644 index 00000000..9b4dceca --- /dev/null +++ b/src/plugins/sensors/sensorfw/CMakeLists.txt @@ -0,0 +1,36 @@ +##################################################################### +## sensorfwSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(sensorfwSensorPlugin + OUTPUT_NAME qtsensors_sensorfw + TYPE sensors + SOURCES + main.cpp + sensorfwaccelerometer.cpp sensorfwaccelerometer.h + sensorfwals.cpp sensorfwals.h + sensorfwcompass.cpp sensorfwcompass.h + sensorfwgyroscope.cpp sensorfwgyroscope.h + sensorfwirproximitysensor.cpp sensorfwirproximitysensor.h + sensorfwlidsensor.cpp sensorfwlidsensor.h + sensorfwlightsensor.cpp sensorfwlightsensor.h + sensorfwmagnetometer.cpp sensorfwmagnetometer.h + sensorfworientationsensor.cpp sensorfworientationsensor.h + sensorfwproximitysensor.cpp sensorfwproximitysensor.h + sensorfwrotationsensor.cpp sensorfwrotationsensor.h + sensorfwsensorbase.cpp sensorfwsensorbase.h + sensorfwtapsensor.cpp sensorfwtapsensor.h + PUBLIC_LIBRARIES + Qt::Core + Qt::DBus + Qt::Network + LIBRARIES + Qt::SensorsPrivate + sensorfw +) + +#### Keys ignored in scope 1:.:.:sensorfw.pro:: +# CONFIGFILES.files = "Sensors.conf" +# CONFIGFILES.path = "/etc/xdg/QtProject/" +# INSTALLS = "CONFIGFILES" +# OTHER_FILES = "plugin.json" diff --git a/src/plugins/sensors/sensorfw/sensorfw.pro b/src/plugins/sensors/sensorfw/sensorfw.pro deleted file mode 100644 index 63a66117..00000000 --- a/src/plugins/sensors/sensorfw/sensorfw.pro +++ /dev/null @@ -1,16 +0,0 @@ -TARGET = qtsensors_sensorfw -QT = core sensors-private network dbus - -include(sensorfw.pri) - -QMAKE_USE += sensorfw - -CONFIGFILES.files = Sensors.conf -CONFIGFILES.path = /etc/xdg/QtProject/ -INSTALLS += CONFIGFILES - -OTHER_FILES = plugin.json - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = sensorfwSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/sensorfw/sensorfwsensorbase.h b/src/plugins/sensors/sensorfw/sensorfwsensorbase.h index 7e7f5c33..308265fb 100644 --- a/src/plugins/sensors/sensorfw/sensorfwsensorbase.h +++ b/src/plugins/sensors/sensorfw/sensorfwsensorbase.h @@ -101,7 +101,7 @@ protected: int bufferSize() const; virtual qreal correctionFactor() const; bool reinitIsNeeded; - bool isFeatureSupported(QSensor::Feature feature) const; + bool isFeatureSupported(QSensor::Feature feature) const override; private: bool initSensorInterface(QString const &); diff --git a/src/plugins/sensors/sensors.pro b/src/plugins/sensors/sensors.pro deleted file mode 100644 index c637e6ac..00000000 --- a/src/plugins/sensors/sensors.pro +++ /dev/null @@ -1,45 +0,0 @@ -TEMPLATE = subdirs -QT_FOR_CONFIG += sensors-private - -android { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = android generic -} - -qtConfig(sensorfw) { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = sensorfw generic -} - -darwin { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = ios generic -} - -win32 { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = winrt generic -} - -qtHaveModule(simulator) { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = simulator generic -} - -linux { - isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = linux iio-sensor-proxy generic -} - -contains(CONFIG, sensortag) { - qtHaveModule(bluetooth) { - SENSORS_PLUGINS = sensortag generic - } else { - message("You have configured for sensortag, but Qt Bluetooth module was not found.") - } -} - -contains(SENSORS_PLUGINS, dummy):SUBDIRS += dummy -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, generic):SUBDIRS += generic -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, simulator):qtHaveModule(simulator):SUBDIRS += simulator -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, linux):linux:SUBDIRS += linux -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, iio-sensor-proxy):linux:qtHaveModule(dbus):SUBDIRS += iio-sensor-proxy -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, android):android:SUBDIRS += android -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, sensorfw):sensorfw:SUBDIRS += sensorfw -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, sensortag):linux:SUBDIRS += sensortag -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, ios):darwin:SUBDIRS += ios -isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, winrt):SUBDIRS += winrt diff --git a/src/plugins/sensors/sensortag/CMakeLists.txt b/src/plugins/sensors/sensortag/CMakeLists.txt new file mode 100644 index 00000000..4f70d76c --- /dev/null +++ b/src/plugins/sensors/sensortag/CMakeLists.txt @@ -0,0 +1,26 @@ +##################################################################### +## SensortagSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(SensortagSensorPlugin + OUTPUT_NAME qtsensors_sensortag + TYPE sensors + SOURCES + main.cpp + sensortagaccelerometer.cpp sensortagaccelerometer.h + sensortagals.cpp sensortagals.h + sensortagbase.cpp sensortagbase.h + sensortaggyroscope.cpp sensortaggyroscope.h + sensortaghumiditysensor.cpp sensortaghumiditysensor.h + sensortaglightsensor.cpp sensortaglightsensor.h + sensortagmagnetometer.cpp sensortagmagnetometer.h + sensortagpressuresensor.cpp sensortagpressuresensor.h + sensortagtemperaturesensor.cpp sensortagtemperaturesensor.h + PUBLIC_LIBRARIES + Qt::Bluetooth + Qt::Core + Qt::SensorsPrivate +) + +#### Keys ignored in scope 1:.:.:sensortag.pro:: +# OTHER_FILES = "plugin.json" diff --git a/src/plugins/sensors/sensortag/sensortag.pro b/src/plugins/sensors/sensortag/sensortag.pro deleted file mode 100644 index 42252970..00000000 --- a/src/plugins/sensors/sensortag/sensortag.pro +++ /dev/null @@ -1,11 +0,0 @@ -TARGET = qtsensors_sensortag -QT = core sensors-private bluetooth -CONFIG += c++11 - -include(sensortag.pri) - -OTHER_FILES = plugin.json - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = SensortagSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/simulator/main.cpp b/src/plugins/sensors/simulator/main.cpp deleted file mode 100644 index 167711a9..00000000 --- a/src/plugins/sensors/simulator/main.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatoraccelerometer.h" -#include "simulatorambientlightsensor.h" -#include "simulatorlightsensor.h" -#include "simulatorcompass.h" -#include "simulatorproximitysensor.h" -#include "simulatorirproximitysensor.h" -#include "simulatormagnetometer.h" -#include -#include -#include - -class SimulatorSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorBackendFactory -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json") - Q_INTERFACES(QSensorPluginInterface) -public: - SimulatorSensorPlugin() - { - SensorsConnection *connection = SensorsConnection::instance(); - if (!connection) return; // hardly likely but just in case... - connect(connection, SIGNAL(setAvailableFeatures(quint32)), this, SLOT(setAvailableFeatures(quint32))); - } - - void registerSensors() override - { - QSensorManager::registerBackend(QAccelerometer::type, SimulatorAccelerometer::id, this); - QSensorManager::registerBackend(QAmbientLightSensor::type, SimulatorAmbientLightSensor::id, this); - QSensorManager::registerBackend(QLightSensor::type, SimulatorLightSensor::id, this); - QSensorManager::registerBackend(QCompass::type, SimulatorCompass::id, this); - QSensorManager::registerBackend(QProximitySensor::type, SimulatorProximitySensor::id, this); - QSensorManager::registerBackend(QIRProximitySensor::type, SimulatorIRProximitySensor::id, this); - QSensorManager::registerBackend(QMagnetometer::type, SimulatorMagnetometer::id, this); - } - - QSensorBackend *createBackend(QSensor *sensor) override - { - if (sensor->identifier() == SimulatorAccelerometer::id) { - return new SimulatorAccelerometer(sensor); - } - - if (sensor->identifier() == SimulatorAmbientLightSensor::id) { - return new SimulatorAmbientLightSensor(sensor); - } - - if (sensor->identifier() == SimulatorLightSensor::id) { - return new SimulatorLightSensor(sensor); - } - - if (sensor->identifier() == SimulatorProximitySensor::id) { - return new SimulatorProximitySensor(sensor); - } - - if (sensor->identifier() == SimulatorIRProximitySensor::id) { - return new SimulatorIRProximitySensor(sensor); - } - - if (sensor->identifier() == SimulatorCompass::id) { - return new SimulatorCompass(sensor); - } - - if (sensor->identifier() == SimulatorMagnetometer::id) { - return new SimulatorMagnetometer(sensor); - } - - return 0; - } - - // Copied from the emulator codebase - enum Features { - Accelerometer = 0x01, - Magnetometer = 0x02, - Compass = 0x04, - Infraredsensor = 0x08, - Lightsensor = 0x10 - }; - -public slots: - void setAvailableFeatures(quint32 features) - { - check(features&Accelerometer, QAccelerometer::type, SimulatorAccelerometer::id); - check(features&Lightsensor, QLightSensor::type, SimulatorLightSensor::id); - check(features&Lightsensor, QAmbientLightSensor::type, SimulatorAmbientLightSensor::id); - check(features&Magnetometer, QMagnetometer::type, SimulatorMagnetometer::id); - check(features&Compass, QCompass::type, SimulatorCompass::id); - check(features&Infraredsensor, QIRProximitySensor::type, SimulatorIRProximitySensor::id); - check(features&Infraredsensor, QProximitySensor::type, SimulatorProximitySensor::id); - } - -private: - void check(bool test, const QByteArray &type, const QByteArray &id) - { - if (test) { - if (!QSensorManager::isBackendRegistered(type, id)) - QSensorManager::registerBackend(type, id, this); - } else { - if (QSensorManager::isBackendRegistered(type, id)) - QSensorManager::unregisterBackend(type, id); - } - } -}; - -#include "main.moc" - diff --git a/src/plugins/sensors/simulator/plugin.json b/src/plugins/sensors/simulator/plugin.json deleted file mode 100644 index 77f47afe..00000000 --- a/src/plugins/sensors/simulator/plugin.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keys": [ "simulator" ] } diff --git a/src/plugins/sensors/simulator/qsensordata_simulator.cpp b/src/plugins/sensors/simulator/qsensordata_simulator.cpp deleted file mode 100644 index 3e590d66..00000000 --- a/src/plugins/sensors/simulator/qsensordata_simulator.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsensordata_simulator_p.h" - -#include - -namespace QtMobility { - -void qt_registerSensorTypes() -{ - qRegisterMetaTypeStreamOperators("QtMobility::QAmbientLightReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QLightReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QAccelerometerReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QCompassReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QProximityReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QIRProximityReadingData"); - qRegisterMetaTypeStreamOperators("QtMobility::QMagnetometerReadingData"); -} - -QDataStream &operator<<(QDataStream &out, const QAmbientLightReadingData &s) -{ - out << static_cast(s.lightLevel) << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QAmbientLightReadingData &s) -{ - qint32 lightLevel; - in >> lightLevel >> s.timestamp; - s.lightLevel = static_cast(lightLevel); - return in; -} - -QDataStream &operator<<(QDataStream &out, const QLightReadingData &s) -{ - out << s.lux << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QLightReadingData &s) -{ - in >> s.lux >> s.timestamp; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QAccelerometerReadingData &s) -{ - out << s.x << s.y << s.z << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QAccelerometerReadingData &s) -{ - in >> s.x >> s.y >> s.z >> s.timestamp; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QCompassReadingData &s) -{ - out << s.azimuth << s.calibrationLevel << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QCompassReadingData &s) -{ - in >> s.azimuth >> s.calibrationLevel >> s.timestamp; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QProximityReadingData &s) -{ - out << s.close << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QProximityReadingData &s) -{ - in >> s.close >> s.timestamp; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QIRProximityReadingData &s) -{ - out << s.irProximity << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QIRProximityReadingData &s) -{ - in >> s.irProximity >> s.timestamp; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QMagnetometerReadingData &s) -{ - out << s.x << s.y << s.z << s.calibrationLevel << s.timestamp; - return out; -} - -QDataStream &operator>>(QDataStream &in, QMagnetometerReadingData &s) -{ - in >> s.x >> s.y >> s.z >> s.calibrationLevel >> s.timestamp; - return in; -} - -} // namespace diff --git a/src/plugins/sensors/simulator/qsensordata_simulator_p.h b/src/plugins/sensors/simulator/qsensordata_simulator_p.h deleted file mode 100644 index 410078d8..00000000 --- a/src/plugins/sensors/simulator/qsensordata_simulator_p.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSENSORDATA_SIMULATOR_P_H -#define QSENSORDATA_SIMULATOR_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -namespace QtMobility { - -enum SimulatorLightLevel { - Undefined = 0, - Dark, - Twilight, - Light, - Bright, - Sunny -}; - -struct QAmbientLightReadingData -{ - SimulatorLightLevel lightLevel; - QDateTime timestamp; -}; - -struct QLightReadingData -{ - double lux; - QDateTime timestamp; -}; - -struct QAccelerometerReadingData -{ - double x; - double y; - double z; - QDateTime timestamp; -}; - -struct QMagnetometerReadingData -{ - double x; - double y; - double z; - double calibrationLevel; - QDateTime timestamp; -}; - -struct QCompassReadingData -{ - double azimuth; - double calibrationLevel; - QDateTime timestamp; -}; - -struct QProximityReadingData -{ - bool close; - QDateTime timestamp; -}; - -struct QIRProximityReadingData -{ - double irProximity; - QDateTime timestamp; -}; - -void qt_registerSensorTypes(); - -} - -Q_DECLARE_METATYPE(QtMobility::QAmbientLightReadingData) -Q_DECLARE_METATYPE(QtMobility::QLightReadingData) -Q_DECLARE_METATYPE(QtMobility::QAccelerometerReadingData) -Q_DECLARE_METATYPE(QtMobility::QMagnetometerReadingData) -Q_DECLARE_METATYPE(QtMobility::QCompassReadingData) -Q_DECLARE_METATYPE(QtMobility::QProximityReadingData) -Q_DECLARE_METATYPE(QtMobility::QIRProximityReadingData) - -#endif // QSENSORDATA_SIMULATOR_P_H diff --git a/src/plugins/sensors/simulator/simulator.pro b/src/plugins/sensors/simulator/simulator.pro deleted file mode 100644 index ac8ea506..00000000 --- a/src/plugins/sensors/simulator/simulator.pro +++ /dev/null @@ -1,32 +0,0 @@ -TARGET = qtsensors_simulator - -QT=core gui network sensors simulator - -HEADERS += \ - simulatorcommon.h\ - simulatoraccelerometer.h\ - simulatorambientlightsensor.h\ - simulatorlightsensor.h\ - simulatorcompass.h\ - simulatorproximitysensor.h\ - simulatorirproximitysensor.h\ - simulatormagnetometer.h\ - qsensordata_simulator_p.h - -SOURCES += \ - simulatorcommon.cpp\ - simulatoraccelerometer.cpp\ - simulatorambientlightsensor.cpp\ - simulatorlightsensor.cpp\ - simulatorcompass.cpp\ - simulatorproximitysensor.cpp\ - simulatorirproximitysensor.cpp\ - simulatormagnetometer.cpp\ - qsensordata_simulator.cpp\ - main.cpp - -OTHER_FILES = plugin.json - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = SimulatorSensorPlugin -load(qt_plugin) diff --git a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp b/src/plugins/sensors/simulator/simulatoraccelerometer.cpp deleted file mode 100644 index 280fc7ee..00000000 --- a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatoraccelerometer.h" -#include -#include - -const char *SimulatorAccelerometer::id("Simulator.Accelerometer"); - -SimulatorAccelerometer::SimulatorAccelerometer(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorAccelerometer::poll() -{ - QtMobility::QAccelerometerReadingData data = SensorsConnection::instance()->qtAccelerometerData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.x() != data.x - || m_reading.y() != data.y - || m_reading.z() != data.z) { - m_reading.setTimestamp(newTimestamp); - m_reading.setX(data.x); - m_reading.setY(data.y); - m_reading.setZ(data.z); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatoraccelerometer.h b/src/plugins/sensors/simulator/simulatoraccelerometer.h deleted file mode 100644 index a4205867..00000000 --- a/src/plugins/sensors/simulator/simulatoraccelerometer.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORACCELEROMETER_H -#define SIMULATORACCELEROMETER_H - -#include "simulatorcommon.h" -#include - -class SimulatorAccelerometer : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorAccelerometer(QSensor *sensor); - - void poll() override; -private: - QAccelerometerReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp b/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp deleted file mode 100644 index 5d84b36c..00000000 --- a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorambientlightsensor.h" -#include -#include - -const char *SimulatorAmbientLightSensor::id("Simulator.AmbientLightSensor"); - -SimulatorAmbientLightSensor::SimulatorAmbientLightSensor(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorAmbientLightSensor::poll() -{ - QtMobility::QAmbientLightReadingData data = SensorsConnection::instance()->qtAmbientLightData; - QAmbientLightReading::LightLevel convertedLightLevel; - switch (data.lightLevel) { - case QtMobility::Dark: - convertedLightLevel = QAmbientLightReading::Dark; - break; - case QtMobility::Twilight: - convertedLightLevel = QAmbientLightReading::Twilight; - break; - case QtMobility::Light: - convertedLightLevel = QAmbientLightReading::Light; - break; - case QtMobility::Bright: - convertedLightLevel = QAmbientLightReading::Bright; - break; - case QtMobility::Sunny: - convertedLightLevel = QAmbientLightReading::Sunny; - break; - default: - convertedLightLevel = QAmbientLightReading::Undefined; - break; - } - - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.lightLevel() != convertedLightLevel) { - m_reading.setTimestamp(newTimestamp); - m_reading.setLightLevel(convertedLightLevel); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatorambientlightsensor.h b/src/plugins/sensors/simulator/simulatorambientlightsensor.h deleted file mode 100644 index 0aadffe6..00000000 --- a/src/plugins/sensors/simulator/simulatorambientlightsensor.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORAMBIENTLIGHTSENSOR_H -#define SIMULATORAMBIENTLIGHTSENSOR_H - -#include "simulatorcommon.h" -#include - -class SimulatorAmbientLightSensor : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorAmbientLightSensor(QSensor *sensor); - - void poll() override; -private: - QAmbientLightReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorcommon.cpp b/src/plugins/sensors/simulator/simulatorcommon.cpp deleted file mode 100644 index a1693364..00000000 --- a/src/plugins/sensors/simulator/simulatorcommon.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorcommon.h" -#include "qsensordata_simulator_p.h" -#include -#include -#include - -using namespace Simulator; - -Q_GLOBAL_STATIC(SensorsConnection, sensorsConnection) - -class SimulatorAsyncConnection: public QThread -{ - Q_OBJECT -public: - SimulatorAsyncConnection() - : QThread() - { - QtMobility::qt_registerSensorTypes(); - - moveToThread(this); - connect(this, SIGNAL(queueConnectToServer()), - this, SLOT(doConnectToServer()), - Qt::QueuedConnection); - - start(); - } - - ~SimulatorAsyncConnection() - { - quit(); - wait(); - } - - void connectToServer() - { - emit queueConnectToServer(); - } - -signals: - void queueConnectToServer(); - - void initialSensorsDataSent(); - void connectionFailed(); - void setAvailableFeatures(quint32 features); - void setAmbientLightData(const QtMobility::QAmbientLightReadingData &); - void setLightData(const QtMobility::QLightReadingData &); - void setAccelerometerData(const QtMobility::QAccelerometerReadingData &); - void setMagnetometerData(const QtMobility::QMagnetometerReadingData &); - void setCompassData(const QtMobility::QCompassReadingData &); - void setProximityData(const QtMobility::QProximityReadingData &); - void setIRProximityData(const QtMobility::QIRProximityReadingData &); - -private slots: - void doConnectToServer() - { - mConnection.reset(new Connection(Connection::Client, "QtSimulator_Mobility_ServerName1.3.0.0", - 0xbeef+1, Version(1,0,0,0), this)); - mWorker.reset(mConnection->connectToServer(Connection::simulatorHostName(true), 0xbeef+1)); - if (!mWorker) { - qWarning("QtSensors simulator backend could not connect to the simulator!"); - emit connectionFailed(); - return; - } - mWorker->addReceiver(this); - mWorker->call("setRequestsSensors"); - } - -private: - QScopedPointer mConnection; - QScopedPointer mWorker; -}; - -SensorsConnection::SensorsConnection(QObject *parent) - : QObject(parent) - , mInitialDataSent(false) - , mConnectionFailed(false) -{ - mConnection = new SimulatorAsyncConnection(); - - connect(mConnection, SIGNAL(initialSensorsDataSent()), - this, SLOT(initialSensorsDataSent())); - connect(mConnection, SIGNAL(connectionFailed()), - this, SLOT(slotConnectionFailed())); - connect(mConnection, SIGNAL(setAvailableFeatures(quint32)), - this, SIGNAL(setAvailableFeatures(quint32))); - connect(mConnection, SIGNAL(setAmbientLightData(QtMobility::QAmbientLightReadingData)), - this, SLOT(setAmbientLightData(QtMobility::QAmbientLightReadingData))); - connect(mConnection, SIGNAL(setLightData(QtMobility::QLightReadingData)), - this, SLOT(setLightData(QtMobility::QLightReadingData))); - connect(mConnection, SIGNAL(setAccelerometerData(QtMobility::QAccelerometerReadingData)), - this, SLOT(setAccelerometerData(QtMobility::QAccelerometerReadingData))); - connect(mConnection, SIGNAL(setMagnetometerData(QtMobility::QMagnetometerReadingData)), - this, SLOT(setMagnetometerData(QtMobility::QMagnetometerReadingData))); - connect(mConnection, SIGNAL(setCompassData(QtMobility::QCompassReadingData)), - this, SLOT(setCompassData(QtMobility::QCompassReadingData))); - connect(mConnection, SIGNAL(setProximityData(QtMobility::QProximityReadingData)), - this, SLOT(setProximityData(QtMobility::QProximityReadingData))); - connect(mConnection, SIGNAL(setIRProximityData(QtMobility::QIRProximityReadingData)), - this, SLOT(setIRProximityData(QtMobility::QIRProximityReadingData))); - - mConnection->connectToServer(); -} - -SensorsConnection::~SensorsConnection() -{ - delete mConnection; -} - -SensorsConnection *SensorsConnection::instance() -{ - SensorsConnection *connection = sensorsConnection(); - // It's safe to return 0 because this is checked when used - //if (!connection) qFatal("Cannot return from SensorsConnection::instance because sensorsConnection() returned 0"); - return connection; -} - -void SensorsConnection::setAmbientLightData(const QtMobility::QAmbientLightReadingData &data) -{ - qtAmbientLightData = data; -} - -void SensorsConnection::setLightData(const QtMobility::QLightReadingData &data) -{ - qtLightData = data; -} - -void SensorsConnection::setAccelerometerData(const QtMobility::QAccelerometerReadingData &data) -{ - qtAccelerometerData = data; -} - -void SensorsConnection::setMagnetometerData(const QtMobility::QMagnetometerReadingData &data) -{ - qtMagnetometerData = data; -} - -void SensorsConnection::setCompassData(const QtMobility::QCompassReadingData &data) -{ - qtCompassData = data; -} - -void SensorsConnection::setProximityData(const QtMobility::QProximityReadingData &data) -{ - qtProximityData = data; -} - -void SensorsConnection::setIRProximityData(const QtMobility::QIRProximityReadingData &data) -{ - qtIRProximityData = data; -} - -void SensorsConnection::initialSensorsDataSent() -{ - mInitialDataSent = true; -} - -void SensorsConnection::slotConnectionFailed() -{ - mInitialDataSent = false; - mConnectionFailed = true; -} - -SimulatorCommon::SimulatorCommon(QSensor *sensor) - : QSensorBackend(sensor) - , m_timerid(0) -{ - addDataRate(1, 100); - sensor->setDataRate(20); - (void)SensorsConnection::instance(); // Ensure this exists -} - -void SimulatorCommon::start() -{ - SensorsConnection *connection = SensorsConnection::instance(); - if (!connection) { - sensorStopped(); - return; - } - - if (m_timerid) - return; - - int rate = sensor()->dataRate(); - if (rate == 0) - rate = 20; - int interval = 1000 / rate; - if (interval < 0) - interval = 1000; - - if (interval) - m_timerid = startTimer(interval); -} - -void SimulatorCommon::stop() -{ - if (m_timerid) { - killTimer(m_timerid); - m_timerid = 0; - } -} - -void SimulatorCommon::timerEvent(QTimerEvent * /*event*/) -{ - SensorsConnection *connection = SensorsConnection::instance(); - if (!connection || connection->connectionFailed()) { - stop(); - sensorStopped(); - } - if (!connection->safe()) return; // wait until it's safe to read the data - poll(); -} - -#include "simulatorcommon.moc" diff --git a/src/plugins/sensors/simulator/simulatorcommon.h b/src/plugins/sensors/simulator/simulatorcommon.h deleted file mode 100644 index e47f24d0..00000000 --- a/src/plugins/sensors/simulator/simulatorcommon.h +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORCOMMON_H -#define SIMULATORCOMMON_H - -#include -#include "qsensordata_simulator_p.h" - -class QTimer; - -class SimulatorAsyncConnection; - -class SensorsConnection : public QObject -{ - Q_OBJECT -public: - explicit SensorsConnection(QObject *parent = 0); - virtual ~SensorsConnection(); - - static SensorsConnection *instance(); - bool safe() const { return mInitialDataSent; } - bool connectionFailed() const { return mConnectionFailed; } - -signals: - void setAvailableFeatures(quint32 features); - -public slots: - void setAmbientLightData(const QtMobility::QAmbientLightReadingData &); - void setLightData(const QtMobility::QLightReadingData &); - void setAccelerometerData(const QtMobility::QAccelerometerReadingData &); - void setMagnetometerData(const QtMobility::QMagnetometerReadingData &); - void setCompassData(const QtMobility::QCompassReadingData &); - void setProximityData(const QtMobility::QProximityReadingData &); - void setIRProximityData(const QtMobility::QIRProximityReadingData &); - void initialSensorsDataSent(); - void slotConnectionFailed(); - -private: - SimulatorAsyncConnection *mConnection; - bool mInitialDataSent; - bool mConnectionFailed; - -public: - QtMobility::QAmbientLightReadingData qtAmbientLightData; - QtMobility::QLightReadingData qtLightData; - QtMobility::QAccelerometerReadingData qtAccelerometerData; - QtMobility::QMagnetometerReadingData qtMagnetometerData; - QtMobility::QCompassReadingData qtCompassData; - QtMobility::QProximityReadingData qtProximityData; - QtMobility::QIRProximityReadingData qtIRProximityData; -}; - -class SimulatorCommon : public QSensorBackend -{ -public: - SimulatorCommon(QSensor *sensor); - - void start() override; - void stop() override; - virtual void poll() = 0; - void timerEvent(QTimerEvent * /*event*/) override; - -private: - int m_timerid; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorcompass.cpp b/src/plugins/sensors/simulator/simulatorcompass.cpp deleted file mode 100644 index e9d0f1d7..00000000 --- a/src/plugins/sensors/simulator/simulatorcompass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorcompass.h" -#include -#include - -const char *SimulatorCompass::id("Simulator.Compass"); - -SimulatorCompass::SimulatorCompass(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorCompass::poll() -{ - QtMobility::QCompassReadingData data = SensorsConnection::instance()->qtCompassData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.azimuth() != data.azimuth - || m_reading.calibrationLevel() != data.calibrationLevel) { - m_reading.setTimestamp(newTimestamp); - m_reading.setAzimuth(data.azimuth); - m_reading.setCalibrationLevel(data.calibrationLevel); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatorcompass.h b/src/plugins/sensors/simulator/simulatorcompass.h deleted file mode 100644 index 69162c69..00000000 --- a/src/plugins/sensors/simulator/simulatorcompass.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORCOMPASS_H -#define SIMULATORCOMPASS_H - -#include "simulatorcommon.h" -#include - -class SimulatorCompass : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorCompass(QSensor *sensor); - - void poll() override; -private: - QCompassReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp deleted file mode 100644 index d041a86d..00000000 --- a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorirproximitysensor.h" -#include -#include - -const char *SimulatorIRProximitySensor::id("Simulator.IRProximitySensor"); - -SimulatorIRProximitySensor::SimulatorIRProximitySensor(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorIRProximitySensor::poll() -{ - QtMobility::QIRProximityReadingData data = SensorsConnection::instance()->qtIRProximityData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.reflectance() != data.irProximity) { - m_reading.setTimestamp(newTimestamp); - m_reading.setReflectance(data.irProximity); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatorirproximitysensor.h b/src/plugins/sensors/simulator/simulatorirproximitysensor.h deleted file mode 100644 index db20968b..00000000 --- a/src/plugins/sensors/simulator/simulatorirproximitysensor.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORIRPROXIMITYSENSOR_H -#define SIMULATORIRPROXIMITYSENSOR_H - -#include "simulatorcommon.h" -#include - -class SimulatorIRProximitySensor : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorIRProximitySensor(QSensor *sensor); - - void poll() override; -private: - QIRProximityReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorlightsensor.cpp b/src/plugins/sensors/simulator/simulatorlightsensor.cpp deleted file mode 100644 index bb4dd94d..00000000 --- a/src/plugins/sensors/simulator/simulatorlightsensor.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorlightsensor.h" -#include -#include - -const char *SimulatorLightSensor::id("Simulator.LightSensor"); - -SimulatorLightSensor::SimulatorLightSensor(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorLightSensor::poll() -{ - QtMobility::QLightReadingData data = SensorsConnection::instance()->qtLightData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.lux() != data.lux) { - m_reading.setTimestamp(newTimestamp); - m_reading.setLux(data.lux); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatorlightsensor.h b/src/plugins/sensors/simulator/simulatorlightsensor.h deleted file mode 100644 index 3af3a526..00000000 --- a/src/plugins/sensors/simulator/simulatorlightsensor.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORLIGHTSENSOR_H -#define SIMULATORLIGHTSENSOR_H - -#include "simulatorcommon.h" -#include - -class SimulatorLightSensor : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorLightSensor(QSensor *sensor); - - void poll() override; -private: - QLightReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatormagnetometer.cpp b/src/plugins/sensors/simulator/simulatormagnetometer.cpp deleted file mode 100644 index b54525ab..00000000 --- a/src/plugins/sensors/simulator/simulatormagnetometer.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatormagnetometer.h" -#include -#include - -const char *SimulatorMagnetometer::id("Simulator.Magnetometer"); - -SimulatorMagnetometer::SimulatorMagnetometer(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorMagnetometer::poll() -{ - QtMobility::QMagnetometerReadingData data = SensorsConnection::instance()->qtMagnetometerData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch()) / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch()); - if (m_reading.x() != data.x - || m_reading.y() != data.y - || m_reading.z() != data.z - || m_reading.calibrationLevel() != data.calibrationLevel) { - m_reading.setTimestamp(newTimestamp); - m_reading.setX(data.x); - m_reading.setY(data.y); - m_reading.setZ(data.z); - m_reading.setCalibrationLevel(data.calibrationLevel); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatormagnetometer.h b/src/plugins/sensors/simulator/simulatormagnetometer.h deleted file mode 100644 index facbad41..00000000 --- a/src/plugins/sensors/simulator/simulatormagnetometer.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORMAGNETOMETER_H -#define SIMULATORMAGNETOMETER_H - -#include "simulatorcommon.h" -#include - -class SimulatorMagnetometer : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorMagnetometer(QSensor *sensor); - - void poll() override; -private: - QMagnetometerReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorproximitysensor.cpp deleted file mode 100644 index 6a28ce52..00000000 --- a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorproximitysensor.h" -#include -#include - -const char *SimulatorProximitySensor::id("Simulator.ProximitySensor"); - -SimulatorProximitySensor::SimulatorProximitySensor(QSensor *sensor) - : SimulatorCommon(sensor) -{ - setReading(&m_reading); -} - -void SimulatorProximitySensor::poll() -{ - QtMobility::QProximityReadingData data = SensorsConnection::instance()->qtProximityData; - quint64 newTimestamp; - if (!data.timestamp.isValid()) - newTimestamp = static_cast(QDateTime::currentMSecsSinceEpoch() / 1000; - else - newTimestamp = static_cast(data.timestamp.toSecsSinceEpoch(); - if (m_reading.close() != data.close) { - m_reading.setTimestamp(newTimestamp); - m_reading.setClose(data.close); - - newReadingAvailable(); - } -} - diff --git a/src/plugins/sensors/simulator/simulatorproximitysensor.h b/src/plugins/sensors/simulator/simulatorproximitysensor.h deleted file mode 100644 index 16e6f6bb..00000000 --- a/src/plugins/sensors/simulator/simulatorproximitysensor.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORPROXIMITYSENSOR_H -#define SIMULATORPROXIMITYSENSOR_H - -#include "simulatorcommon.h" -#include - -class SimulatorProximitySensor : public SimulatorCommon -{ -public: - static const char *id; - - SimulatorProximitySensor(QSensor *sensor); - - void poll() override; -private: - QProximityReading m_reading; -}; - -#endif - diff --git a/src/plugins/sensors/winrt/CMakeLists.txt b/src/plugins/sensors/winrt/CMakeLists.txt new file mode 100644 index 00000000..2099547e --- /dev/null +++ b/src/plugins/sensors/winrt/CMakeLists.txt @@ -0,0 +1,26 @@ +##################################################################### +## WinRtSensorPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(WinRtSensorPlugin + OUTPUT_NAME qtsensors_winrt + TYPE sensors + SOURCES + main.cpp + winrtaccelerometer.cpp winrtaccelerometer.h + winrtambientlightsensor.cpp winrtambientlightsensor.h + winrtcommon.cpp winrtcommon.h + winrtcompass.cpp winrtcompass.h + winrtgyroscope.cpp winrtgyroscope.h + winrtorientationsensor.cpp winrtorientationsensor.h + winrtrotationsensor.cpp winrtrotationsensor.h + PUBLIC_LIBRARIES + Qt::Core + Qt::Sensors + LIBRARIES + Qt::CorePrivate + runtimeobject +) + +#### Keys ignored in scope 1:.:.:winrt.pro:: +# OTHER_FILES = "plugin.json" diff --git a/src/plugins/sensors/winrt/winrt.pro b/src/plugins/sensors/winrt/winrt.pro deleted file mode 100644 index 0de6293b..00000000 --- a/src/plugins/sensors/winrt/winrt.pro +++ /dev/null @@ -1,29 +0,0 @@ -TARGET = qtsensors_winrt -QT = sensors core core_private - -HEADERS += \ - winrtaccelerometer.h \ - winrtambientlightsensor.h \ - winrtcommon.h \ - winrtcompass.h \ - winrtorientationsensor.h \ - winrtrotationsensor.h \ - winrtgyroscope.h - -SOURCES += \ - main.cpp \ - winrtaccelerometer.cpp \ - winrtambientlightsensor.cpp \ - winrtcommon.cpp \ - winrtcompass.cpp \ - winrtorientationsensor.cpp \ - winrtrotationsensor.cpp \ - winrtgyroscope.cpp - -OTHER_FILES = plugin.json - -LIBS += runtimeobject.lib - -PLUGIN_TYPE = sensors -PLUGIN_CLASS_NAME = WinRtSensorPlugin -load(qt_plugin) diff --git a/src/sensors/CMakeLists.txt b/src/sensors/CMakeLists.txt new file mode 100644 index 00000000..4a687b48 --- /dev/null +++ b/src/sensors/CMakeLists.txt @@ -0,0 +1,108 @@ +##################################################################### +## Sensors Module: +##################################################################### + +qt_internal_add_module(Sensors + PLUGIN_TYPES sensors sensorgestures + SOURCES + gestures/qsensorgesture.cpp gestures/qsensorgesture.h gestures/qsensorgesture_p.h + gestures/qsensorgesturemanager.cpp gestures/qsensorgesturemanager.h + gestures/qsensorgesturemanagerprivate.cpp gestures/qsensorgesturemanagerprivate_p.h + gestures/qsensorgestureplugininterface.cpp gestures/qsensorgestureplugininterface.h + gestures/qsensorgesturerecognizer.cpp gestures/qsensorgesturerecognizer.h + qsensorbackend.cpp qsensorbackend.h + qsensormanager.cpp qsensormanager.h + qsensorplugin.cpp qsensorplugin.h + qsensorsglobal.h + sensorlog_p.h + qsensor.h + qaccelerometer.h + qaltimeter.h + qambientlightsensor.h + qambienttemperaturesensor.h + qcompass.h + qdistancesensor.h + qholstersensor.h + qlightsensor.h + qmagnetometer.h + qorientationsensor.h + qproximitysensor.h + qirproximitysensor.h + qrotationsensor.h + qtapsensor.h + qtiltsensor.h + qgyroscope.h + qpressuresensor.h + qhumiditysensor.h + qlidsensor.h + qsensor_p.h + qaccelerometer_p.h + qaltimeter_p.h + qambientlightsensor_p.h + qambienttemperaturesensor_p.h + qcompass_p.h + qdistancesensor_p.h + qholstersensor_p.h + qlightsensor_p.h + qmagnetometer_p.h + qorientationsensor_p.h + qproximitysensor_p.h + qirproximitysensor_p.h + qrotationsensor_p.h + qtapsensor_p.h + qtiltsensor_p.h + qgyroscope_p.h + qpressuresensor_p.h + qhumiditysensor_p.h + qlidsensor_p.h + qsensor.cpp + qaccelerometer.cpp + qaltimeter.cpp + qambientlightsensor.cpp + qambienttemperaturesensor.cpp + qcompass.cpp + qdistancesensor.cpp + qholstersensor.cpp + qlightsensor.cpp + qmagnetometer.cpp + qorientationsensor.cpp + qproximitysensor.cpp + qirproximitysensor.cpp + qrotationsensor.cpp + qtapsensor.cpp + qtiltsensor.cpp + qgyroscope.cpp + qpressuresensor.cpp + qhumiditysensor.cpp + qlidsensor.cpp + DEFINES + $<$:ENABLE_RUNTIME_SENSORLOG> + LIBRARIES + Qt::CorePrivate + PUBLIC_LIBRARIES + Qt::Core + PRIVATE_MODULE_INTERFACE + Qt::CorePrivate +) + +if(ANDROID) + set_property(TARGET Sensors APPEND PROPERTY QT_ANDROID_LIB_DEPENDENCIES + plugins/sensors/libplugins_sensors_qtsensors_android.so + ) +endif() + +#### Keys ignored in scope 1:.:.:sensors.pro:: +# SENSORS = "qsensor" "qaccelerometer" "qaltimeter" "qambientlightsensor" "qambienttemperaturesensor" "qcompass" "qdistancesensor" "qholstersensor" "qlightsensor" "qmagnetometer" "qorientationsensor" "qproximitysensor" "qirproximitysensor" "qrotationsensor" "qtapsensor" "qtiltsensor" "qgyroscope" "qpressuresensor" "qhumiditysensor" "qlidsensor" + +## Scopes: +##################################################################### + +qt_internal_extend_target(Sensors CONDITION NOT SENSORS_CONFIG_PATH + DEFINES + QTSENSORS_CONFIG_PATH="${SENSORS_CONFIG_PATH}" +) + +qt_internal_add_docs(Sensors + doc/qtsensors.qdocconf +) + diff --git a/src/sensors/configure.cmake b/src/sensors/configure.cmake new file mode 100644 index 00000000..06e0de59 --- /dev/null +++ b/src/sensors/configure.cmake @@ -0,0 +1,38 @@ + + +#### Inputs + + + +#### Libraries +# special case begin +if (LINUX) + qt_find_package(Sensorfw PROVIDED_TARGETS Sensorfw::Sensorfw MODULE_NAME sensors QMAKE_LIB sensorfw) +endif() +# special case end + +#### Tests + + + +#### Features + +# special case begin +qt_feature("sensorfw" PRIVATE + LABEL "sensorfw" + CONDITION Sensorfw_FOUND +) +# special case end + +qt_configure_add_summary_section(NAME "Qt Sensors") +if (LINUX) + # At the moment there is no Qt6 version of sensorfw, and while the + # FindSensorfw.cmake in this repo would find the package using pkg-config, + # it would not work. Once the Qt6 version exists, remove the + # "sensorfw_enabled_with_cmake" entry, enable build in + # src/plugins/sensors/CMakeLists.txt and fix any potential errors. + qt_configure_add_summary_entry(ARGS "sensorfw") + qt_configure_add_summary_entry(ARGS "sensorfw_enabled_with_cmake") + qt_configure_add_report(MESSAGE "SensorFW support currently not enabled with cmake") +endif() +qt_configure_end_summary_section() # end of "Qt Sensors" section diff --git a/src/sensors/doc/snippets/sensorgestures/CMakeLists.txt b/src/sensors/doc/snippets/sensorgestures/CMakeLists.txt new file mode 100644 index 00000000..eb46a95c --- /dev/null +++ b/src/sensors/doc/snippets/sensorgestures/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.14) +project(sensorgesturessdocsnippet LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +find_package(Qt6 COMPONENTS Core Sensors) + +qt_add_executable(sensorgesturessdocsnippet + creating.cpp + main.cpp + myplugin.h + plugin.cpp +) + +target_link_libraries(sensorgesturessdocsnippet PUBLIC + Qt::Sensors +) + +if (GCC AND UNIX) + target_link_libraries(sensorgesturessdocsnippet PUBLIC + rdynamic + log + ) +endif() diff --git a/src/sensors/doc/snippets/sensorgestures/sensorgestures.pro b/src/sensors/doc/snippets/sensorgestures/sensorgestures.pro deleted file mode 100644 index 7442dd87..00000000 --- a/src/sensors/doc/snippets/sensorgestures/sensorgestures.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE=app -TARGET=sensorgesturessdocsnippet -QT = core sensors -SOURCES+=main.cpp\ - creating.cpp\ - plugin.cpp -HEADERS+=myplugin.h -!win32:*g++*:LIBS+=-rdynamic diff --git a/src/sensors/doc/snippets/sensors/CMakeLists.txt b/src/sensors/doc/snippets/sensors/CMakeLists.txt new file mode 100644 index 00000000..a5c35e35 --- /dev/null +++ b/src/sensors/doc/snippets/sensors/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.14) +project(sensorsdocsnippet LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +find_package(Qt6 COMPONENTS Core Sensors) + +qt_add_executable(sensorsdocsnippet + creating.cpp + main.cpp + mybackend.h + plugin.cpp +) + +target_link_libraries(sensorsdocsnippet PUBLIC + Qt::Sensors +) + +if (GCC AND UNIX) + target_link_libraries(sensorsdocsnippet PUBLIC + rdynamic + log + ) +endif() diff --git a/src/sensors/doc/snippets/sensors/sensors.pro b/src/sensors/doc/snippets/sensors/sensors.pro deleted file mode 100644 index 91d49772..00000000 --- a/src/sensors/doc/snippets/sensors/sensors.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE=app -TARGET=sensorsdocsnippet -QT = core sensors -SOURCES+=main.cpp\ - creating.cpp\ - start.cpp\ - plugin.cpp -HEADERS+=mybackend.h -!win32:*g++*:LIBS+=-rdynamic -OTHER_FILES += *.qml diff --git a/src/sensors/doc/snippets/snippets.pro b/src/sensors/doc/snippets/snippets.pro deleted file mode 100644 index f73d4a35..00000000 --- a/src/sensors/doc/snippets/snippets.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += sensors -SUBDIRS += sensorgestures - diff --git a/src/sensors/gestures/qsensorgesturemanagerprivate.cpp b/src/sensors/gestures/qsensorgesturemanagerprivate.cpp index 81e87de0..09b068d6 100644 --- a/src/sensors/gestures/qsensorgesturemanagerprivate.cpp +++ b/src/sensors/gestures/qsensorgesturemanagerprivate.cpp @@ -46,10 +46,6 @@ #include "qsensorgesturemanagerprivate_p.h" #include "qsensorgestureplugininterface.h" -#ifdef SIMULATOR_BUILD -#include "simulatorgesturescommon_p.h" -#endif - Q_GLOBAL_STATIC(QSensorGestureManagerPrivate, sensorGestureManagerPrivate) QT_BEGIN_NAMESPACE @@ -57,18 +53,6 @@ QT_BEGIN_NAMESPACE QSensorGestureManagerPrivate::QSensorGestureManagerPrivate(QObject *parent) : QObject(parent) { -#ifdef SIMULATOR_BUILD - SensorGesturesConnection *connection = new SensorGesturesConnection(this); - connect(connection,SIGNAL(sensorGestureDetected()), - this,SLOT(sensorGestureDetected())); - - connect(this,SIGNAL(newSensorGestures(QStringList)), - connection,SLOT(newSensorGestures(QStringList))); - - connect(this,SIGNAL(removeSensorGestures(QStringList)), - connection,SLOT(removeSensorGestures(QStringList))); -#endif - loader = new QFactoryLoader("org.qt-project.QSensorGesturePluginInterface", QLatin1String("/sensorgestures")); loadPlugins(); } @@ -189,49 +173,6 @@ QStringList QSensorGestureManagerPrivate::gestureIds() return knownIds; } -#ifdef SIMULATOR_BUILD -void QSensorGestureManagerPrivate::sensorGestureDetected() -{ - QString str = get_qtSensorGestureData(); - - Q_FOREACH (const QString &id, gestureIds()) { - QSensorGestureRecognizer *recognizer = sensorGestureRecognizer(id); - if (recognizer != 0) { - Q_FOREACH (const QString &sig, recognizer->gestureSignals()) { - if (!sig.contains(QLatin1String("detected"))) { //weed out detected signals - QString tmp; - tmp = sig.left(sig.length() - 2); - if (str == tmp) { - // named signal for c++ - QMetaObject::invokeMethod(recognizer, str.toLocal8Bit(), Qt::DirectConnection); - // detected signal for qml and c++ - QMetaObject::invokeMethod(recognizer, "detected", Qt::DirectConnection, - Q_ARG(QString, str)); - break; - - } - } - } - } - } -} - -void QSensorGestureManagerPrivate::recognizerStarted(const QSensorGestureRecognizer *recognizer) -{ - QStringList list = recognizer->gestureSignals(); - list.removeOne(QLatin1String("detected(QString)")); - Q_EMIT newSensorGestures(list); -} - -void QSensorGestureManagerPrivate::recognizerStopped(const QSensorGestureRecognizer *recognizer) -{ - QStringList list = recognizer->gestureSignals(); - list.removeOne(QLatin1String("detected(QString)")); - Q_EMIT removeSensorGestures(list); -} - -#endif - QSensorGestureManagerPrivate * QSensorGestureManagerPrivate::instance() { QSensorGestureManagerPrivate *priv = sensorGestureManagerPrivate(); diff --git a/src/sensors/gestures/qsensorgesturemanagerprivate_p.h b/src/sensors/gestures/qsensorgesturemanagerprivate_p.h index 2ca4d648..e57ede49 100644 --- a/src/sensors/gestures/qsensorgesturemanagerprivate_p.h +++ b/src/sensors/gestures/qsensorgesturemanagerprivate_p.h @@ -86,24 +86,10 @@ public: QStringList gestureIds(); QStringList knownIds; void initPlugin(QObject *o); -#ifdef SIMULATOR_BUILD - void recognizerStarted(const QSensorGestureRecognizer *); - void recognizerStopped(const QSensorGestureRecognizer *); -#endif static QSensorGestureManagerPrivate * instance(); Q_SIGNALS: void newSensorGestureAvailable(); - -#ifdef SIMULATOR_BUILD -Q_SIGNALS: - void newSensorGestures(QStringList); - void removeSensorGestures(QStringList); - -private slots: - void sensorGestureDetected(); - -#endif }; QT_END_NAMESPACE diff --git a/src/sensors/gestures/qsensorgesturerecognizer.cpp b/src/sensors/gestures/qsensorgesturerecognizer.cpp index c992ac01..d9a367eb 100644 --- a/src/sensors/gestures/qsensorgesturerecognizer.cpp +++ b/src/sensors/gestures/qsensorgesturerecognizer.cpp @@ -39,11 +39,8 @@ #include "qsensorgesturerecognizer.h" #include "qsensorgesture_p.h" - #include "qsensorgesturemanager.h" -#ifdef SIMULATOR_BUILD -#include "qsensorgesturemanagerprivate_p.h" -#endif + QT_BEGIN_NAMESPACE /*! @@ -187,12 +184,8 @@ void QSensorGestureRecognizer::startBackend() qWarning() << "Not starting. Gesture Recognizer not initialized"; return; } - if (d_ptr->count++ == 0) { + if (d_ptr->count++ == 0) start(); -#ifdef SIMULATOR_BUILD - QSensorGestureManagerPrivate::instance()->recognizerStarted(this); -#endif - } } /*! @@ -207,12 +200,8 @@ void QSensorGestureRecognizer::stopBackend() qWarning() << "Not stopping. Gesture Recognizer not initialized"; return; } - if (--d_ptr->count == 0) { + if (--d_ptr->count == 0) stop(); -#ifdef SIMULATOR_BUILD - QSensorGestureManagerPrivate::instance()->recognizerStopped(this); -#endif - } } QT_END_NAMESPACE diff --git a/src/sensors/gestures/simulatorgesturescommon.cpp b/src/sensors/gestures/simulatorgesturescommon.cpp deleted file mode 100644 index b7860423..00000000 --- a/src/sensors/gestures/simulatorgesturescommon.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "simulatorgesturescommon_p.h" - -#include -#include - -#include -#include - -using namespace Simulator; - - -Q_GLOBAL_STATIC(QString, qtSensorGestureData) - -SensorGesturesConnection::SensorGesturesConnection(QObject *parent) - : QObject(parent) -{ - mConnection = new Connection(Connection::Client, QLatin1String("QtSimulator_Mobility_ServerName1.3.0.0"), - 0xbeef+1, Version(1,0,0,0), this); - mWorker = mConnection->connectToServer(Connection::simulatorHostName(true), 0xbeef+1); - - if (!mWorker) { - qWarning() << "Could not connect to server"; - return; - } - - mWorker->addReceiver(this); - mWorker->call("setRequestsSensorGestures"); -} - -SensorGesturesConnection::~SensorGesturesConnection() -{ - mWorker->call("setSensorGestures", QStringList()); - delete mWorker; -} - -void SensorGesturesConnection::setSensorGestureData(const QString &data) -{ - QString gesture = data; - if (data.contains(QLatin1String("detected"))) { - gesture.remove(QLatin1String("detected(")); - gesture.remove(QLatin1String(")")); - } - *qtSensorGestureData() = gesture; -} - -void SensorGesturesConnection::newSensorGestureDetected() -{ - emit sensorGestureDetected(); -} - -void SensorGesturesConnection::newSensorGestures(const QStringList &gestures) -{ - if (!mWorker) return; - - Q_FOREACH (const QString &gest, gestures) { - if (!gest.contains(QLatin1String("detected"))) { - QString tmp = gest.left(gest.length()-2); - if (!allGestures.contains(tmp)) { - allGestures.append(tmp); - } - } - } - - mWorker->call("setSensorGestures", allGestures); -} - -void SensorGesturesConnection::removeSensorGestures(const QStringList &gestures) -{ - Q_FOREACH (const QString &gest, gestures) { - QString tmp = gest.left(gest.length()-2); - if (allGestures.contains(tmp)) { - allGestures.removeOne(tmp); - } - } - mWorker->call("setSensorGestures", allGestures); -} - -QString get_qtSensorGestureData() -{ - return *qtSensorGestureData(); -} - diff --git a/src/sensors/gestures/simulatorgesturescommon_p.h b/src/sensors/gestures/simulatorgesturescommon_p.h deleted file mode 100644 index 63022238..00000000 --- a/src/sensors/gestures/simulatorgesturescommon_p.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SIMULATORGESTURESCOMMON_H -#define SIMULATORGESTURESCOMMON_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -class QTimer; - -namespace Simulator -{ - class Connection; - class ConnectionWorker; -} - -class SensorGesturesConnection : public QObject -{ - Q_OBJECT -public: - explicit SensorGesturesConnection(QObject *parent = 0); - virtual ~SensorGesturesConnection(); - -Q_SIGNALS: - void sensorGestureDetected(); - -public slots: - void setSensorGestureData(const QString &); - void newSensorGestureDetected(); - void newSensorGestures(const QStringList &gestures); - void removeSensorGestures(const QStringList &gestures); - -private: - Simulator::Connection *mConnection; - Simulator::ConnectionWorker *mWorker; - QStringList allGestures; - -}; - -QString get_qtSensorGestureData(); - -#endif //SIMULATORGESTURESCOMMON_H - diff --git a/src/sensors/qsensor.cpp b/src/sensors/qsensor.cpp index d8bb0bee..ef1ef523 100644 --- a/src/sensors/qsensor.cpp +++ b/src/sensors/qsensor.cpp @@ -1362,7 +1362,7 @@ void QSensorReading::copyValuesFrom(QSensorReading *other) \code class MyReading : public QSensorReading { - Q_OBJECT + \Q_OBJECT Q_PROPERTY(qreal myprop READ myprop) DECLARE_READING(MyReading) public: @@ -1390,6 +1390,3 @@ void QSensorReading::copyValuesFrom(QSensorReading *other) */ QT_END_NAMESPACE - -#include "moc_qsensor.cpp" - diff --git a/src/sensors/qt_cmdline.cmake b/src/sensors/qt_cmdline.cmake new file mode 100644 index 00000000..e69de29b diff --git a/src/sensors/sensors.pro b/src/sensors/sensors.pro deleted file mode 100644 index 79cb6e45..00000000 --- a/src/sensors/sensors.pro +++ /dev/null @@ -1,87 +0,0 @@ -TARGET = QtSensors -CONFIG += strict_flags -QT = core-private - -CONFIG(debug,debug|release):DEFINES += ENABLE_RUNTIME_SENSORLOG -!isEmpty(SENSORS_CONFIG_PATH):DEFINES += "QTSENSORS_CONFIG_PATH=\\\"$$SENSORS_CONFIG_PATH\\\"" - -qtHaveModule(simulator) { - DEFINES += SIMULATOR_BUILD - QT_FOR_PRIVATE += simulator -} - -QMAKE_DOCS = $$PWD/doc/qtsensors.qdocconf - -ANDROID_LIB_DEPENDENCIES = \ - plugins/sensors/libplugins_sensors_qtsensors_android.so - -PUBLIC_HEADERS += \ - qsensorbackend.h\ - qsensormanager.h\ - qsensorplugin.h\ - qsensorsglobal.h - -PRIVATE_HEADERS += \ - sensorlog_p.h\ - -SOURCES += qsensorbackend.cpp\ - qsensormanager.cpp\ - qsensorplugin.cpp - -SOURCES += \ - gestures/qsensorgesture.cpp \ - gestures/qsensorgesturerecognizer.cpp \ - gestures/qsensorgesturemanager.cpp \ - gestures/qsensorgesturemanagerprivate.cpp \ - gestures/qsensorgestureplugininterface.cpp - -GESTURE_HEADERS += \ - gestures/qsensorgesture.h\ - gestures/qsensorgesture_p.h\ - gestures/qsensorgesturerecognizer.h \ - gestures/qsensorgesturemanager.h \ - gestures/qsensorgesturemanagerprivate_p.h \ - gestures/qsensorgestureplugininterface.h - -qtHaveModule(simulator) { - SOURCES += gestures/simulatorgesturescommon.cpp - GESTURE_HEADERS += gestures/simulatorgesturescommon_p.h -} - -# 3 files per sensor (including QSensor) -SENSORS=\ - qsensor\ - qaccelerometer\ - qaltimeter\ - qambientlightsensor\ - qambienttemperaturesensor\ - qcompass\ - qdistancesensor\ - qholstersensor\ - qlightsensor\ - qmagnetometer\ - qorientationsensor\ - qproximitysensor\ - qirproximitysensor\ - qrotationsensor\ - qtapsensor\ - qtiltsensor\ - qgyroscope\ - qpressuresensor \ - qhumiditysensor \ - qlidsensor - -for(s,SENSORS) { - # Client API - PUBLIC_HEADERS += $${s}.h - SOURCES += $${s}.cpp - # Private header - PRIVATE_HEADERS += $${s}_p.h -} - -HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS $$GESTURE_HEADERS - -MODULE_PLUGIN_TYPES = \ - sensors \ - sensorgestures -load(qt_module) diff --git a/src/src.pro b/src/src.pro deleted file mode 100644 index b3aa7ba0..00000000 --- a/src/src.pro +++ /dev/null @@ -1,18 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += sensors -sensors.subdir = sensors -sensors.target = sub-sensors - -qtHaveModule(quick) { - SUBDIRS += imports - imports.subdir = imports - imports.target = sub-imports - imports.depends = sensors -} - -SUBDIRS += plugins -plugins.subdir = plugins -plugins.target = sub-plugins -plugins.depends = sensors - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..ae5e2f03 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,6 @@ + +if(QT_BUILD_STANDALONE_TESTS) + # Add qt_find_package calls for extra dependencies that need to be found when building + # the standalone tests here. +endif() +qt_build_tests() diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt new file mode 100644 index 00000000..8f1c9ec7 --- /dev/null +++ b/tests/auto/CMakeLists.txt @@ -0,0 +1,10 @@ +add_subdirectory(qsensor) +add_subdirectory(qsensorgestures) +add_subdirectory(qsensorgestureplugins) +add_subdirectory(cmake) +if(TARGET Qt::Quick) + add_subdirectory(sensors2qmlapi) +endif() +if(UNIX AND NOT APPLE) + add_subdirectory(qsensorgestures_gestures) +endif() diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro deleted file mode 100644 index ffcb62cf..00000000 --- a/tests/auto/auto.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += qsensor -qtHaveModule(qml) { - SUBDIRS += sensors2qmlapi - SUBDIRS += qtsensors5 -} -#SUBDIRS += legacy_sensors -SUBDIRS += qsensorgestures -SUBDIRS += qsensorgestureplugins -SUBDIRS += cmake - -!mac:!win32:SUBDIRS += qsensorgestures_gestures - diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index 4eba8604..cd0dfda1 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -1,14 +1,45 @@ +# This is an automatic test for the CMake configuration files. +# To run it manually, +# 1) mkdir build # Create a build directory +# 2) cd build +# 3) # Run cmake on this directory +# `$qt_prefix/bin/qt-cmake ..` or `cmake -DCMAKE_PREFIX_PATH=/path/to/qt ..` +# 4) ctest # Run ctest -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.14) +project(sensors_cmake_tests) +enable_testing() -project(qmake_cmake_files) +set(required_packages Core Sensors) -enable_testing() +# Setup the test when called as a completely standalone project. +if(TARGET Qt6::Core) + # Tests are built as part of the qtsensors build tree. + # Setup paths so that the Qt packages are found. + qt_internal_set_up_build_dir_package_paths() +endif() + +find_package(Qt6 REQUIRED COMPONENTS ${required_packages}) -find_package(Qt5Core REQUIRED) +# Setup common test variables which were previously set by ctest_testcase_common.prf. +set(CMAKE_MODULES_UNDER_TEST "${required_packages}") -include("${_Qt5CTestMacros}") +foreach(qt_package ${CMAKE_MODULES_UNDER_TEST}) + set(package_name "${QT_CMAKE_EXPORT_NAMESPACE}${qt_package}") + if(${package_name}_FOUND) + set(CMAKE_${qt_package}_MODULE_MAJOR_VERSION "${${package_name}_VERSION_MAJOR}") + set(CMAKE_${qt_package}_MODULE_MINOR_VERSION "${${package_name}_VERSION_MINOR}") + set(CMAKE_${qt_package}_MODULE_PATCH_VERSION "${${package_name}_VERSION_PATCH}") + endif() +endforeach() + +include("${_Qt6CTestMacros}") + +set(module_includes + Sensors QLightSensor + Sensors QRotationSensor +) -test_module_includes( - Sensors QLightSensor +_qt_internal_test_module_includes( + ${module_includes} ) diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro deleted file mode 100644 index f8c4e0a9..00000000 --- a/tests/auto/cmake/cmake.pro +++ /dev/null @@ -1,7 +0,0 @@ - -# Cause make to do nothing. -TEMPLATE = subdirs - -CMAKE_QT_MODULES_UNDER_TEST = sensors - -CONFIG += ctest_testcase diff --git a/tests/auto/legacy_sensors/CMakeLists.txt b/tests/auto/legacy_sensors/CMakeLists.txt new file mode 100644 index 00000000..8ed9eeb0 --- /dev/null +++ b/tests/auto/legacy_sensors/CMakeLists.txt @@ -0,0 +1,16 @@ +##################################################################### +## tst_legacy_sensors Binary: +##################################################################### + +qt_internal_add_test(tst_legacy_sensors + SOURCES + ../qsensor/test_backends.cpp ../qsensor/test_backends.h + tst_legacy_sensors.cpp + INCLUDE_DIRECTORIES + ../qsensor + PUBLIC_LIBRARIES + Qt::Gui + Qt::Qml + Qt::Sensors + Qt::Test +) diff --git a/tests/auto/legacy_sensors/legacy_sensors.pro b/tests/auto/legacy_sensors/legacy_sensors.pro deleted file mode 100644 index daf0185d..00000000 --- a/tests/auto/legacy_sensors/legacy_sensors.pro +++ /dev/null @@ -1,15 +0,0 @@ -TEMPLATE=app -TARGET=tst_legacy_sensors -!no_system_tests:CONFIG += testcase -QT = core testlib gui qml sensors -SOURCES += tst_legacy_sensors.cpp - -VPATH += ../qsensor -INCLUDEPATH += ../qsensor - -HEADERS += \ - test_backends.h - -SOURCES += \ - test_backends.cpp - diff --git a/tests/auto/qsensor/CMakeLists.txt b/tests/auto/qsensor/CMakeLists.txt new file mode 100644 index 00000000..3cdb4cf8 --- /dev/null +++ b/tests/auto/qsensor/CMakeLists.txt @@ -0,0 +1,19 @@ +##################################################################### +## tst_qsensor Test: +##################################################################### + +qt_internal_add_test(tst_qsensor + SOURCES + test_backends.cpp test_backends.h + test_sensor.cpp test_sensor.h test_sensor_p.h + test_sensor2.cpp test_sensor2.h test_sensor2_p.h + test_sensor2impl.cpp test_sensor2impl.h + test_sensorimpl.cpp test_sensorimpl.h + test_sensorplugin.cpp + tst_qsensor.cpp + DEFINES + QT_STATICPLUGIN + PUBLIC_LIBRARIES + Qt::CorePrivate + Qt::SensorsPrivate +) diff --git a/tests/auto/qsensor/qsensor.pro b/tests/auto/qsensor/qsensor.pro deleted file mode 100644 index 1366a5df..00000000 --- a/tests/auto/qsensor/qsensor.pro +++ /dev/null @@ -1,27 +0,0 @@ -TEMPLATE = app -TARGET = tst_qsensor - -CONFIG += testcase -QT = core-private testlib sensors-private -DEFINES += QT_STATICPLUGIN - -SOURCES += \ - tst_qsensor.cpp - -HEADERS += \ - test_sensor.h\ - test_sensor_p.h\ - test_sensorimpl.h\ - test_sensor2.h\ - test_sensor2_p.h\ - test_sensor2impl.h\ - test_backends.h - -SOURCES += \ - test_sensor.cpp\ - test_sensorimpl.cpp\ - test_sensor2.cpp\ - test_sensor2impl.cpp\ - test_sensorplugin.cpp\ - test_backends.cpp - diff --git a/tests/auto/qsensorgestureplugins/CMakeLists.txt b/tests/auto/qsensorgestureplugins/CMakeLists.txt new file mode 100644 index 00000000..676098df --- /dev/null +++ b/tests/auto/qsensorgestureplugins/CMakeLists.txt @@ -0,0 +1,14 @@ +##################################################################### +## tst_qsensorgesturepluginstest Binary: +##################################################################### + +qt_internal_add_test(tst_qsensorgesturepluginstest + SOURCES + ../qsensor/test_backends.cpp ../qsensor/test_backends.h + tst_qsensorgesturepluginstest.cpp + INCLUDE_DIRECTORIES + ../qsensor + PUBLIC_LIBRARIES + Qt::Sensors + Qt::Test +) diff --git a/tests/auto/qsensorgestureplugins/qsensorgestureplugins.pro b/tests/auto/qsensorgestureplugins/qsensorgestureplugins.pro deleted file mode 100644 index 117afab1..00000000 --- a/tests/auto/qsensorgestureplugins/qsensorgestureplugins.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = app -TARGET = tst_qsensorgesturepluginstest -!no_system_tests:CONFIG += testcase - -QT += core testlib sensors -QT -= gui - -SOURCES += tst_qsensorgesturepluginstest.cpp - -VPATH += ../qsensor -INCLUDEPATH += ../qsensor - -HEADERS += \ - test_backends.h - -SOURCES += \ - test_backends.cpp diff --git a/tests/auto/qsensorgestures/CMakeLists.txt b/tests/auto/qsensorgestures/CMakeLists.txt new file mode 100644 index 00000000..dc107e3d --- /dev/null +++ b/tests/auto/qsensorgestures/CMakeLists.txt @@ -0,0 +1,18 @@ +##################################################################### +## tst_qsensorgesturetest Test: +##################################################################### + +qt_internal_add_test(tst_qsensorgesturetest + SOURCES + plugins/test/qtest2recognizer.cpp plugins/test/qtest2recognizer.h + plugins/test/qtestrecognizer.cpp plugins/test/qtestrecognizer.h + plugins/test/qtestsensorgestureplugin.cpp plugins/test/qtestsensorgestureplugin_p.h + plugins/test1/qtest2recognizerdup.cpp plugins/test1/qtest2recognizerdup.h + plugins/test1/qtestrecognizerdup.cpp plugins/test1/qtestrecognizerdup.h + plugins/test1/qtestsensorgestureplugindup.cpp plugins/test1/qtestsensorgestureplugindup.h + tst_qsensorgesturetest.cpp + DEFINES + QT_STATICPLUGIN + PUBLIC_LIBRARIES + Qt::Sensors +) diff --git a/tests/auto/qsensorgestures/plugins/test1/CMakeLists.txt b/tests/auto/qsensorgestures/plugins/test1/CMakeLists.txt new file mode 100644 index 00000000..8a9bc73c --- /dev/null +++ b/tests/auto/qsensorgestures/plugins/test1/CMakeLists.txt @@ -0,0 +1,21 @@ +##################################################################### +## QTestSensorGestureDupPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QTestSensorGestureDupPlugin + OUTPUT_NAME qtsensorgestures_testplugin1 + TYPE sensorgestures + DEFAULT_IF FALSE + SOURCES + qtest2recognizerduo.cpp + qtest2recognizerdup.h + qtestrecognizerdup.cpp qtestrecognizerdup.h + qtestsensorgestureplugindup.cpp qtestsensorgestureplugindup_p.h + DEFINES + QT_DISABLE_DEPRECATED_BEFORE=0 + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::Sensors + Qt::SensorGestures +) diff --git a/tests/auto/qsensorgestures/plugins/test1/test1.pro b/tests/auto/qsensorgestures/plugins/test1/test1.pro deleted file mode 100644 index 5f890689..00000000 --- a/tests/auto/qsensorgestures/plugins/test1/test1.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = qtsensorgestures_testplugin1 - -QT += sensors sensorgestures - -# Input -HEADERS += qtestsensorgestureplugindup_p.h \ - qtestrecognizerdup.h \ - qtest2recognizerdup.h -SOURCES += qtestsensorgestureplugindup.cpp \ - qtestrecognizerdup.cpp \ - qtest2recognizerduo.cpp - -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 - -PLUGIN_TYPE = sensorgestures -PLUGIN_CLASS_NAME = QTestSensorGestureDupPlugin -PLUGIN_EXTENDS = - -load(qt_plugin) diff --git a/tests/auto/qsensorgestures/qsensorgestures.pro b/tests/auto/qsensorgestures/qsensorgestures.pro deleted file mode 100644 index e3b152c7..00000000 --- a/tests/auto/qsensorgestures/qsensorgestures.pro +++ /dev/null @@ -1,34 +0,0 @@ -TEMPLATE = app -TARGET = tst_qsensorgesturetest -CONFIG += testcase -DEFINES += QT_STATICPLUGIN - -QT += core testlib sensors -QT -= gui - -SOURCES += tst_qsensorgesturetest.cpp - - -PLUGIN_1_HEADERS = \ - plugins/test1/qtestsensorgestureplugindup.h \ - plugins/test1/qtestrecognizerdup.h \ - plugins/test1/qtest2recognizerdup.h - -PLUGIN_1_SOURCES = \ - plugins/test1/qtestsensorgestureplugindup.cpp \ - plugins/test1/qtestrecognizerdup.cpp \ - plugins/test1/qtest2recognizerdup.cpp - -HEADERS += $$PLUGIN_1_HEADERS -SOURCES += $$PLUGIN_1_SOURCES - -HEADERS += \ - plugins/test/qtestsensorgestureplugin_p.h \ - plugins/test/qtestrecognizer.h \ - plugins/test/qtest2recognizer.h - -SOURCES += \ - plugins/test/qtestsensorgestureplugin.cpp \ - plugins/test/qtestrecognizer.cpp \ - plugins/test/qtest2recognizer.cpp - diff --git a/tests/auto/qsensorgestures_gestures/CMakeLists.txt b/tests/auto/qsensorgestures_gestures/CMakeLists.txt new file mode 100644 index 00000000..cebdf1a1 --- /dev/null +++ b/tests/auto/qsensorgestures_gestures/CMakeLists.txt @@ -0,0 +1,19 @@ +##################################################################### +## tst_sensorgestures_gestures Test: +##################################################################### + +# Collect test data +list(APPEND test_data "mock_data") +list(APPEND test_data "dataset2_mock_data") + +qt_internal_add_test(tst_sensorgestures_gestures + SOURCES + mockbackends.h + mockcommon.cpp mockcommon.h + tst_sensorgestures_gestures.cpp + DEFINES + SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + PUBLIC_LIBRARIES + Qt::SensorsPrivate + TESTDATA ${test_data} +) diff --git a/tests/auto/qsensorgestures_gestures/qsensorgestures_gestures.pro b/tests/auto/qsensorgestures_gestures/qsensorgestures_gestures.pro deleted file mode 100644 index f2259d48..00000000 --- a/tests/auto/qsensorgestures_gestures/qsensorgestures_gestures.pro +++ /dev/null @@ -1,21 +0,0 @@ -TEMPLATE = app -TARGET = tst_sensorgestures_gestures -CONFIG += testcase - -QT += core testlib sensors-private -QT -= gui - -CONFIG += console -CONFIG -= app_bundle - - -SOURCES += tst_sensorgestures_gestures.cpp \ - mockcommon.cpp - -DEFINES += SRCDIR=\\\"$$PWD/\\\" - -HEADERS += \ - mockcommon.h \ - mockbackends.h - -TESTDATA += mock_data dataset2_mock_data diff --git a/tests/auto/qtsensors5/qtsensors5.pro b/tests/auto/qtsensors5/qtsensors5.pro deleted file mode 100644 index a5101024..00000000 --- a/tests/auto/qtsensors5/qtsensors5.pro +++ /dev/null @@ -1,6 +0,0 @@ -TEMPLATE=app -TARGET=tst_qtsensors5 -!no_system_tests:CONFIG += testcase -QT = core testlib qml -SOURCES += tst_qtsensors5.cpp - diff --git a/tests/auto/qtsensors5/tst_qtsensors5.cpp b/tests/auto/qtsensors5/tst_qtsensors5.cpp deleted file mode 100644 index 01ed6140..00000000 --- a/tests/auto/qtsensors5/tst_qtsensors5.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -class tst_QtSensors : public QObject -{ - Q_OBJECT -public: - tst_QtSensors(QObject *parent = 0) - : QObject(parent) - { - } - -private slots: - void initTestCase() - { - } - - void cleanupTestCase() - { - } -}; - -QTEST_MAIN(tst_QtSensors) - -#include "tst_qtsensors5.moc" diff --git a/tests/auto/sensors2qmlapi/CMakeLists.txt b/tests/auto/sensors2qmlapi/CMakeLists.txt new file mode 100644 index 00000000..8e1a0ccf --- /dev/null +++ b/tests/auto/sensors2qmlapi/CMakeLists.txt @@ -0,0 +1,17 @@ +##################################################################### +## tst_sensors2qmlapi Test: +##################################################################### + +qt_internal_add_test(tst_sensors2qmlapi + SOURCES + ../../../src/imports/sensors/qmlsensor.cpp ../../../src/imports/sensors/qmlsensor.h + ../../../src/imports/sensors/qmlsensorgesture.cpp ../../../src/imports/sensors/qmlsensorgesture.h + ../../../src/imports/sensors/qmlsensorrange.cpp ../../../src/imports/sensors/qmlsensorrange.h + qtemplategestureplugin.cpp qtemplategestureplugin.h + qtemplaterecognizer.cpp qtemplaterecognizer.h + tst_sensors2qmlapi.cpp + PUBLIC_LIBRARIES + Qt::Qml + LIBRARIES + Qt::SensorsPrivate +) diff --git a/tests/auto/sensors2qmlapi/sensors2qmlapi.pro b/tests/auto/sensors2qmlapi/sensors2qmlapi.pro deleted file mode 100644 index 74388660..00000000 --- a/tests/auto/sensors2qmlapi/sensors2qmlapi.pro +++ /dev/null @@ -1,20 +0,0 @@ -TEMPLATE = app -TARGET = tst_sensors2qmlapi - -CONFIG += testcase -QT = core testlib sensors-private qml - -SOURCES += tst_sensors2qmlapi.cpp \ - ./../../../src/imports/sensors/qmlsensor.cpp \ - ./../../../src/imports/sensors/qmlsensorgesture.cpp \ - ./../../../src/imports/sensors/qmlsensorrange.cpp \ - qtemplategestureplugin.cpp \ - qtemplaterecognizer.cpp - -HEADERS += \ - ./../../../src/imports/sensors/qmlsensor.h \ - ./../../../src/imports/sensors/qmlsensorgesture.h \ - ./../../../src/imports/sensors/qmlsensorrange.h \ - qtemplategestureplugin.h \ - qtemplaterecognizer.h - diff --git a/tests/manual/sensor_explorer/CMakeLists.txt b/tests/manual/sensor_explorer/CMakeLists.txt new file mode 100644 index 00000000..5d2c2a8d --- /dev/null +++ b/tests/manual/sensor_explorer/CMakeLists.txt @@ -0,0 +1,15 @@ +##################################################################### +## sensor_explorer Binary: +##################################################################### + +qt_internal_add_manual_test(sensor_explorer + GUI + SOURCES + explorer.cpp explorer.h explorer.ui + main.cpp + PUBLIC_LIBRARIES + Qt::Sensors + Qt::Widgets + ENABLE_AUTOGEN_TOOLS + uic +) diff --git a/tests/manual/sensor_explorer/sensor_explorer.pro b/tests/manual/sensor_explorer/sensor_explorer.pro deleted file mode 100644 index 353c49e0..00000000 --- a/tests/manual/sensor_explorer/sensor_explorer.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE=app -TARGET=sensor_explorer - -QT = widgets sensors - -FORMS=\ - explorer.ui - -HEADERS=\ - explorer.h - -SOURCES=\ - explorer.cpp\ - main.cpp - - diff --git a/tests/manual/sensorclerk/CMakeLists.txt b/tests/manual/sensorclerk/CMakeLists.txt new file mode 100644 index 00000000..17bd8b7d --- /dev/null +++ b/tests/manual/sensorclerk/CMakeLists.txt @@ -0,0 +1,14 @@ +##################################################################### +## sensorclerk Binary: +##################################################################### + +qt_internal_add_manual_test(sensorclerk + GUI + SOURCES + collector.cpp collector.h + main.cpp + PUBLIC_LIBRARIES + Qt::Gui + Qt::Quick + Qt::Sensors +) diff --git a/tests/manual/sensorclerk/sensorclerk.pro b/tests/manual/sensorclerk/sensorclerk.pro deleted file mode 100644 index 61eeef15..00000000 --- a/tests/manual/sensorclerk/sensorclerk.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -QT += quick sensors - -SOURCES += main.cpp \ - collector.cpp - -HEADERS += collector.h - -OTHER_FILES += qml/main.qml \ - qml/Button.qml diff --git a/tests/tests.pro b/tests/tests.pro deleted file mode 100644 index f9277000..00000000 --- a/tests/tests.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += auto -- cgit v1.2.3