diff options
Diffstat (limited to 'src/sensors')
129 files changed, 1088 insertions, 6619 deletions
diff --git a/src/sensors/CMakeLists.txt b/src/sensors/CMakeLists.txt new file mode 100644 index 00000000..065a2530 --- /dev/null +++ b/src/sensors/CMakeLists.txt @@ -0,0 +1,94 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## Sensors Module: +##################################################################### + +qt_internal_add_module(Sensors + PLUGIN_TYPES sensors + SOURCES + qsensorbackend.cpp qsensorbackend.h + qsensormanager.cpp qsensormanager.h + qsensorplugin.cpp qsensorplugin.h + qsensorsglobal.h + sensorlog_p.h + qsensor.h + qaccelerometer.h + qambientlightsensor.h + qambienttemperaturesensor.h + qcompass.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 + qambientlightsensor_p.h + qambienttemperaturesensor_p.h + qcompass_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 + qambientlightsensor.cpp + qambienttemperaturesensor.cpp + qcompass.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 + $<$<CONFIG:Debug>: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 + ${INSTALL_PLUGINSDIR}/sensors/libplugins_sensors_qtsensors_android.so + ) +endif() + +## Scopes: +##################################################################### + +qt_internal_extend_target(Sensors CONDITION 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..04eb0e30 --- /dev/null +++ b/src/sensors/configure.cmake @@ -0,0 +1,58 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + + + +#### 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 + +if (WIN32 AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../config.tests/winrt/CMakeLists.txt") + qt_config_compile_test("winrt_sensors" + LABEL "WinRT sensors" + PROJECT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../config.tests/winrt") +endif() + +#### Features + +# special case begin +qt_feature("sensorfw" PRIVATE + LABEL "sensorfw" + CONDITION Sensorfw_FOUND +) +# special case end + +qt_feature("winrt_sensors" PRIVATE + LABEL "WinRT sensors backend" + CONDITION WIN32 AND TEST_winrt_sensors +) + +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_entry( + TYPE WARNING + MESSAGE "SensorFW support currently not enabled with cmake" + ) +endif() + +if (WIN32) + qt_configure_add_summary_entry(ARGS "winrt_sensors") +endif() + +qt_configure_end_summary_section() # end of "Qt Sensors" section diff --git a/src/sensors/doc/images/sensorgesture-cover.png b/src/sensors/doc/images/sensorgesture-cover.png Binary files differdeleted file mode 100644 index 7b4fbc5f..00000000 --- a/src/sensors/doc/images/sensorgesture-cover.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-doubletap.png b/src/sensors/doc/images/sensorgesture-doubletap.png Binary files differdeleted file mode 100644 index 6253d0f8..00000000 --- a/src/sensors/doc/images/sensorgesture-doubletap.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-facedown.png b/src/sensors/doc/images/sensorgesture-facedown.png Binary files differdeleted file mode 100644 index a85664f1..00000000 --- a/src/sensors/doc/images/sensorgesture-facedown.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-faceup.png b/src/sensors/doc/images/sensorgesture-faceup.png Binary files differdeleted file mode 100644 index c20ef089..00000000 --- a/src/sensors/doc/images/sensorgesture-faceup.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-flat.png b/src/sensors/doc/images/sensorgesture-flat.png Binary files differdeleted file mode 100644 index e8eafafb..00000000 --- a/src/sensors/doc/images/sensorgesture-flat.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-hover.png b/src/sensors/doc/images/sensorgesture-hover.png Binary files differdeleted file mode 100644 index fecf6b3a..00000000 --- a/src/sensors/doc/images/sensorgesture-hover.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-shake.png b/src/sensors/doc/images/sensorgesture-shake.png Binary files differdeleted file mode 100644 index 06f9eeaf..00000000 --- a/src/sensors/doc/images/sensorgesture-shake.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-slam_1.png b/src/sensors/doc/images/sensorgesture-slam_1.png Binary files differdeleted file mode 100644 index d56f8892..00000000 --- a/src/sensors/doc/images/sensorgesture-slam_1.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-slam_2.png b/src/sensors/doc/images/sensorgesture-slam_2.png Binary files differdeleted file mode 100644 index 5fe8ecba..00000000 --- a/src/sensors/doc/images/sensorgesture-slam_2.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-twist.png b/src/sensors/doc/images/sensorgesture-twist.png Binary files differdeleted file mode 100644 index bec15854..00000000 --- a/src/sensors/doc/images/sensorgesture-twist.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-whip.png b/src/sensors/doc/images/sensorgesture-whip.png Binary files differdeleted file mode 100644 index aa998bb7..00000000 --- a/src/sensors/doc/images/sensorgesture-whip.png +++ /dev/null diff --git a/src/sensors/doc/qtsensors-module-use.qdocinc b/src/sensors/doc/qtsensors-module-use.qdocinc new file mode 100644 index 00000000..761b6bbd --- /dev/null +++ b/src/sensors/doc/qtsensors-module-use.qdocinc @@ -0,0 +1,15 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +//! [cmakebuild] + \code + find_package(Qt6 REQUIRED COMPONENTS Sensors) + target_link_libraries(mytarget PRIVATE Qt6::Sensors) + \endcode +//! [cmakebuild] + +//! [qmakebuild] + \code + QT += sensors + \endcode +//! [qmakebuild] diff --git a/src/sensors/doc/qtsensors.qdocconf b/src/sensors/doc/qtsensors.qdocconf index 0845e707..b7569927 100644 --- a/src/sensors/doc/qtsensors.qdocconf +++ b/src/sensors/doc/qtsensors.qdocconf @@ -1,4 +1,3 @@ -include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf) include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) include($QT_INSTALL_DOCS/config/exampleurl-qtsensors.qdocconf) @@ -14,33 +13,26 @@ qhp.QtSensors.virtualFolder = qtsensors qhp.QtSensors.indexTitle = Qt Sensors qhp.QtSensors.indexRoot = -qhp.QtSensors.filterAttributes = qtsensors $QT_VERSION qtrefdoc -qhp.QtSensors.customFilters.Qt.name = QtSensors $QT_VERSION -qhp.QtSensors.customFilters.Qt.filterAttributes = qtsensors $QT_VERSION qhp.QtSensors.subprojects = overviews classes qmltypes examples qhp.QtSensors.subprojects.overviews.title = Overview qhp.QtSensors.subprojects.overviews.indexTitle = Qt Sensors -qhp.QtSensors.subprojects.overviews.selectors = fake:page,group,module +qhp.QtSensors.subprojects.overviews.selectors = doc:page,group,module qhp.QtSensors.subprojects.classes.title = C++ Classes qhp.QtSensors.subprojects.classes.indexTitle = Qt Sensors C++ Classes -qhp.QtSensors.subprojects.classes.selectors = class fake:headerfile +qhp.QtSensors.subprojects.classes.selectors = class headerfile qhp.QtSensors.subprojects.classes.sortPages = true qhp.QtSensors.subprojects.qmltypes.title = QML Types qhp.QtSensors.subprojects.qmltypes.indexTitle = Qt Sensors QML Types -qhp.QtSensors.subprojects.qmltypes.selectors = qmlclass +qhp.QtSensors.subprojects.qmltypes.selectors = qmltype qhp.QtSensors.subprojects.qmltypes.sortPages = true qhp.QtSensors.subprojects.examples.title = Examples qhp.QtSensors.subprojects.examples.indexTitle = Qt Sensors Examples -qhp.QtSensors.subprojects.examples.selectors = fake:example +qhp.QtSensors.subprojects.examples.selectors = doc:example tagfile = ../../../doc/qtsensors/qtsensors.tags -headerdirs += .. \ - ../../imports/sensors \ - ../../plugins/sensors - -sourcedirs += .. \ - ../../imports/sensors \ +{headerdirs,sourcedirs} += .. \ + ../../sensorsquick \ ../../plugins/sensors exampledirs += ../../../examples/sensors \ @@ -51,7 +43,10 @@ examplesinstallpath = sensors imagedirs += images -depends += qtcore qtdoc qtgui +depends += qtcore qtdoc qtgui qtquick qtcmake + +# Highlighted examples +manifestmeta.highlighted.names = "QtSensors/Sensors Showcase" navigation.landingpage = "Qt Sensors" navigation.cppclassespage = "Qt Sensors C++ Classes" diff --git a/src/sensors/doc/snippets/sensorgestures/creating.cpp b/src/sensors/doc/snippets/sensorgestures/creating.cpp deleted file mode 100644 index 78f7a737..00000000 --- a/src/sensors/doc/snippets/sensorgestures/creating.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 <QObject> -#include <QString> -#include <QSensorGestureManager> - -class MyObject : public QObject -{ - void create(); -public slots: - void gestureDetected(const QString &); -}; - -void MyObject::create() -{ -//! [Receiving sensor gesture signals] - -// Create a QSensorGestureManager - QSensorGestureManager gestureManager; - -// Get a list of known recognizers - QStringList recognizersList = gestureManager.gestureIds(); - -// Create a QSensorGeture object for each of those gesture recognizers - QSensorGesture *gesture = new QSensorGesture( gestureManager.gestureIds(), this); -// Connect the known signals up. - connect(gesture, SIGNAL(detected(QString)), this, SLOT(gestureDetected(QString))); -//! [Receiving sensor gesture signals] -} - -void MyObject::gestureDetected(const QString &gesture) -{ - Q_UNUSED(gesture); -} - diff --git a/src/sensors/doc/snippets/sensorgestures/main.cpp b/src/sensors/doc/snippets/sensorgestures/main.cpp deleted file mode 100644 index dee1ecb6..00000000 --- a/src/sensors/doc/snippets/sensorgestures/main.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ - -int main(int /*argc*/, char ** /*argv*/) -{ - return 0; -} - diff --git a/src/sensors/doc/snippets/sensorgestures/myplugin.h b/src/sensors/doc/snippets/sensorgestures/myplugin.h deleted file mode 100644 index 0cf1a92b..00000000 --- a/src/sensors/doc/snippets/sensorgestures/myplugin.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 MYPLUGIN_H -#define MYPLUGIN_H - -#include <QObject> -#include <qsensorgestureplugininterface.h> -#include <qsensorgesturerecognizer.h> - -class MySensorGestureRecognizer : public QSensorGestureRecognizer -{ - Q_OBJECT - public: - - MySensorGestureRecognizer(QObject *parent = 0); - ~MySensorGestureRecognizer(); - - void create() override; - - QString id() const override; - bool start() override; - bool stop() override; - bool isActive() override; - -Q_SIGNALS: -// all signals will get exported to QSensorGesture - void mySignal(); -}; - -class MySensorGesturePlugin : public QObject, public QSensorGesturePluginInterface -{ - Q_OBJECT - //Q_PLUGIN_METADATA(IID "com.Nokia.QSensorGesturePluginInterface" FILE "plugin.json") - Q_INTERFACES(QSensorGesturePluginInterface) -public: - - explicit MySensorGesturePlugin(); - ~MySensorGesturePlugin(); - - QList<QSensorGestureRecognizer *> createRecognizers() override; - QStringList supportedIds() const override; - QString name() const override { return "MyGestures"; } -}; - -#endif diff --git a/src/sensors/doc/snippets/sensorgestures/plugin.cpp b/src/sensors/doc/snippets/sensorgestures/plugin.cpp deleted file mode 100644 index a94a188e..00000000 --- a/src/sensors/doc/snippets/sensorgestures/plugin.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "myplugin.h" - -#include <qsensorgestureplugininterface.h> -#include <qsensorgesturemanager.h> - -//! [Plugin] - -MySensorGestureRecognizer::MySensorGestureRecognizer(QObject *parent) - : QSensorGestureRecognizer(parent) -{ -} - -MySensorGestureRecognizer::~MySensorGestureRecognizer() -{ -} - -bool MySensorGestureRecognizer::start() -{ - Q_EMIT mySignal(); - return true; -} - -bool MySensorGestureRecognizer::stop() -{ - return true; -} - -bool MySensorGestureRecognizer::isActive() -{ - return true; -} - -void MySensorGestureRecognizer::create() -{ -} - -QString MySensorGestureRecognizer::id() const -{ - return QString("QtSensors.mygestures"); -} - - -MySensorGesturePlugin::MySensorGesturePlugin(){} -MySensorGesturePlugin::~MySensorGesturePlugin(){} - -QList <QSensorGestureRecognizer *> MySensorGesturePlugin::createRecognizers() -{ - QList <QSensorGestureRecognizer *> recognizers; - MySensorGestureRecognizer *recognizer = new MySensorGestureRecognizer(this); - recognizers.append(recognizer); - - return recognizers; -} - -QStringList MySensorGesturePlugin::supportedIds() const -{ - return QStringList() << "QtSensors.mygestures"; -} - -//! [Plugin] 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..27480020 --- /dev/null +++ b/src/sensors/doc/snippets/sensors/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +cmake_minimum_required(VERSION 3.16) +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 + start.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/creating.cpp b/src/sensors/doc/snippets/sensors/creating.cpp index 4a5ef06d..4c99066f 100644 --- a/src/sensors/doc/snippets/sensors/creating.cpp +++ b/src/sensors/doc/snippets/sensors/creating.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include <QObject> #include <qaccelerometer.h> @@ -57,7 +21,7 @@ QAccelerometer *sensor = new QAccelerometer(this); QOrientationSensor orient_sensor; //! [Creating a sensor] - Q_UNUSED(sensor) + Q_UNUSED(sensor); Q_UNUSED(orient_sensor); { @@ -69,7 +33,7 @@ Q_UNUSED(magnetometer); { //! [3] -QSensor *magnetometer = new QSensor(QMagnetometer::type, this); +QSensor *magnetometer = new QSensor(QMagnetometer::sensorType, this); //! [3] Q_UNUSED(magnetometer); } diff --git a/src/sensors/doc/snippets/sensors/main.cpp b/src/sensors/doc/snippets/sensors/main.cpp index dee1ecb6..fb6724d5 100644 --- a/src/sensors/doc/snippets/sensors/main.cpp +++ b/src/sensors/doc/snippets/sensors/main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause int main(int /*argc*/, char ** /*argv*/) { diff --git a/src/sensors/doc/snippets/sensors/mybackend.h b/src/sensors/doc/snippets/sensors/mybackend.h index 59c54069..b964e747 100644 --- a/src/sensors/doc/snippets/sensors/mybackend.h +++ b/src/sensors/doc/snippets/sensors/mybackend.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #ifndef MYBACKEND_H #define MYBACKEND_H diff --git a/src/sensors/doc/snippets/sensors/plugin.cpp b/src/sensors/doc/snippets/sensors/plugin.cpp index 1eef5966..27f50d72 100644 --- a/src/sensors/doc/snippets/sensors/plugin.cpp +++ b/src/sensors/doc/snippets/sensors/plugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "mybackend.h" #include <qsensorplugin.h> @@ -52,7 +16,7 @@ class MyPluginClass : public QObject, public QSensorPluginInterface, public QSen public: void registerSensors() override { - QSensorManager::registerBackend(QAccelerometer::type, MyBackend::id, this); + QSensorManager::registerBackend(QAccelerometer::sensorType, MyBackend::id, this); } QSensorBackend *createBackend(QSensor *sensor) override 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/sensors/start.cpp b/src/sensors/doc/snippets/sensors/start.cpp index 3ac5b50e..18c87d06 100644 --- a/src/sensors/doc/snippets/sensors/start.cpp +++ b/src/sensors/doc/snippets/sensors/start.cpp @@ -1,43 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -#include <qsensor.h> +#include <QtSensors/qsensor.h> +#include <QtCore/QMetaObject> +#include <QtCore/QMetaproperty> void start() { @@ -52,6 +18,42 @@ qreal x = reading->property("x").value<qreal>(); qreal y = reading->value(1).value<qreal>(); //! [Starting a sensor] - Q_UNUSED(x) - Q_UNUSED(y) + Q_UNUSED(x); + Q_UNUSED(y); } + +class MyObject : public QObject +{ + void findSensors() + { + //! [Find sensors] + QList<QSensor*> mySensorList; + for (const QByteArray &type : QSensor::sensorTypes()) { + qDebug() << "Found a sensor type:" << type; + for (const QByteArray &identifier : QSensor::sensorsForType(type)) { + qDebug() << " " << "Found a sensor of that type:" << identifier; + QSensor* sensor = new QSensor(type, this); + sensor->setIdentifier(identifier); + mySensorList.append(sensor); + } + } + //! [Find sensors] + //! [Print reading properties] + for (QSensor* sensor : mySensorList) { + const int firstProperty = QSensorReading::staticMetaObject.propertyOffset(); + // Connect to backend first in case start() hasn't been called yet + if (!sensor->connectToBackend()) + continue; + qDebug() << "Sensor" << sensor->identifier() << "reading properties:"; + QSensorReading *reading = sensor->reading(); + if (reading) { + const QMetaObject *mo = reading->metaObject(); + for (int i = firstProperty; i < mo->propertyCount(); ++i) { + QByteArray name = mo->property(i).name(); + qDebug() << " " << name << reading->property(name).toByteArray(); + } + } + } + //! [Print reading properties] + } +}; diff --git a/src/sensors/doc/snippets/sensors/tutorial.cpp b/src/sensors/doc/snippets/sensors/tutorial.cpp new file mode 100644 index 00000000..e8714961 --- /dev/null +++ b/src/sensors/doc/snippets/sensors/tutorial.cpp @@ -0,0 +1,25 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +//! [MySensor] +class MyReadingPrivate; + +class MyReading : public QSensorReading + { + Q_OBJECT + Q_PROPERTY(qreal myprop READ myprop) + DECLARE_READING(MyReading) +public: + qreal myprop() const; + void setMyprop(qreal myprop); + }; + +class MySensor : public QSensor +{ + Q_OBJECT +public: + explicit MySensor(QObject *parent = 0); + MyReading *reading() const; + static char const * const sensorType; + }; +//! [MySensor] 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/doc/src/compatmap.qdoc b/src/sensors/doc/src/compatmap.qdoc index 6db9f708..41f91a73 100644 --- a/src/sensors/doc/src/compatmap.qdoc +++ b/src/sensors/doc/src/compatmap.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Research In Motion -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 Research In Motion +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page compatmap.html @@ -40,11 +16,11 @@ </tr> <tr> <td bgcolor="green"></td> - <td>The feature is fully supported.</td> + <td>The sensor is supported.</td> </tr> <tr> <td bgcolor="gray"></td> - <td>The feature is not supported.</td> + <td>The sensor is not supported.</td> </tr> </tbody> </table> @@ -56,29 +32,15 @@ <td><b>Android</b></td> <td><b>Linux</b></td> <td><b>iOS</b></td> - <td><b>Universal Windows Platform</b></td> + <td><b>Windows</b></td> <td><b>Generic</b></td> - <td><b>Sensorfw</b></td> - <td><b>TI Sensor Tag</b></td> </tr> <tr> <td nowrap="nowrap">Accelerometer</td> <td bgcolor="green"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> <td bgcolor="gray"></td> <td bgcolor="green"></td> <td bgcolor="green"></td> - </tr> - <tr> - <td nowrap="nowrap">Altimeter</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> <td bgcolor="gray"></td> </tr> <tr> @@ -88,8 +50,6 @@ <td bgcolor="gray"></td> <td bgcolor="green"></td> <td bgcolor="green"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> </tr> <tr> <td nowrap="nowrap">Ambient Temperature Sensor</td> @@ -98,8 +58,6 @@ <td bgcolor="gray"></td> <td bgcolor="gray"></td> <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> </tr> <tr> <td nowrap="nowrap">Compass</td> @@ -108,18 +66,6 @@ <td bgcolor="green"></td> <td bgcolor="green"></td> <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> - </tr> - <tr> - <td nowrap="nowrap">Distance</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> </tr> <tr> <td nowrap="nowrap">Gyroscope</td> @@ -128,48 +74,6 @@ <td bgcolor="green"></td> <td bgcolor="green"></td> <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> - </tr> - <tr> - <td nowrap="nowrap">Holster Sensor</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - </tr> - <tr> - <td nowrap="nowrap">Humidity Sensor</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> - </tr> - <tr> - <td nowrap="nowrap">IR Proximity Sensor</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> - </tr> - <tr> - <td nowrap="nowrap">Lid Sensor</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> </tr> <tr> <td nowrap="nowrap">Light Sensor</td> @@ -178,8 +82,6 @@ <td bgcolor="gray"></td> <td bgcolor="gray"></td> <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> </tr> <tr> <td nowrap="nowrap">Magnetometer</td> @@ -188,8 +90,6 @@ <td bgcolor="green"></td> <td bgcolor="gray"></td> <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> </tr> <tr> <td nowrap="nowrap">Orientation Sensor</td> @@ -198,18 +98,14 @@ <td bgcolor="green"></td> <td bgcolor="green"></td> <td bgcolor="green"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> </tr> <tr> <td nowrap="nowrap">Pressure Sensor</td> <td bgcolor="green"></td> <td bgcolor="gray"></td> + <td bgcolor="green"></td> <td bgcolor="gray"></td> <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> </tr> <tr> <td nowrap="nowrap">Proximity Sensor</td> @@ -218,8 +114,6 @@ <td bgcolor="green"></td> <td bgcolor="gray"></td> <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> </tr> <tr> <td nowrap="nowrap">Rotation Sensor</td> @@ -228,18 +122,6 @@ <td bgcolor="green"></td> <td bgcolor="green"></td> <td bgcolor="green"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> - </tr> - <tr> - <td nowrap="nowrap">Tap Sensor</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> </tr> <tr> <td nowrap="nowrap">Tilt Sensor</td> @@ -248,30 +130,149 @@ <td bgcolor="green"></td> <td bgcolor="gray"></td> <td bgcolor="green"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - </tr> - <tr> - <td nowrap="nowrap">Sensor Gestures</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> </tr> + </tbody> </table> \endraw - 1) Support depends on the underlying platform + \raw DocBook +<db:informaltable cellpadding="2" cellspacing="1" border="1" width="90%"> + <db:tbody> + <db:tr> + <db:td>Color</db:td> + <db:td>Explanation</db:td> + </db:tr> + <db:tr> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td>The sensor is supported.</db:td> + </db:tr> + <db:tr> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td>The sensor is not supported.</db:td> + </db:tr> + </db:tbody> + </db:informaltable> + + + <db:informaltable cellpadding="2" cellspacing="1" border="1" rules="all" width="90%"> + <db:tbody> + <db:tr> + <db:td><db:emphasis role="bold">Feature</db:emphasis></db:td> + <db:td><db:emphasis role="bold">Android</db:emphasis></db:td> + <db:td><db:emphasis role="bold">Linux</db:emphasis></db:td> + <db:td><db:emphasis role="bold">iOS</db:emphasis></db:td> + <db:td><db:emphasis role="bold">Windows</db:emphasis></db:td> + <db:td><db:emphasis role="bold">Generic</db:emphasis></db:td> + </db:tr> + <db:tr> + <db:td>Accelerometer</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Ambient Light Sensor</db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + </db:tr> + <db:tr> + <db:td>Ambient Temperature Sensor</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Compass</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Gyroscope</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Light Sensor</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Magnetometer</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Orientation Sensor</db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + </db:tr> + <db:tr> + <db:td>Pressure Sensor</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Proximity Sensor</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Rotation Sensor</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + </db:tr> + <db:tr> + <db:td>Tilt Sensor</db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + </db:tr> + </db:tbody> + </db:informaltable> + \endraw In addition to the table above, each sensor type might support specific features. For example, a magnetometer might support returning geo values. See QSensor::isFeatureSupported() for additional details. - Sensor Gestures are mostly platform independent, and will run if the platform has the sensors required. - Whether they are supported and work well or not depends on the platform. -*/ + \section1 Platform specific notes + \section2 Windows + + The Windows backend is supported in Qt installations that were built with MSVC. + +*/ diff --git a/src/sensors/doc/src/genericbackend.qdoc b/src/sensors/doc/src/genericbackend.qdoc index 001fce77..2c314e6d 100644 --- a/src/sensors/doc/src/genericbackend.qdoc +++ b/src/sensors/doc/src/genericbackend.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Research In Motion -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 Research In Motion +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page genericbackend.html diff --git a/src/sensors/doc/src/porting.qdoc b/src/sensors/doc/src/porting.qdoc deleted file mode 100644 index 6f5d7ea4..00000000 --- a/src/sensors/doc/src/porting.qdoc +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtsensors-porting.html - \title Porting Applications from QtMobility Sensors to Qt Sensors - \brief Explain how to port from QtMobility Sensors to Qt Sensors - \since Qt 5.1 - - \tableofcontents - - \section1 Overview - - The initial release of Qt Sensors (5.0) is generally expected to be source - compatible with QtMobility Sensors 1.2. This document attempts to explain - where things need to be changed in order to port applications to Qt Sensors. - - \section1 QML - - In \c QtMobility, the C++ classes like \c QAccelerometer were directly used as QML types. - In Qt Sensors, there are now separate classes for the QML types, which have no public - C++ API. - - The new QML types in Qt Sensors fix some issues the former QtMobility QML types had, - for example: - \list - \li The reading types now have proper change notifications. - \li \c availableDataRates and \c outputRanges of the \c Sensor type are now proper list types. - \li The \c identifier and \c type properties of \c Sensor can now be used. - \li The \c lux property of \c LightSensorReading has been renamed to \c illuminance. - \li The \c QmlSensors singleton now allows to query for sensor types. - \endlist - - For more information, see the \l {Qt Sensors QML Types}{QML API} documentation. - - \section1 C++ - - The C++ API mainly remained the same as in QtMobility. - - \section2 Includes - - QtMobility Sensors installed headers into a \c Qt Sensors directory. This is - also the directory that Qt Sensors uses. It is therefore expected that includes - that worked with QtMobility Sensors should continue to work. - - For example: - \code - #include <QAccelerometer> - #include <qaccelerometer.h> - #include <QtSensors/QAccelerometer> - #include <QtSensors/qaccelerometer.h> - \endcode - - \section2 Macros and Namespace - - QtMobility Sensors was built in a \c QtMobility namespace. This was enabled by - the use of various macros. Qt Sensors does not normally build into a namespace - and the macros from QtMobility no longer exist. - - \list - \li QTM_BEGIN_NAMESPACE - \li QTM_END_NAMESPACE - \li QTM_USE_NAMESPACE - \li QTM_PREPEND_NAMESPACE(x) - \endlist - - Note that Qt can be configured to build into a namespace. If Qt is built in this - way then Qt Sensors is also built into the nominated namespace. However, as this - is optional, the macros for this are typically defined to do nothing. - - \list - \li QT_BEGIN_NAMESPACE - \li QT_END_NAMESPACE - \li QT_USE_NAMESPACE - \li QT_PREPEND_NAMESPACE(x) - \endlist - - \section2 qtimestamp - - qtimestamp was previously defined as an opaque type equivalent to a quint64. It existed - as a class due to an implementation detail. - - In Qt Sensors, the API uses quint64 instead of qtimestamp. qtimestamp still exists as a - typedef so that applications that refer to qtimestamp can be compiled. - - \section1 Project Files - - QtMobility Sensors applications used this in their project files to enable the Sensors API. - - \code - CONFIG += mobility - MOBILITY += sensors - \endcode - - Applications should remove these lines and instead use the following statement to enable - the Qt Sensors API: - - \code - QT += sensors - \endcode -*/ - diff --git a/src/sensors/doc/src/qt6-changes.qdoc b/src/sensors/doc/src/qt6-changes.qdoc new file mode 100644 index 00000000..de4f682b --- /dev/null +++ b/src/sensors/doc/src/qt6-changes.qdoc @@ -0,0 +1,94 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + \page qtsensors-changes-qt6.html + \title Changes to Qt Sensors + \ingroup changes-qt-5-to-6 + \brief Migrate Qt Sensors to Qt 6. + + Qt 6 is a result of the conscious effort to make the framework more + efficient and easy to use. + + We try to maintain binary and source compatibility for all the public + APIs in each release. But some changes were inevitable in an effort to + make Qt a better framework. + + In this topic we summarize those changes in Qt Sensors, and provide + guidance to handle them. + + \section1 Sensor Gesture support + + The Gesture support has been removed. In its current shape the gestures + needs rethinking to be of more use for the developers. To track this please + see \l {https://bugreports.qt.io/browse/QTBUG-95649}{QTBUG-95649}. + + \section1 Platform notes + + \section2 Windows + + On Windows, sensors are supported in Qt installations that were built with MSVC. + + \section2 sensorfw + + The \l {https://git.sailfishos.org/mer-core/sensorfw}{sensorfw} does not yet have + a Qt 6 port and is therefore not yet supported by sensors in Qt 6. + + \section2 TI Sensor Tag + + Support for TI Sensor Tag has been removed. + + \section2 Removed sensors + + QAltimeter, QDistanceSensor, QHolsterSensor and their QML counterparts + did no longer have a backend implementation and have been removed. + + QIRProximitySensor, QLidSensor, and QTapSensor have only sensorfw + backend, and as such they are not currently listed as supported sensor + types. + + \section2 Linux + + The Linux sysfs accelerometer support has been removed. The backend is + undocumented and has been without any real activity for almost 10 years. + + \section1 API changes + + \section2 Deleted typedef for qtimestamp + + The typedef for the historical, QtMobility-era, \c qtimestamp has been + removed. Use the actual type \c quint64 directly. + + \section2 Renamed \c sensor type string to \c sensorType + + The subclasses of QSensor implement a \c {char const*} string which defines + the string that identifies the base sensor. This static \c type field + shadowed the baseclass \l QSensor::type() method, leading to unnecessary + compilation errors and consequent workarounds. The \c type string has been + now renamed as \c sensorType. + + \section2 Renamed LidReading::backLidChanged property to \c backLidClosed + + The property name is now aligned with the \c frontLidClosed property of + the same QML type. + + \section2 Added parameter to QSensorBackend::sensorBusy() to be able to also clear + the busy state + + The \c QSensor::busy property and its accessor, \c QSensor::isBusy(), can be used + to check if the sensor is busy or not. To allow this property to better reflect the + sensor backend's state, QSensorBackend::sensorBusy() now accepts a boolean parameter. + This \c busy parameter is used to set/unset the backend busy state and notify the + QSensor interface attached to it. + + The default value for the QSensorBackend::sensorBusy() parameter is \e true which + results in the original behavior (except the added signal emission). This means + that in most if not all cases the changes are not mandatory. Instead it is up to the + individual sensor backend implementations to decide if the changes are useful. + + \section2 Sensor::type and and QSensor::type properties marked as constant + + The \c type property cannot change after instantiation and is marked as constant + in both C++ and QML. + +*/ diff --git a/src/sensors/doc/src/qtsensorgestures-cpp.qdoc b/src/sensors/doc/src/qtsensorgestures-cpp.qdoc deleted file mode 100644 index 164ffafb..00000000 --- a/src/sensors/doc/src/qtsensorgestures-cpp.qdoc +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\page qtsensorgestures-cpp.html -\title Sensor Gestures C++ Overview -\brief Explains how to use the QtSensorGestures C++ API - -\tableofcontents - -\section1 Using QtSensorGestures - -With the Sensor Gestures classes, you are able to easily utilize device gesturing using -sensors, such as the accelerometer and proximity. - -A list of currently supported sensor gestures and their descriptions can be found here: -\l {Qt Sensor Gestures} - -Using \c QtSensorGestures is easy. There are two main classes you will need to use: - -\list - \li QSensorGestureManager: can be used for determining which sensor gestures are available. - \li QSensorGesture : for connecting the sensor gesture signals. -\endlist - -\snippet sensorgestures/creating.cpp Receiving sensor gesture signals - -More information about the sensor gesture recognizers can be found in -\l{QtSensorGestures Plugins}. - -\section1 Main Classes - -The primary classes that make up the QtSensorGestures API: - -\annotatedlist sensorgestures_main - -The primary classes that make up the \c QtSensorGesturesRecognizers API: - -\annotatedlist sensorgestures_recognizer - -Details of the \c QSensorGesturePlugins available - -\annotatedlist sensorgesture_plugins_topics - -*/ - diff --git a/src/sensors/doc/src/qtsensorgestures-emulator.qdoc b/src/sensors/doc/src/qtsensorgestures-emulator.qdoc deleted file mode 100644 index 0c8bc659..00000000 --- a/src/sensors/doc/src/qtsensorgestures-emulator.qdoc +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ -/*! -\group sensorgesture_emulator_topics -\title QtSensorGestures Emulator -\brief Explains how to develop clients and recognizer plugins using QtSensorGestures - -\section1 Overview - -The Emulator can be used for both creating client apps using Qt's built-in sensor gestures, -and for creating customized recognizers. - -\section1 Developing Sensor Gesture Clients - -For instance, the Emulator can be used for writing a client app that needs -to use the "slam" gesture. - -Under the "Sensors" heading in the Emulator control, you will see an edit -box for "Sensor gestures" that will contain a list of signals available -when your client instantiates a QSensorGesture. - -Select "slam", and then click the "Send" button -to send a detected("slam") signal to the client. - -*/ diff --git a/src/sensors/doc/src/qtsensorgestures-plugins.qdoc b/src/sensors/doc/src/qtsensorgestures-plugins.qdoc deleted file mode 100644 index b181c16b..00000000 --- a/src/sensors/doc/src/qtsensorgestures-plugins.qdoc +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\group sensorgesture_plugins_topics -\title QtSensorGestures Plugins -\brief Explains how to develop recognizer plugins with QtSensorGestures - -The QtSensorGestures recognizer plugins are the way to create your own -sensor gestures. - -Creating software to recognize motion gestures using sensors is a huge subject not covered here. - -The QSensorGesture API does not limit usage to any of the common classification methods of gesture -recognition, such as Hidden Markov Models, Neural Networks, Dynamic Time Warping, or even the -ad-hoc heuristic recognizers of Qt's built-in sensor gesture recognizers. It's basically a -signaling system for lower level gesture recogition methods and algorithms to communicate to the -higher level applications. - -\tableofcontents - -\section1 Overview - - The steps for creating a sensor gesture plugin are as follows: -\list -\li Sub-class from QSensorGesturePluginInterface -\li Sub-class from QSensorGestureRecognizer and implement gesture recognizer logic using QtSensors. -\li Create an instance of that recognizer in the derived QSensorGesturePluginInterface class, and call - QSensorGestureManager::registerSensorGestureRecognizer(sRec); in your registerRecognizers() -function. QSensorGestureManager will retain ownership of the recognizer object. - -This is the class in which the gesture recognizer system should be implemented from. - -\endlist - -\snippet sensorgestures/plugin.cpp Plugin - - -\section2 Recognizer Classes - -If you are making sensorgestures available through the QtSensorGestures API, these are the -classes to subclass. - -\annotatedlist sensorgestures_recognizer - -\target Qt Sensor Gestures -\section3 Recognizer Plugins - -The Sensor Gesture Recognizers that come with Qt are made using an ad-hoc heuristic approach. -The user cannot define their own gestures, and must learn how to perform and accommodate the -pre-defined gestures herein. - -A developer may use any method, including computationally- and training-intensive well- -known classifiers, to produce gesture recognizers. There are currently no classes in Qt for -gesture training, nor is it possible for the user to define his own sensor-based motion gestures. - -A procedure for writing ad-hoc recognizers might include: -\list - \li Obtain and gather output from the accelerometer through \c QAccelerometerReading of a gesture being performed. - \li Use various methods and constraints on the accelerometer data to recognize the various states: - \list i - \li Initial "listening" state for a gesture - \li Start of a possible gesture, moving into a "detecting" state - \li End of a possible gesture, moving into a "recognizing" state - \li and finally, if it is recognized, the "recognized" state, or if not recognized, move back to - the "listening" state. - \endlist - \li Test procedure to make sure it is easy to perform, and will not - produce too many false positive recognitions, or collisions if used with other gestures. Meaning -that gestures performed get recognized as another gesture instead. - -\endlist - -Below you will find a list of included plugins and their signals. - -For the ShakeGestures plugin: - \table - \row - \li Recognizer Id - \li Signals - \row - \li QtSensors.shake - \li shake -\endtable - -For the QtSensorGestures plugin: - \table - \row - \li Recognizer Id - \li Signals - \li Description - \li Images - \row - \li QtSensors.cover - \li cover - \li Hand covers up phone display for one second, when it's face up, using the Proximity and Orientation sensors. - \li \image sensorgesture-cover.png - \row - \li QtSensors.doubletap - \li doubletap - \li Double tap of finger on phone, using the DoubleTap sensor. - \li \image sensorgesture-doubletap.png - \row - \li QtSensors.hover - \li hover - \li Hand hovers about 4 cm above the phone for more than 1 second, then is removed when face up, - using the IR Proximity sensor. - \li \image sensorgesture-hover.png - \row - \li QtSensors.pickup - \li pickup - \li Phone is resting face up on a flat curface, and is then picked up and brought up into viewing position. Uses the Accelerometer sensor. - \li \image sensorgesture-faceup.png - \row - \li QtSensors.shake2 - \li shakeLeft, shakeRight, shakeUp, shakeDown - \li Shake phone in a certain direction, using the Accelerometer sensor. - \li \image sensorgesture-shake.png - \row - \li QtSensors.slam - \li slam - \li Phone is held in a top up position with a side facing forward for a moment. Swing it quickly with a downward motion - like it is being used to point at something with the top corner. Uses the Accelerometer and Orientation sensors. - \li \image sensorgesture-slam_1.png - \image sensorgesture-slam_2.png - \row - \li QtSensors.turnover - \li turnover - \li Phone is turned face down and placed on a surface, using Proximity and Orientation sensors. - \li \image sensorgesture-facedown.png - \row - \li QtSensors.twist - \li twistLeft, twistRight - \li Phone is held face up and then twisted left or right (left side up or right side up) and back, using the Accelerometer and Orientation sensors. - \li \image sensorgesture-twist.png - \row - \li QtSensors.whip - \li whip - \li Move phone quickly down and then back up. Uses the Accelerometer and Orientation sensors. - \li \image sensorgesture-whip.png - \endtable - -*/ diff --git a/src/sensors/doc/src/qtsensors-backend.qdoc b/src/sensors/doc/src/qtsensors-backend.qdoc index 7e62186d..35945f61 100644 --- a/src/sensors/doc/src/qtsensors-backend.qdoc +++ b/src/sensors/doc/src/qtsensors-backend.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page sensors-backend-topics.html @@ -89,9 +65,9 @@ An example follows. Sensors was designed so that multiple sensors could exist for a given type. Why? Consider this example. -The N900 has an accelerometer built-in. It also features bluetooth and can pair -with a gaming controller that features an accelerometer. To a developer writing -a game these two devices are conceptually the same type. +An Android device has an accelerometer built-in. It also features bluetooth and +can pair with a gaming controller that features an accelerometer. To a developer +writing a game these two devices are conceptually the same type. \section1 Default Sensor for a Type @@ -109,21 +85,28 @@ instead. \section1 Sensors.conf -The config file that determines the default sensor for a type is called Sensors.conf. -If present, it is located in /etc/xdg/QtProject. It has the standard formatting -of an ini file. +The config file that determines the default sensor for a type is called +\e Sensors.conf. The configuration file is looked for from \e QtProject +directory under the directories given by +QStandardPaths::standardLocations(QStandardPaths::ConfigLocation). +An example of a complete file path is: +\badcode +/etc/xdg/QtProject/Sensors.conf +\endcode +The first found configuration file is used. +The configuration file has the standard formatting of an ini file. The settings live in the Default group and the general format is: \code type = identifier \endcode -An example: Sensors.conf ensures that the N900 accelerometer is used by default, -not considering the order in which backends were registered. +An example: Sensors.conf ensures that the \e sensorfw accelerometer is used by +default, ignoring the order in which backends were registered. \code [Default] -QAccelerometer = n900.accelerometer +QAccelerometer=sensorfw.accelerometer \endcode If Sensors.conf specifies an identifier that is not registered, the system will diff --git a/src/sensors/doc/src/qtsensors-cpp.qdoc b/src/sensors/doc/src/qtsensors-cpp.qdoc index d732a0dd..b70f8276 100644 --- a/src/sensors/doc/src/qtsensors-cpp.qdoc +++ b/src/sensors/doc/src/qtsensors-cpp.qdoc @@ -1,34 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtsensors-cpp.html \title Qt Sensors C++ Overview \brief Explains how to use the Qt Sensors C++ API. +\ingroup explanation \tableofcontents @@ -103,8 +80,18 @@ This code does not require any compile-time links to \l QAccelerometer or \snippet sensors/start.cpp Starting a sensor -You can discover all of this information at runtime too. The sensor_explorer example -shows you information about available sensors. +You can discover all of this information at runtime too. + +\section1 Discovering Sensors And Reading Properties At Runtime + +Sometimes it may be that the available sensors are not known at development time. +It is possible to find out which sensors are available as illustrated below: + +\snippet sensors/start.cpp Find sensors + +Furthermore it is possible to discover the reading details for these sensors, as illustrated below: + +\snippet sensors/start.cpp Print reading properties \section1 Front End, Back End diff --git a/src/sensors/doc/src/qtsensors-modules.qdoc b/src/sensors/doc/src/qtsensors-modules.qdoc new file mode 100644 index 00000000..7a4d29ba --- /dev/null +++ b/src/sensors/doc/src/qtsensors-modules.qdoc @@ -0,0 +1,58 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + + +/*! + \module QtSensors + \title Qt Sensors C++ Classes + \qtcmakepackage Sensors + \ingroup modules + \qtvariable sensors + + \brief Provides classes for reading sensor data. + + Mobile devices contain sensor hardware that allow detecting changes in various physical + properties of the device itself or its immediate environment. Examples of device properties + include the angle at which the device is held, whereas environmental properties include for + example the current level of ambient light. +*/ + +/*! + \qmlmodule QtSensors + \title Qt Sensors QML Types + \ingroup qmlmodules + + \brief Provides QML types for reading sensor data. + + \section1 QML Sensors Module API + + QmlSensors is a module API that provides information about currently + available sensors types, identifiers, and the default sensors. + + \qml + import QtSensors + // ... + Component.onCompleted: { + var types = QmlSensors.sensorTypes(); + console.log(types.join(", ")); + } + \endqml + + The documentation for the module API can be found in QmlSensors. + + \section1 QML Sensor Types + + These types represent specific types of sensors. + + Note that most properties come from the abstract \l{Sensor}{Sensor} element. + + \annotatedlist qml-sensors_type + + \section1 QML Reading Types + + The data from a sensor comes via a reading class. + + \annotatedlist qml-sensors_reading + + \section1 All QML Types +*/ diff --git a/src/sensors/doc/src/qtsensors-tutorial.qdoc b/src/sensors/doc/src/qtsensors-tutorial.qdoc new file mode 100644 index 00000000..147b8504 --- /dev/null +++ b/src/sensors/doc/src/qtsensors-tutorial.qdoc @@ -0,0 +1,36 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + \page qtsensors-tutorial.html + \title How to create your own Sensor + \brief Steps for creating your own sensors + + The Qt Sensors module provides access to sensor hardware via QML and C++ + interfaces. + + The API is supported on \l{Qt for Android}{Android}, \l{Qt for iOS}{iOS}, and + \l {Qt for Windows}{Windows (MSVC)}. + + \section1 Creating your own sensor using C++ API + + Using a Qt module's C++ API requires linking against the module library, either + directly or through other dependencies. + \section2 Creating a sensor + + To create your own sensor you can use the following steps: + + \list + \li Create your own MySensor and MySensorReading classes + \snippet sensors/tutorial.cpp MySensor + \li Create a MySensorBackend by inheriting from QSensorBackend + \li Create MySensorBackendFactory factory class for instantiating that + backend by inheriting a class QSensorBackendFactory + \li Register the backend factory by calling + QSensorManager::registerBackend ("MySensorType", "MySensorId", &myfactory) + \li Instantiate the new MySensor and start using it + \endlist + + As an another option the sensors are put into a \l {Creating a sensor plugin} + that you can use on demand. +*/ diff --git a/src/sensors/doc/src/qtsensors.qdoc b/src/sensors/doc/src/qtsensors.qdoc index cd03101a..c25349fd 100644 --- a/src/sensors/doc/src/qtsensors.qdoc +++ b/src/sensors/doc/src/qtsensors.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtsensors-index.html @@ -31,92 +7,67 @@ \brief Provides access to sensors via QML and C++ interfaces. \since 5.1 - The Qt Sensors API provides access to sensor hardware via QML and C++ interfaces. - The Qt Sensors API also provides a motion gesture recognition API for devices. - - Currently the API is supported on \l{Qt for Android}{Android}, - \l{Qt for iOS}{iOS}, \l{https://sailfishos.org}{SailFish} and \l{Qt for WinRT}{WinRT}. - - \section1 Information for Application Writers - - Applications can access Qt Sensors using QML or C++. - - \table - \row - \li \l {Qt Sensors QML Types}{QML Types} - \li Information about the Qt Sensors QML API - \row - \li \l {Qt Sensors C++ Classes}{C++ Classes} - \li Information about the Qt Sensors C++ API - \row - \li \l{Qt Sensors C++ Overview} - \li High-level information on how to use the C++ API. - \row - \li \l {Sensor Gestures C++ Overview} - \li High-level information specific to sensor gestures - \row - \li \l {Qt Sensors Examples}{Examples} - \li Examples demonstrating the use of the Qt Sensors APIs - \endtable - - \section1 Information for Backend Implementors - - \table - \row - \li \l {Qt Sensors Backend}{Backend} - \li Information about the Qt Sensors back end - \row - \li \l {Qt Sensors - Grue Sensor Example} - \li The Qt Sensors - Grue Sensor Example demonstrates creation of a sensor backend - \endtable - - \section1 Compatibility with QtMobility Sensors API - - Qt Sensors 5.0 (the initial release) is generally expected to be source compatible - with QtMobility Sensors 1.2. - - \table - \row - \li \l {Porting Applications from QtMobility Sensors to Qt Sensors}{Porting Guide} - \li Information about the steps needed to port applications to the Qt Sensors API. - \endtable - - \omit - \section1 Information for Qt SensorGestures API - - Qt SensorGestures provides a motion gesture recognition API for devices. - - \table - \row - \li \l {SensorGesture}{QML API} - \li Information about the Qt SensorGestures QML API - \row - \li \l {QtSensorGestures C++ API}{C++ API} - \li Information about the Qt SensorGestures C++ API - \endtable - - \section1 Information for Qt SensorGestures Recognizer Plugin Implementors - - \table - \row - \li \l {QtSensorGestures Plugins}{Plugins} - \li Information about the Qt SensorGestures recognizer plugins. - \row - \li \l {QtSensorGestures Emulator}{Emulator} - \li Information about Qt SensorGestures use in the Emulator. - \endtable - \endomit - - \section1 Platform-specific Information - \table - \row - \li \l {Compatibility Map}{Compatibility Map} - \li Compatibility map of all supported platforms. - \row - \li \l {Generic Backend}{Generic Backend} - \li Information about the generic sensor backend. - \row - \li \l {Sensorfw Backend}{Sensorfw Backend} - \li Information about the Sensorfw sensor backend. - \endtable + The Qt Sensors module provides access to sensor hardware via QML and C++ + interfaces. + + Currently, the API is supported on \l{Qt for Android}{Android}, + \l{Qt for iOS}{iOS}, and \l {Qt for Windows}{Windows (MSVC)}. + + \section1 Using the Module + + \section2 QML API + + \include {module-use.qdocinc} {using the qml api} {QtSensors} + + \section2 C++ API + + \include {module-use.qdocinc} {using the c++ api} + + \section3 Building with CMake + + \include {module-use.qdocinc} {building with cmake} {Sensors} + + \section3 Building with qmake + + \include {module-use.qdocinc} {building_with_qmake} {sensors} + + \section1 Articles and Guides + + \list + \li \l {Qt Sensors C++ Overview} + \li \l {Generic Backend} {Generic Backend} + \li \l {Qt Sensors Backend} + \li \l {Compatibility Map} {Compatibility Map} + \li \l {How to create your own Sensor} + \endlist + + \section1 Examples + + \list + \li \l {Qt Sensors Examples} {Examples} + \endlist + + \section1 API Reference + + \list + \li \l {Qt Sensors QML Types} {QML Types} + \li \l {Qt Sensors C++ Classes} {C++ Classes} + \endlist + + \section1 Module Evolution + \l{Changes to Qt Sensors} lists important changes in the module API + and functionality that were made for the Qt 6 series of Qt. + + \section1 Licenses and Attributions + + The Qt Sensors module is available under commercial licenses from + \l{The Qt Company}. In addition, it is available under free software licenses: + The \l{GNU Lesser General Public License, version 3}, or + the \l{GNU General Public License, version 2}. + See \l{Qt Licensing} for further details. + + Furthermore, Qt Sensors in Qt \QtVersion may contain third-party + modules under following permissive licenses: + + \generatelist{groupsbymodule attributions-qtsensors} */ diff --git a/src/sensors/doc/src/qtsensors5.qdoc b/src/sensors/doc/src/qtsensors5.qdoc deleted file mode 100644 index 688ff064..00000000 --- a/src/sensors/doc/src/qtsensors5.qdoc +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -/*! - \module QtSensors - \title Qt Sensors C++ Classes - \ingroup modules - \qtvariable sensors - - \brief Provides classes for reading sensor data. - - Mobile devices contain sensor hardware that allow detecting changes in various physical - properties of the device itself or its immediate environment. Examples of device properties - include the angle at which the device is held, whereas environmental properties include for - example the current level of ambient light. -*/ - -/*! - \qmlmodule QtSensors 5.11 - \title Qt Sensors QML Types - \ingroup qmlmodules - - \brief Provides types for reading sensor data. - - \section1 QML Module API - - If the module is imported into a namespace, some additional methods become available. - - \qml - import QtSensors 5.11 - // ... - Component.onCompleted: { - var types = QmlSensors.sensorTypes(); - console.log(types.join(", ")); - } - \endqml - - The documentation for the module API can be found in QmlSensors. - - \section1 QML Sensor Types - - These types represent specific types of sensors. - - Note that most properties come from the abstract \l{Sensor}{Sensor} element. - - \annotatedlist qml-sensors_type - - \section1 QML Reading Types - - The data from a sensor comes via a reading class. - - \annotatedlist qml-sensors_reading - - \section1 All QML Types -*/ diff --git a/src/sensors/doc/src/sensor-examples.qdoc b/src/sensors/doc/src/sensor-examples.qdoc index 769d8f69..8e8d8d75 100644 --- a/src/sensors/doc/src/sensor-examples.qdoc +++ b/src/sensors/doc/src/sensor-examples.qdoc @@ -1,35 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \group qtsensors-examples \title Qt Sensors Examples \brief Examples for the Qt Sensors module - \ingroup all-examples These are the Qt Sensors examples. diff --git a/src/sensors/doc/src/sensorfwbackend.qdoc b/src/sensors/doc/src/sensorfwbackend.qdoc index 21539bdb..4e3a980d 100644 --- a/src/sensors/doc/src/sensorfwbackend.qdoc +++ b/src/sensors/doc/src/sensorfwbackend.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Jolla Mobile -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 Jolla Mobile +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page senorfwbackend.html diff --git a/src/sensors/gestures/qsensorgesture.cpp b/src/sensors/gestures/qsensorgesture.cpp deleted file mode 100644 index b643998e..00000000 --- a/src/sensors/gestures/qsensorgesture.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 <QDir> -#include <QPluginLoader> -#include <QDebug> - -#include "qsensorgesture.h" -#include "qsensorgesture_p.h" -#include "qsensorgesturemanager.h" - -#include <private/qmetaobjectbuilder_p.h> - -/*! - \class QSensorGesture - \ingroup sensorgestures_main - \inmodule QtSensors - \since 5.1 - - \brief The QSensorGesture class represents one or more sensor gesture recognizers. - - In addition to the QSensorGesture::detected() signal, Sensor Gesture Recognizers can - have their own specific signals, and may be discovered through - QSensorGesture::gestureSignals(). - - \b {Note that QSensorGesture uses a custom meta-object in order to provide - recognizer-specific signals. This means it is not possible to sub-class - QSensorGesture and use Q_OBJECT. Also qobject_cast<QSensorGesture*>(ptr) will - not work.} - - \sa QSensorGestureRecognizer - - You may use QSensorGestureManager to obtain the systems known sensor gesture ids. - - \sa QSensorGestureManager - */ - -#ifdef Q_QDOC -/*! - \fn QSensorGesture::detected(QString gestureId) - Signals when the \a gestureId gesture has been recognized. - */ -#endif - -/*! - Constructs the sensor gesture, and initializes the \a ids list of recognizers, - with parent \a parent - */ -QSensorGesture::QSensorGesture(const QStringList &ids, QObject *parent) : - QObject(parent) -{ - d_ptr = new QSensorGesturePrivate(); - Q_FOREACH (const QString &id, ids) { - QSensorGestureRecognizer * rec = QSensorGestureManager::sensorGestureRecognizer(id); - if (rec != 0) { - d_ptr->m_sensorRecognizers.append(rec); - d_ptr->availableIds.append(id); - } else { - d_ptr->invalidIds.append(id); - //add to not available things - } - } - - d_ptr->meta = 0; - - QMetaObjectBuilder builder; - builder.setSuperClass(&QObject::staticMetaObject); - builder.setClassName("QSensorGesture"); - - Q_FOREACH (QSensorGestureRecognizer *recognizer, d_ptr->m_sensorRecognizers) { - Q_FOREACH (const QString &gesture, recognizer->gestureSignals()) { - QMetaMethodBuilder b = builder.addSignal(gesture.toLatin1()); - if (!d_ptr->localGestureSignals.contains(QLatin1String(b.signature()))) - d_ptr->localGestureSignals.append(QLatin1String(b.signature())); - } - recognizer->createBackend(); - } - d_ptr->meta = builder.toMetaObject(); - - if (d_ptr->m_sensorRecognizers.count() > 0) { - d_ptr->valid = true; - } -} - -/*! - Destroy the QSensorGesture - */ -QSensorGesture::~QSensorGesture() -{ - stopDetection(); - if (d_ptr->meta) - free(d_ptr->meta); - delete d_ptr; -} - -/*! - Returns the gesture recognizer ids that were found. - */ -QStringList QSensorGesture::validIds() const -{ - return d_ptr->availableIds; -} - -/*! - Returns the gesture recognizer ids that were not found. - */ -QStringList QSensorGesture::invalidIds() const -{ - return d_ptr->invalidIds; -} - -/*! - Starts the gesture detection routines in the recognizer. - */ -void QSensorGesture::startDetection() -{ - if (d_ptr->m_sensorRecognizers.count() < 1) - return; - if (d_ptr->isActive) - return; - - Q_FOREACH (QSensorGestureRecognizer *recognizer, d_ptr->m_sensorRecognizers) { - - Q_ASSERT(recognizer !=0); - - connect(recognizer,SIGNAL(detected(QString)), - this,SIGNAL(detected(QString)),Qt::UniqueConnection); - - //connect recognizer signals - Q_FOREACH (QString method, recognizer->gestureSignals()) { - method.prepend(QLatin1String("2")); - connect(recognizer, method.toLatin1(), - this, method.toLatin1(), Qt::UniqueConnection); - } - - recognizer->startBackend(); - } - d_ptr->isActive = true; -} - -/*! - Stops the gesture detection routines. - */ -void QSensorGesture::stopDetection() -{ - if (d_ptr->m_sensorRecognizers.count() < 1) - return; - - if (!d_ptr->isActive) - return; - - Q_FOREACH (QSensorGestureRecognizer *recognizer, d_ptr->m_sensorRecognizers) { - disconnect(recognizer,SIGNAL(detected(QString)), - this,SIGNAL(detected(QString))); - //disconnect recognizer signals - Q_FOREACH (QString method,recognizer->gestureSignals()) { - method.prepend(QLatin1String("2")); - disconnect(recognizer, method.toLatin1(), - this, method.toLatin1()); - } - - recognizer->stopBackend(); - } - d_ptr->isActive = false; -} - -/*! - Returns all the possible gestures signals that may be emitted. - */ -QStringList QSensorGesture::gestureSignals() const -{ - if (d_ptr->m_sensorRecognizers.count() > 0) { - return d_ptr->localGestureSignals; - } - return QStringList(); -} - -/*! - Returns whether this gesture is active or not. - */ - -bool QSensorGesture::isActive() -{ - return d_ptr->isActive; -} - -/*! - \internal -*/ -const QMetaObject* QSensorGesture::metaObject() const -{ - return d_ptr->meta; -} -/*! - \internal -*/ -int QSensorGesture::qt_metacall(QMetaObject::Call c, int id, void **a) -{ - id = QObject::qt_metacall(c, id, a); - - if (id < 0 || !d_ptr->meta) - return id; - - QMetaObject::activate(this, d_ptr->meta, id, a); - return id; -} - -QSensorGesturePrivate::QSensorGesturePrivate(QObject *parent) - : QObject(parent),isActive(0), valid(0) -{ -} - -QSensorGesturePrivate::~QSensorGesturePrivate() -{ - -} diff --git a/src/sensors/gestures/qsensorgesture.h b/src/sensors/gestures/qsensorgesture.h deleted file mode 100644 index de727954..00000000 --- a/src/sensors/gestures/qsensorgesture.h +++ /dev/null @@ -1,94 +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 QSENSORGESTURE_H -#define QSENSORGESTURE_H - -#include <QtCore/QObject> -#include <QtCore/QStringList> -#include <QtSensors/qsensorsglobal.h> - -#include <QtCore/QList> -#include <QtCore/QMap> -#include <QtCore/QVector> - -#include <QtCore/qmetatype.h> - -QT_BEGIN_NAMESPACE - -class QSensorGesturePrivate; - -class Q_SENSORS_EXPORT QSensorGesture : public QObject -{ - //Do not use Q_OBJECT here -public: - explicit QSensorGesture(const QStringList &ids, QObject *parent = Q_NULLPTR); - ~QSensorGesture(); - - bool isActive(); - - QStringList validIds() const; - QStringList invalidIds() const; - - QStringList gestureSignals() const; - - void startDetection(); - void stopDetection(); - -private: - QSensorGesturePrivate * d_ptr; - - // ### fixme: Qt 6: Make public to enable Qt for Python bindings -private: - // Pretend to be a Q_OBJECT - const QMetaObject *metaObject() const override; - int qt_metacall(QMetaObject::Call, int, void **) override; - -#ifdef Q_QDOC -Q_SIGNALS: - // these signals are created at runtime, along with - // gesture recognizer specific signals. - void detected(QString); -#endif -}; - -QT_END_NAMESPACE - - -#endif // QSENSORGESTURE_H diff --git a/src/sensors/gestures/qsensorgesture_p.h b/src/sensors/gestures/qsensorgesture_p.h deleted file mode 100644 index 9ec80c8b..00000000 --- a/src/sensors/gestures/qsensorgesture_p.h +++ /dev/null @@ -1,85 +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 QSENSORGESTURE_P_H -#define QSENSORGESTURE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// -#include <QtSensors/QSensor> -#include <QtSensors/QAccelerometer> -#include <QtSensors/QAccelerometerFilter> -#include <QTimer> - -#include "qsensorgesture.h" -#include "qsensorgesturemanager.h" -#include <QtCore/private/qmetaobjectbuilder_p.h> - -QT_BEGIN_NAMESPACE - -class QSensorGesturePrivate : public QObject -{ - -public: - QSensorGesturePrivate(QObject *parent = 0); - ~QSensorGesturePrivate(); - - QList<QSensorGestureRecognizer *> m_sensorRecognizers; - - QByteArray metadata; - QMetaObject* meta; - bool isActive; - QStringList localGestureSignals; - QStringList availableIds; - QStringList invalidIds; - bool valid; -}; - - -QT_END_NAMESPACE - -#endif // QSENSORGESTURE_P_H diff --git a/src/sensors/gestures/qsensorgesturemanager.cpp b/src/sensors/gestures/qsensorgesturemanager.cpp deleted file mode 100644 index e99be929..00000000 --- a/src/sensors/gestures/qsensorgesturemanager.cpp +++ /dev/null @@ -1,138 +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 "qsensorgesturemanager.h" -#include "qsensorgesturemanagerprivate_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QSensorGestureManager - \ingroup sensorgestures_main - \inmodule QtSensors - \since 5.1 - - \brief The QSensorGestureManager class manages sensor gestures, registers and creates sensor gesture plugins. - - Sensor Gesture plugins register their recognizers using the registerSensorGestureRecognizer() function. - - \snippet sensorgestures/creating.cpp Receiving sensor gesture signals -*/ - -/*! - \fn QSensorGestureManager::newSensorGestureAvailable() - Signals when a new sensor gesture becomes available for use. - */ - -/*! - Constructs the QSensorGestureManager as a child of \a parent - */ -QSensorGestureManager::QSensorGestureManager(QObject *parent) - : QObject(parent) -{ - QSensorGestureManagerPrivate *d = QSensorGestureManagerPrivate::instance(); - if (!d) return; // hardly likely but just in case... - connect(d,SIGNAL(newSensorGestureAvailable()), - this,SIGNAL(newSensorGestureAvailable())); -} - -/*! - Destroy the QSensorGestureManager -*/ -QSensorGestureManager::~QSensorGestureManager() -{ -} - -/*! - Registers the sensor recognizer \a recognizer for use. - QSensorGestureManager retains ownership of the recognizer object. - Returns true unless the gesture has already been registered, in - which case the object is deleted. - - */ - - bool QSensorGestureManager::registerSensorGestureRecognizer(QSensorGestureRecognizer *recognizer) - { - QSensorGestureManagerPrivate *d = QSensorGestureManagerPrivate::instance(); - if (!d) { // hardly likely but just in case... - delete recognizer; - return false; - } - bool ok = d->registerSensorGestureRecognizer(recognizer); - if (!ok) - delete recognizer; - - return ok; - } - - - /*! - Returns the list of the currently registered gestures. - Includes all the standard built-ins as well as available plugins. - */ - QStringList QSensorGestureManager::gestureIds() const - { - QSensorGestureManagerPrivate *d = QSensorGestureManagerPrivate::instance(); - if (!d) return QStringList(); // hardly likely but just in case... - return d->gestureIds(); - } - - /*! - Returns the list of all the gesture signals for the registered \a gestureId gesture recognizer id. - */ - QStringList QSensorGestureManager::recognizerSignals(const QString &gestureId) const - { - QSensorGestureRecognizer *recognizer = sensorGestureRecognizer(gestureId); - if (recognizer != 0) - return recognizer->gestureSignals(); - else - return QStringList(); - } - -/*! - Returns the sensor gesture object for the recognizer \a id. - */ -QSensorGestureRecognizer *QSensorGestureManager::sensorGestureRecognizer(const QString &id) -{ - QSensorGestureManagerPrivate *d = QSensorGestureManagerPrivate::instance(); - if (!d) return 0; // hardly likely but just in case... - return d->sensorGestureRecognizer(id); -} - -QT_END_NAMESPACE diff --git a/src/sensors/gestures/qsensorgesturemanager.h b/src/sensors/gestures/qsensorgesturemanager.h deleted file mode 100644 index 1ddc84c2..00000000 --- a/src/sensors/gestures/qsensorgesturemanager.h +++ /dev/null @@ -1,77 +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 QSENSORGESTUREMANAGER_P_H -#define QSENSORGESTUREMANAGER_P_H - -#include <QtCore/QObject> -#include <QtCore/QStringList> - -#include <QtSensors/qsensorgesture.h> -#include <QtSensors/qsensorgesturerecognizer.h> - -QT_BEGIN_NAMESPACE - -class QSensorGestureManagerPrivate; -class Q_SENSORS_EXPORT QSensorGestureManager : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QSensorGestureManager) - -public: - explicit QSensorGestureManager(QObject *parent = Q_NULLPTR); - - ~QSensorGestureManager(); - - bool registerSensorGestureRecognizer(QSensorGestureRecognizer *recognizer); - - QStringList gestureIds() const; - QStringList recognizerSignals(const QString &recognizerId) const; - - static QSensorGestureRecognizer *sensorGestureRecognizer(const QString &id); - -Q_SIGNALS: - void newSensorGestureAvailable(); - -}; - - -QT_END_NAMESPACE - -#endif // QSENSORGESTUREMANAGER_P_H diff --git a/src/sensors/gestures/qsensorgesturemanagerprivate.cpp b/src/sensors/gestures/qsensorgesturemanagerprivate.cpp deleted file mode 100644 index 81e87de0..00000000 --- a/src/sensors/gestures/qsensorgesturemanagerprivate.cpp +++ /dev/null @@ -1,244 +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 <QDir> -#include <QLibraryInfo> - -#include <QtCore/private/qfactoryloader_p.h> - -#include "qsensorgesturerecognizer.h" -#include "qsensorgesturemanagerprivate_p.h" -#include "qsensorgestureplugininterface.h" - -#ifdef SIMULATOR_BUILD -#include "simulatorgesturescommon_p.h" -#endif - -Q_GLOBAL_STATIC(QSensorGestureManagerPrivate, sensorGestureManagerPrivate) - -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(); -} - -QSensorGestureManagerPrivate::~QSensorGestureManagerPrivate() -{ -// qDeleteAll(registeredSensorGestures); -// delete loader; -} - - - void QSensorGestureManagerPrivate::initPlugin(QObject *plugin) -{ - if (QSensorGesturePluginInterface *pInterface - = qobject_cast<QSensorGesturePluginInterface *>(plugin)) { - - Q_FOREACH (const QString &id, pInterface->supportedIds()) { - - if (!knownIds.contains(id)) - knownIds.append(id); - else - qWarning() << id <<"from the plugin" - << pInterface->name() - << "is already known."; - - } - plugins << plugin; - } else { - qWarning() << "Could not load "<< plugin; - } -} - - -/*! - Internal - Loads the sensorgesture plugins. - */ -void QSensorGestureManagerPrivate::loadPlugins() -{ - Q_FOREACH (QObject *plugin, QPluginLoader::staticInstances()) { - initPlugin(plugin); - } - QList<QJsonObject> meta = loader->metaData(); - for (int i = 0; i < meta.count(); i++) { - QObject *plugin = loader->instance(i); - initPlugin(plugin); - } -} - - -/*! - Internal - creates the requested recognizer. - */ - -bool QSensorGestureManagerPrivate::loadRecognizer(const QString &recognizerId) -{ - //if no plugin is used return true if this is a registered recognizer - - if (registeredSensorGestures.contains(recognizerId)) - return true; - - for (int i= 0; i < plugins.count(); i++) { - - if (QSensorGesturePluginInterface *pInterface - = qobject_cast<QSensorGesturePluginInterface *>(plugins.at(i))) { - - if (pInterface->supportedIds().contains(recognizerId)) { - - if (!registeredSensorGestures.contains(recognizerId)) { - //create these recognizers - QList <QSensorGestureRecognizer *> recognizers = pInterface->createRecognizers(); - - Q_FOREACH (QSensorGestureRecognizer *recognizer, recognizers) { - - if (registeredSensorGestures.contains(recognizer->id())) { - qWarning() << "Ignoring recognizer " << recognizer->id() << "from plugin" << pInterface->name() << "because it is already registered"; - delete recognizer; - } else { - registeredSensorGestures.insert(recognizer->id(),recognizer); - } - } - } - return true; - } - } - } - return false; -} - -bool QSensorGestureManagerPrivate::registerSensorGestureRecognizer(QSensorGestureRecognizer *recognizer) -{ - if (!knownIds.contains(recognizer->id())) { - knownIds.append(recognizer->id()); - Q_ASSERT (!registeredSensorGestures.contains(recognizer->id())); - recognizer->setParent(0); - registeredSensorGestures.insert(recognizer->id(),recognizer); - Q_EMIT newSensorGestureAvailable(); - - return true; - } - return false; -} - -QSensorGestureRecognizer *QSensorGestureManagerPrivate::sensorGestureRecognizer(const QString &id) -{ - QSensorGestureRecognizer *recognizer = 0; - - if (loadRecognizer(id)) { - recognizer= registeredSensorGestures.value(id); - } - - return recognizer; -} - -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(); - // It's safe to return 0 because this is checked when used - //if (!priv) qFatal("Cannot return from QSensorGestureManagerPrivate::instance() because sensorGestureManagerPrivate() returned 0."); - return priv; -} - - -QT_END_NAMESPACE diff --git a/src/sensors/gestures/qsensorgesturemanagerprivate_p.h b/src/sensors/gestures/qsensorgesturemanagerprivate_p.h deleted file mode 100644 index 2ca4d648..00000000 --- a/src/sensors/gestures/qsensorgesturemanagerprivate_p.h +++ /dev/null @@ -1,111 +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 QSENSORGESTUREMANAGERPRIVATE_P_H -#define QSENSORGESTUREMANAGERPRIVATE_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 <QObject> -#include <QMap> -#include <QStringList> -#include <QDebug> -#include <QSharedPointer> -#include <QPluginLoader> - -#include "qsensorgesture.h" -#include "qsensorgesturerecognizer.h" - -QT_BEGIN_NAMESPACE - -class QFactoryLoader; - -class QSensorGestureManagerPrivate : public QObject -{ - Q_OBJECT -public: - explicit QSensorGestureManagerPrivate(QObject *parent = 0); - ~QSensorGestureManagerPrivate(); - - QMap<QString, QSensorGestureRecognizer *> registeredSensorGestures; - - QList <QObject *> plugins; - - QFactoryLoader *loader; - void loadPlugins(); - bool loadRecognizer(const QString &id); - - QSensorGestureRecognizer *sensorGestureRecognizer(const QString &id); - - bool registerSensorGestureRecognizer(QSensorGestureRecognizer *recognizer); - 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 - -#endif // QSENSORGESTUREMANAGERPRIVATE_P_H diff --git a/src/sensors/gestures/qsensorgestureplugininterface.cpp b/src/sensors/gestures/qsensorgestureplugininterface.cpp deleted file mode 100644 index c80862e3..00000000 --- a/src/sensors/gestures/qsensorgestureplugininterface.cpp +++ /dev/null @@ -1,97 +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 "qsensorgestureplugininterface.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QSensorGesturePluginInterface - \ingroup sensorgestures_recognizer - \inmodule QtSensors - - \brief The QSensorGesturePluginInterface class is the pure virtual interface to sensor gesture - plugins. - - \since 5.1 - - The QSensorGesturePluginInterface class is implemented in sensor gesture plugins to register - sensor gesture recognizers with QSensorGestureManager. - - \sa {QtSensorGestures Plugins} -*/ - -/*! - \fn QSensorGesturePluginInterface::createRecognizers() - - Called by the manager to create the recognizers. - Plugins should initialize and register their recognizers using - QSensorGestureManager::registerSensorGestureRecognizer() here. - - \sa QSensorGestureManager -*/ - -/*! - \fn QSensorGesturePluginInterface::supportedIds() const - - Returns a list of the recognizer Id's that this plugin supports. - */ - - -/*! - \fn QSensorGesturePluginInterface::name() const - - Returns this plugins name. - */ - -/*! - Construct the QSensorGesturePluginInterface. -*/ -QSensorGesturePluginInterface::QSensorGesturePluginInterface() -{ -} - -/*! - Destroy the QSensorGesturePluginInterface. -*/ -QSensorGesturePluginInterface::~QSensorGesturePluginInterface() -{ -} - -QT_END_NAMESPACE diff --git a/src/sensors/gestures/qsensorgestureplugininterface.h b/src/sensors/gestures/qsensorgestureplugininterface.h deleted file mode 100644 index 3de9ab84..00000000 --- a/src/sensors/gestures/qsensorgestureplugininterface.h +++ /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$ -** -****************************************************************************/ - -#ifndef QSENSORGESTUREPLUGININTERFACE_H -#define QSENSORGESTUREPLUGININTERFACE_H - -#include <QtCore/QObject> -#include <QtCore/QtGlobal> -#include <QtCore/qplugin.h> -#include <QtSensors/qsensorgesture.h> -#include <QtSensors/qsensorgesturerecognizer.h> - -QT_BEGIN_NAMESPACE - -class QSensorGestureRecognizer; - -class Q_SENSORS_EXPORT QSensorGesturePluginInterface -{ -public: - QSensorGesturePluginInterface(); - virtual ~QSensorGesturePluginInterface(); - virtual QList <QSensorGestureRecognizer *> createRecognizers() = 0; - virtual QStringList supportedIds() const = 0; - virtual QString name() const = 0; -}; - -Q_DECLARE_INTERFACE(QSensorGesturePluginInterface, "org.qt-project.QSensorGesturePluginInterface") - -QT_END_NAMESPACE - -#endif // QSENSORGESTUREPLUGININTERFACE_H diff --git a/src/sensors/gestures/qsensorgesturerecognizer.cpp b/src/sensors/gestures/qsensorgesturerecognizer.cpp deleted file mode 100644 index 9254da28..00000000 --- a/src/sensors/gestures/qsensorgesturerecognizer.cpp +++ /dev/null @@ -1,214 +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 "qsensorgesturerecognizer.h" -#include "qsensorgesture_p.h" - -#include "qsensorgesturemanager.h" -#ifdef SIMULATOR_BUILD -#include "qsensorgesturemanagerprivate_p.h" -#endif -QT_BEGIN_NAMESPACE - -/*! - \class QSensorGestureRecognizer - \ingroup sensorgestures_recognizer - \inmodule QtSensors - \since 5.1 - - \brief The QSensorGestureRecognizer class is the base class for a sensor gesture - recognizer. - - QSensorGesture recognizer developers should sub-class this to implement their own recognizer. - - All sensor gesture recognizers have a detected(QString) signal. Implementors can use this - and send recognizer specific gestures, such as detected("shake_left") or implement custom signals - such as shakeLeft(). - - These custom signals will be available in the QSensorGesture object at runtime. - - \sa QSensorGestureRecognizer::gestureSignals() - - */ - -/*! - \fn void QSensorGestureRecognizer::create() - - Called by QSensorGesture object constructor to create the recognizers backend. - - Implementors would use this to instantiate QSensors and connect signals. - - */ - -/*! - \fn QString QSensorGestureRecognizer::id() const - Returns the identifier for this recognizer. - */ -/*! - \fn bool QSensorGestureRecognizer::start() - - Called by QSensorGesture::startDetection() to start this recognizer. - Implementors should start the sensors. - Returns true if the operation is successful. - - */ -/*! - \fn bool QSensorGestureRecognizer::stop() - - Called by QSensorGesture::stopDetection() to stop this recognizer. - Returns true if the call succeeds, otherwise false. - - Implementors should stop the sensors. - - */ -/*! - \fn bool QSensorGestureRecognizer::isActive() - - Returns true if this recognizer is active, otherwise false. - */ - -/*! - \fn QSensorGestureRecognizer::detected(const QString &gestureId) - Signals when the gesture with id \a &gestureId been recognized. - */ - -class QSensorGestureRecognizerPrivate -{ -public: - bool initialized; - int count; -}; - - -/*! - Constructs the QSensorGestureRecognizer with \a parent as parent. - */ -QSensorGestureRecognizer::QSensorGestureRecognizer(QObject *parent) - :QObject(parent), - d_ptr(new QSensorGestureRecognizerPrivate()) -{ -} - -/*! - Destroy the QSensorGestureRecognizer -*/ -QSensorGestureRecognizer::~QSensorGestureRecognizer() -{ - delete d_ptr; -} - -/*! - Returns a list of signals that this recognizer supports. - - Note that all signals declared will be exported to the QSensorGesture - object. If you need to use signals that are not exported, you should use a private class - to do so. - - */ -QStringList QSensorGestureRecognizer::gestureSignals() const -{ - QStringList list; - bool ok = false; - for (int i = 0; i < this->metaObject()->methodCount(); i++) { - //weed out objectsignals and slots - const QByteArray sig(this->metaObject()->method(i).methodSignature()); - if (this->metaObject()->indexOfSignal(sig) != -1) { - if (sig.contains("detected")) - ok = true; - if (ok) - list.append(QString::fromLatin1(sig)); - } - } - return list; -} - -/*! - Calls QSensorGestureRecognizer::create() if the recognizer is valid. -*/ -void QSensorGestureRecognizer::createBackend() -{ - if (d_ptr->initialized) { - return; - } - d_ptr->initialized = true; - create(); -} - -/*! - Calls QSensorGestureRecognizer::start() if the recognizer isn't already initialized. - This is called by the QSensorGesture object, so please use that instead. - -\sa QSensorGesture::startDetection() - -*/ -void QSensorGestureRecognizer::startBackend() -{ - if (!d_ptr->initialized) { - qWarning() << "Not starting. Gesture Recognizer not initialized"; - return; - } - if (d_ptr->count++ == 0) { - start(); -#ifdef SIMULATOR_BUILD - QSensorGestureManagerPrivate::instance()->recognizerStarted(this); -#endif - } -} - -/*! - Calls QSensorGestureRecognizer::stop() if no other clients are using it. - This is called by the QSensorGesture object, so please use that instead. - -\sa QSensorGesture::stopDetection() -*/ -void QSensorGestureRecognizer::stopBackend() -{ - if (!d_ptr->initialized) { - qWarning() << "Not stopping. Gesture Recognizer not initialized"; - return; - } - if (--d_ptr->count == 0) { - stop(); -#ifdef SIMULATOR_BUILD - QSensorGestureManagerPrivate::instance()->recognizerStopped(this); -#endif - } -} - -QT_END_NAMESPACE diff --git a/src/sensors/gestures/qsensorgesturerecognizer.h b/src/sensors/gestures/qsensorgesturerecognizer.h deleted file mode 100644 index 27181983..00000000 --- a/src/sensors/gestures/qsensorgesturerecognizer.h +++ /dev/null @@ -1,83 +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 QSENSORGESTURERECOGNIZER_H -#define QSENSORGESTURERECOGNIZER_H - -#include <QtCore/QDebug> -#include <QtCore/QTimer> -#include <QtCore/QStringList> - -#include <QtSensors/qsensorgesture.h> - -QT_BEGIN_NAMESPACE - -class QSensorGestureRecognizerPrivate; -class Q_SENSORS_EXPORT QSensorGestureRecognizer : public QObject -{ - Q_OBJECT -public: - explicit QSensorGestureRecognizer(QObject *parent = Q_NULLPTR); - virtual ~QSensorGestureRecognizer(); - - virtual QString id() const = 0; - - virtual bool isActive() = 0; - - void startBackend(); - void stopBackend(); - void createBackend(); - - QStringList gestureSignals() const; - -Q_SIGNALS: - void detected(const QString &); - -protected: - virtual void create() = 0; - virtual bool start() = 0; - virtual bool stop() = 0; - -private: - QSensorGestureRecognizerPrivate * d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QSENSORGESTURERECOGNIZER_H 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 <QtSimulator/version.h> -#include <QtSimulator/QtSimulator> - -#include <QDebug> -#include <QStringList> - -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 <QtSimulator/connection.h> -#include <QtSimulator/connectionworker.h> -#include <QStringList> - -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/make_sensor.pl b/src/sensors/make_sensor.pl index bfa81472..74213f09 100755 --- a/src/sensors/make_sensor.pl +++ b/src/sensors/make_sensor.pl @@ -1,42 +1,25 @@ #!/usr/bin/perl -############################################################################# -## -## 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$ -## -############################################################################# +# Copyright (C) 2021 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +# About this script +# +# The make_sensor.pl creates new sensor frontend placeholder implementations. +# Both C++ and QML classes are generated. As the script makes assumptions on the +# naming conventions and source file locations, the main +# intended use case is adding new sensor frontends to the QtSensors module. +# +# To run the script, provide the sensor name starting with 'Q' as an argument +# (here "QFlow"): +# +# perl make_sensor.pl QFlow +# +# This will generate the following files: +# ../sensorsquick/qmlflow_p.h +# ../sensorsquick/qmlflow.cpp +# qflow_p.h +# qflow.h +# qflow.cpp use strict; use warnings; @@ -75,8 +58,8 @@ $qmlfilebase = "qml".$qmlfilebase; my $pheader = $filebase."_p.h"; my $header = $filebase.".h"; my $source = $filebase.".cpp"; -my $qmlsource = "../imports/sensors/".$qmlfilebase.".cpp"; -my $qmlheader = "../imports/sensors/".$qmlfilebase.".h"; +my $qmlsource = "../sensorsquick/".$qmlfilebase.".cpp"; +my $qmlheader = "../sensorsquick/".$qmlfilebase."_p.h"; my $pguard = uc($pheader); $pguard =~ s/\./_/g; @@ -93,45 +76,53 @@ if (! -e $qmlheader) { #ifndef '.$qmlguard.' #define '.$qmlguard.' -#include "qmlsensor.h" +#include "qmlsensor_p.h" QT_BEGIN_NAMESPACE class '.$sensor.'; -class '.$qmlsensor.' : public QmlSensor +class Q_SENSORSQUICK_EXPORT '.$qmlsensor.' : public QmlSensor { Q_OBJECT + QML_NAMED_ELEMENT('.$no_q_sensor.') + QML_ADDED_IN_VERSION(6,2) // CHANGE VERSION public: explicit '.$qmlsensor.'(QObject *parent = 0); ~'.$qmlsensor.'(); -private: QSensor *sensor() const override; + +private: QmlSensorReading *createReading() const override; '.$sensor.' *m_sensor; }; -class '.$qmlreading.' : public QmlSensorReading +class Q_SENSORSQUICK_EXPORT '.$qmlreading.' : public QmlSensorReading { Q_OBJECT - Q_PROPERTY(qreal prop1 READ prop1 NOTIFY prop1Changed) + Q_PROPERTY(qreal myprop READ myprop NOTIFY mypropChanged BINDABLE bindableMyprop) + QML_NAMED_ELEMENT('.$no_q_reading.') + QML_UNCREATABLE("Cannot create '.$no_q_reading.'") + QML_ADDED_IN_VERSION(6,2) // CHANGE VERSION public: explicit '.$qmlreading.'('.$sensor.' *sensor); ~'.$qmlreading.'(); - qreal prop1() const; + qreal myprop() const; + QBindable<qreal> bindableMyprop() const; Q_SIGNALS: - void prop1Changed(); + void mypropChanged(); private: QSensorReading *reading() const override; void readingUpdate() override; '.$sensor.' *m_sensor; - qreal m_prop1; + Q_OBJECT_BINDABLE_PROPERTY('.$qmlreading.', qreal, + m_myprop, &'.$qmlreading.'::mypropChanged); }; QT_END_NAMESPACE @@ -144,7 +135,7 @@ if (! -e $qmlsource) { print "Creating $qmlsource\n"; open OUT, ">$qmlsource" or die $!; print OUT ' -#include "qml'.lc($no_q_sensor).'.h" +#include "qml'.lc($no_q_sensor).'_p.h" #include <'.$sensor.'> /*! @@ -152,7 +143,7 @@ if (! -e $qmlsource) { \instantiates '.$qmlsensor.' \ingroup qml-sensors_type \inqmlmodule QtSensors - \since QtSensors 5.[INSERT VERSION HERE] + \since QtSensors 6.[INSERT VERSION HERE] \inherits Sensor \brief The '.$no_q_sensor.' element reports on fubbleness. @@ -189,7 +180,7 @@ QSensor *'.$qmlsensor.'::sensor() const \instantiates '.$qmlreading.' \ingroup qml-sensors_reading \inqmlmodule QtSensors - \since QtSensors 5.[INSERT VERSION HERE] + \since QtSensors 6.[INSERT VERSION HERE] \inherits SensorReading \brief The '.$no_q_reading.' element holds the most recent '.$no_q_sensor.' reading. @@ -202,9 +193,7 @@ QSensor *'.$qmlsensor.'::sensor() const */ '.$qmlreading.'::'.$qmlreading.'('.$sensor.' *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) - , m_prop1(0) + : m_sensor(sensor) { } @@ -213,15 +202,20 @@ QSensor *'.$qmlsensor.'::sensor() const } /*! - \qmlproperty qreal '.$no_q_reading.'::prop1 + \qmlproperty qreal '.$no_q_reading.'::myprop This property holds the fubble of the device. - Please see '.$reading.'::prop1 for information about this property. + Please see '.$reading.'::myprop for information about this property. */ -qreal '.$qmlreading.'::prop1() const +qreal '.$qmlreading.'::myprop() const { - return m_prop1; + return m_myprop; +} + +QBindable<qreal> '.$qmlreading.'::bindableMyprop() const +{ + return &m_myprop; } QSensorReading *'.$qmlreading.'::reading() const @@ -231,11 +225,7 @@ QSensorReading *'.$qmlreading.'::reading() const void '.$qmlreading.'::readingUpdate() { - qreal prop1 = m_sensor->reading()->prop1(); - if (m_prop1 != prop1) { - m_prop1 = prop1; - Q_EMIT prop1Changed(); - } + m_myprop = m_sensor->reading()->myprop(); } '; close OUT; @@ -323,7 +313,7 @@ public: explicit '.$sensor.'(QObject *parent = 0); ~'.$sensor.'(); '.$reading.' *reading() const; - static char const * const type; + static char const * const sensorType; private: Q_DISABLE_COPY('.$sensor.') @@ -351,7 +341,7 @@ IMPLEMENT_READING('.$reading.') \class '.$reading.' \ingroup sensors_reading \inmodule QtSensors - \since 5.[INSERT VERSION HERE] + \since 6.[INSERT VERSION HERE] \brief The '.$reading.' class holds readings from the [X] sensor. @@ -389,7 +379,7 @@ void '.$reading.'::setMyprop(qreal myprop) \class '.$filter.' \ingroup sensors_filter \inmodule QtSensors - \since 5.[INSERT VERSION HERE] + \since 6.[INSERT VERSION HERE] \brief The '.$filter.' class is a convenience wrapper around QSensorFilter. @@ -410,13 +400,13 @@ bool '.$filter.'::filter(QSensorReading *reading) return filter(static_cast<'.$reading.'*>(reading)); } -char const * const '.$sensor.'::type("'.$sensor.'"); +char const * const '.$sensor.'::sensorType("'.$sensor.'"); /*! \class '.$sensor.' \ingroup sensors_type \inmodule QtSensors - \since 5.[INSERT VERSION HERE] + \since 6.[INSERT VERSION HERE] \brief The '.$sensor.' class is a convenience wrapper around QSensor. @@ -433,7 +423,7 @@ char const * const '.$sensor.'::type("'.$sensor.'"); Construct the sensor as a child of \a parent. */ '.$sensor.'::'.$sensor.'(QObject *parent) - : QSensor('.$sensor.'::type, parent) + : QSensor('.$sensor.'::sensorType, parent) { } @@ -469,8 +459,7 @@ exit 0; sub get_arg { if (scalar(@ARGV) == 0) { - croak "Missing arg(s)"; + croak "Missing sensor name argument (e.g. 'QFlow')"; } return shift(@ARGV); } - diff --git a/src/sensors/qaccelerometer.cpp b/src/sensors/qaccelerometer.cpp index 4f89f997..685b3e16 100644 --- a/src/sensors/qaccelerometer.cpp +++ b/src/sensors/qaccelerometer.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qaccelerometer.h" #include "qaccelerometer_p.h" @@ -155,7 +119,7 @@ bool QAccelerometerFilter::filter(QSensorReading *reading) return filter(static_cast<QAccelerometerReading*>(reading)); } -char const * const QAccelerometer::type("QAccelerometer"); +char const * const QAccelerometer::sensorType("QAccelerometer"); /*! \enum QAccelerometer::AccelerationMode @@ -205,7 +169,7 @@ char const * const QAccelerometer::type("QAccelerometer"); Construct the sensor as a child of \a parent. */ QAccelerometer::QAccelerometer(QObject *parent) - : QSensor(QAccelerometer::type, *new QAccelerometerPrivate, parent) + : QSensor(QAccelerometer::sensorType, *new QAccelerometerPrivate, parent) { } diff --git a/src/sensors/qaccelerometer.h b/src/sensors/qaccelerometer.h index a44971f2..ac2e29fb 100644 --- a/src/sensors/qaccelerometer.h +++ b/src/sensors/qaccelerometer.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QACCELEROMETER_H #define QACCELEROMETER_H @@ -77,11 +41,10 @@ class QAccelerometerPrivate; class Q_SENSORS_EXPORT QAccelerometer : public QSensor { Q_OBJECT - Q_ENUMS(AccelerationMode) Q_PROPERTY(AccelerationMode accelerationMode READ accelerationMode WRITE setAccelerationMode NOTIFY accelerationModeChanged) public: - explicit QAccelerometer(QObject *parent = Q_NULLPTR); + explicit QAccelerometer(QObject *parent = nullptr); virtual ~QAccelerometer(); // Keep this enum in sync with QmlAccelerometer::AccelerationMode @@ -90,12 +53,13 @@ public: Gravity, User }; + Q_ENUM(AccelerationMode) AccelerationMode accelerationMode() const; void setAccelerationMode(AccelerationMode accelerationMode); QAccelerometerReading *reading() const; - static char const * const type; + static char const * const sensorType; Q_SIGNALS: void accelerationModeChanged(AccelerationMode accelerationMode); @@ -108,4 +72,3 @@ private: QT_END_NAMESPACE #endif - diff --git a/src/sensors/qaccelerometer_p.h b/src/sensors/qaccelerometer_p.h index fece405b..c39c1947 100644 --- a/src/sensors/qaccelerometer_p.h +++ b/src/sensors/qaccelerometer_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QACCELEROMETER_P_H #define QACCELEROMETER_P_H diff --git a/src/sensors/qaltimeter.cpp b/src/sensors/qaltimeter.cpp deleted file mode 100644 index 7092870d..00000000 --- a/src/sensors/qaltimeter.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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 <qaltimeter.h> -#include "qaltimeter_p.h" - -QT_BEGIN_NAMESPACE - -IMPLEMENT_READING(QAltimeterReading) - -/*! - \class QAltimeterReading - \ingroup sensors_reading - \inmodule QtSensors - \since 5.1 - - \brief The QAltimeterReading class holds readings from the altimeter sensor. - - The altitude is reported in meters relative to mean sea level. -*/ - -/*! - \property QAltimeterReading::altitude - \brief The altitude in meters relative to mean sea level. -*/ - -qreal QAltimeterReading::altitude() const -{ - return d->altitude; -} - -/*! - Sets the altitude to \a altitude. -*/ -void QAltimeterReading::setAltitude(qreal altitude) -{ - d->altitude = altitude; -} - -// ===================================================================== - -/*! - \class QAltimeterFilter - \ingroup sensors_filter - \inmodule QtSensors - \since 5.1 - - \brief The QAltimeterFilter class is a convenience wrapper around QSensorFilter. - - The only difference is that the filter() method features a pointer to QAltimeterReading - instead of QSensorReading. -*/ - -/*! - \fn QAltimeterFilter::filter(QAltimeterReading *reading) - - Called when \a reading changes. Returns false to prevent the reading from propagating. - - \sa QSensorFilter::filter() -*/ - -bool QAltimeterFilter::filter(QSensorReading *reading) -{ - return filter(static_cast<QAltimeterReading*>(reading)); -} - -char const * const QAltimeter::type("QAltimeter"); - -/*! - \class QAltimeter - \ingroup sensors_type - \inmodule QtSensors - \since 5.1 - - \brief The QAltimeter class is a convenience wrapper around QSensor. - - The only behavioural difference is that this class sets the type properly. - - This class also features a reading() function that returns a QAltimeterReading instead of a QSensorReading. - - For details about how the sensor works, see \l QAltimeterReading. - - \sa QAltimeterReading -*/ - -/*! - Construct the sensor as a child of \a parent. -*/ -QAltimeter::QAltimeter(QObject *parent) - : QSensor(QAltimeter::type, parent) -{ -} - -/*! - Destroy the sensor. Stops the sensor if it has not already been stopped. -*/ -QAltimeter::~QAltimeter() -{ -} - -/*! - \fn QAltimeter::reading() const - - Returns the reading class for this sensor. - - \sa QSensor::reading() -*/ - -QAltimeterReading *QAltimeter::reading() const -{ - return static_cast<QAltimeterReading*>(QSensor::reading()); -} - -QT_END_NAMESPACE - -#include "moc_qaltimeter.cpp" diff --git a/src/sensors/qaltimeter.h b/src/sensors/qaltimeter.h deleted file mode 100644 index 50c9e83b..00000000 --- a/src/sensors/qaltimeter.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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 QALTIMETER_H -#define QALTIMETER_H - -#include <QtSensors/qsensor.h> - -QT_BEGIN_NAMESPACE - -class QAltimeterReadingPrivate; - -class Q_SENSORS_EXPORT QAltimeterReading : public QSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal altitude READ altitude) - DECLARE_READING(QAltimeterReading) -public: - qreal altitude() const; - void setAltitude(qreal altitude); -}; - -class Q_SENSORS_EXPORT QAltimeterFilter : public QSensorFilter -{ -public: - virtual bool filter(QAltimeterReading *reading) = 0; -private: - bool filter(QSensorReading *reading) override; -}; - -class Q_SENSORS_EXPORT QAltimeter : public QSensor -{ - Q_OBJECT -public: - explicit QAltimeter(QObject *parent = Q_NULLPTR); - ~QAltimeter(); - QAltimeterReading *reading() const; - static char const * const type; - -private: - Q_DISABLE_COPY(QAltimeter) -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/sensors/qaltimeter_p.h b/src/sensors/qaltimeter_p.h deleted file mode 100644 index b1231c24..00000000 --- a/src/sensors/qaltimeter_p.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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 QALTIMETER_P_H -#define QALTIMETER_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. -// - -QT_BEGIN_NAMESPACE - -class QAltimeterReadingPrivate -{ -public: - QAltimeterReadingPrivate() - : altitude(0) - { - } - - qreal altitude; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/sensors/qambientlightsensor.cpp b/src/sensors/qambientlightsensor.cpp index dd86ae2e..c7bec4c7 100644 --- a/src/sensors/qambientlightsensor.cpp +++ b/src/sensors/qambientlightsensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qambientlightsensor.h" #include "qambientlightsensor_p.h" @@ -131,7 +95,7 @@ bool QAmbientLightFilter::filter(QSensorReading *reading) return filter(static_cast<QAmbientLightReading*>(reading)); } -char const * const QAmbientLightSensor::type("QAmbientLightSensor"); +char const * const QAmbientLightSensor::sensorType("QAmbientLightSensor"); /*! \class QAmbientLightSensor @@ -154,7 +118,7 @@ char const * const QAmbientLightSensor::type("QAmbientLightSensor"); Construct the sensor as a child of \a parent. */ QAmbientLightSensor::QAmbientLightSensor(QObject *parent) - : QSensor(QAmbientLightSensor::type, parent) + : QSensor(QAmbientLightSensor::sensorType, parent) { } diff --git a/src/sensors/qambientlightsensor.h b/src/sensors/qambientlightsensor.h index 9d1acec9..962cf4aa 100644 --- a/src/sensors/qambientlightsensor.h +++ b/src/sensors/qambientlightsensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QAMBIENTLIGHTSENSOR_H #define QAMBIENTLIGHTSENSOR_H @@ -49,7 +13,6 @@ class QAmbientLightReadingPrivate; class Q_SENSORS_EXPORT QAmbientLightReading : public QSensorReading { Q_OBJECT - Q_ENUMS(LightLevel) Q_PROPERTY(LightLevel lightLevel READ lightLevel) DECLARE_READING(QAmbientLightReading) public: @@ -61,6 +24,7 @@ public: Bright, Sunny }; + Q_ENUM(LightLevel) LightLevel lightLevel() const; void setLightLevel(LightLevel lightLevel); @@ -78,10 +42,10 @@ class Q_SENSORS_EXPORT QAmbientLightSensor : public QSensor { Q_OBJECT public: - explicit QAmbientLightSensor(QObject *parent = Q_NULLPTR); + explicit QAmbientLightSensor(QObject *parent = nullptr); virtual ~QAmbientLightSensor(); QAmbientLightReading *reading() const; - static char const * const type; + static char const * const sensorType; private: Q_DISABLE_COPY(QAmbientLightSensor) @@ -90,4 +54,3 @@ private: QT_END_NAMESPACE #endif - diff --git a/src/sensors/qambientlightsensor_p.h b/src/sensors/qambientlightsensor_p.h index ed0a8c26..ace40c33 100644 --- a/src/sensors/qambientlightsensor_p.h +++ b/src/sensors/qambientlightsensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QAMBIENTLIGHTSENSOR_P_H #define QAMBIENTLIGHTSENSOR_P_H @@ -51,6 +15,8 @@ // We mean it. // +#include <QtCore/private/qglobal_p.h> + QT_BEGIN_NAMESPACE class QAmbientLightReadingPrivate diff --git a/src/sensors/qambienttemperaturesensor.cpp b/src/sensors/qambienttemperaturesensor.cpp index 53cce0a9..7c94a66d 100644 --- a/src/sensors/qambienttemperaturesensor.cpp +++ b/src/sensors/qambienttemperaturesensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Research In Motion +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <qambienttemperaturesensor.h> #include "qambienttemperaturesensor_p.h" @@ -101,7 +65,7 @@ bool QAmbientTemperatureFilter::filter(QSensorReading *reading) return filter(static_cast<QAmbientTemperatureReading*>(reading)); } -char const * const QAmbientTemperatureSensor::type("QAmbientTemperatureSensor"); +char const * const QAmbientTemperatureSensor::sensorType("QAmbientTemperatureSensor"); /*! \class QAmbientTemperatureSensor @@ -124,7 +88,7 @@ char const * const QAmbientTemperatureSensor::type("QAmbientTemperatureSensor"); Construct the sensor as a child of \a parent. */ QAmbientTemperatureSensor::QAmbientTemperatureSensor(QObject *parent) - : QSensor(QAmbientTemperatureSensor::type, parent) + : QSensor(QAmbientTemperatureSensor::sensorType, parent) { } diff --git a/src/sensors/qambienttemperaturesensor.h b/src/sensors/qambienttemperaturesensor.h index 4198b15a..f31916fd 100644 --- a/src/sensors/qambienttemperaturesensor.h +++ b/src/sensors/qambienttemperaturesensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Research In Motion +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QAMBIENTTEMPERATURESENSOR_H #define QAMBIENTTEMPERATURESENSOR_H @@ -67,10 +31,10 @@ class Q_SENSORS_EXPORT QAmbientTemperatureSensor : public QSensor { Q_OBJECT public: - explicit QAmbientTemperatureSensor(QObject *parent = Q_NULLPTR); + explicit QAmbientTemperatureSensor(QObject *parent = nullptr); ~QAmbientTemperatureSensor(); QAmbientTemperatureReading *reading() const; - static char const * const type; + static char const * const sensorType; private: Q_DISABLE_COPY(QAmbientTemperatureSensor) diff --git a/src/sensors/qambienttemperaturesensor_p.h b/src/sensors/qambienttemperaturesensor_p.h index 7847925e..177dd267 100644 --- a/src/sensors/qambienttemperaturesensor_p.h +++ b/src/sensors/qambienttemperaturesensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Research In Motion +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QAMBIENTTEMPERATURESENSOR_P_H #define QAMBIENTTEMPERATURESENSOR_P_H @@ -50,6 +14,8 @@ // We mean it. // +#include <QtCore/private/qglobal_p.h> + QT_BEGIN_NAMESPACE class QAmbientTemperatureReadingPrivate diff --git a/src/sensors/qcompass.cpp b/src/sensors/qcompass.cpp index 5bd2101b..cb689c30 100644 --- a/src/sensors/qcompass.cpp +++ b/src/sensors/qcompass.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qcompass.h" #include "qcompass_p.h" @@ -141,7 +105,7 @@ bool QCompassFilter::filter(QSensorReading *reading) return filter(static_cast<QCompassReading*>(reading)); } -char const * const QCompass::type("QCompass"); +char const * const QCompass::sensorType("QCompass"); /*! \class QCompass @@ -164,7 +128,7 @@ char const * const QCompass::type("QCompass"); Construct the sensor as a child of \a parent. */ QCompass::QCompass(QObject *parent) - : QSensor(QCompass::type, parent) + : QSensor(QCompass::sensorType, parent) { } diff --git a/src/sensors/qcompass.h b/src/sensors/qcompass.h index 0d22c746..3892298a 100644 --- a/src/sensors/qcompass.h +++ b/src/sensors/qcompass.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QCOMPASS_H #define QCOMPASS_H @@ -72,10 +36,10 @@ class Q_SENSORS_EXPORT QCompass : public QSensor { Q_OBJECT public: - explicit QCompass(QObject *parent = Q_NULLPTR); + explicit QCompass(QObject *parent = nullptr); virtual ~QCompass(); QCompassReading *reading() const; - static char const * const type; + static char const * const sensorType; private: Q_DISABLE_COPY(QCompass) diff --git a/src/sensors/qcompass_p.h b/src/sensors/qcompass_p.h index bb45f205..9f8d7b74 100644 --- a/src/sensors/qcompass_p.h +++ b/src/sensors/qcompass_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QCOMPASS_P_H #define QCOMPASS_P_H @@ -51,6 +15,8 @@ // We mean it. // +#include <QtCore/private/qglobal_p.h> + QT_BEGIN_NAMESPACE class QCompassReadingPrivate diff --git a/src/sensors/qdistancesensor.cpp b/src/sensors/qdistancesensor.cpp deleted file mode 100644 index 916218f8..00000000 --- a/src/sensors/qdistancesensor.cpp +++ /dev/null @@ -1,163 +0,0 @@ - /**************************************************************************** - ** - ** Copyright (C) 2016 BlackBerry Limited. All rights reserved. - ** 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 <qdistancesensor.h> -#include "qdistancesensor_p.h" - -QT_BEGIN_NAMESPACE - -IMPLEMENT_READING(QDistanceReading) - -/*! - \class QDistanceReading - \ingroup sensors_reading - \inmodule QtSensors - \since 5.4 - - \brief The QDistanceReading class holds distance reading in cm from the proximity sensor. - - The QDistanceReading class holds distance reading in cm from the proximity sensor. - Note: Some proximity sensor only support two values for distance, a near and far value. - In this case, the sensor should report its maximum range value to represent the far state, - and a lesser value to represent the near state. - - \section2 QDistanceReading Units - The distance is measured in cm - - The distance sensor is typically located in the front face of a device, and thus will - measure the distance of an object from the device's front face. -*/ - -/*! - \property QDistanceReading::distance - \brief distance of object from front face of device - - \sa {QDistanceReading Units} -*/ - -qreal QDistanceReading::distance() const -{ - return d->distance; -} - -/*! - Sets distance to \a distance. -*/ -void QDistanceReading::setDistance(qreal distance) -{ - d->distance = distance; -} - -// ===================================================================== - -/*! - \class QDistanceFilter - \ingroup sensors_filter - \inmodule QtSensors - \since 5.4 - - \brief The QDistanceFilter class is a convenience wrapper around QSensorFilter. - - The only difference is that the filter() method features a pointer to QDistanceReading - instead of QSensorReading. -*/ - -/*! - \fn QDistanceFilter::filter(QDistanceReading *reading) - - Called when \a reading changes. Returns false to prevent the reading from propagating. - - \sa QSensorFilter::filter() -*/ - -bool QDistanceFilter::filter(QSensorReading *reading) -{ - return filter(static_cast<QDistanceReading*>(reading)); -} - -char const * const QDistanceSensor::type("QDistanceSensor"); - -/*! - \class QDistanceSensor - \ingroup sensors_type - \inmodule QtSensors - \since 5.4 - - \brief The QDistanceSensor class is a convenience wrapper around QSensor. - - The only behavioral difference is that this class sets the type properly. - - This class also features a reading() function that returns a QDistanceReading instead of a QSensorReading. - - For details about how the sensor works, see \l QDistanceReading. - - \sa QDistanceReading -*/ - -/*! - Construct the sensor as a child of \a parent. -*/ -QDistanceSensor::QDistanceSensor(QObject *parent) - : QSensor(QDistanceSensor::type, parent) -{ -} - -/*! - Destroy the sensor. Stops the sensor if it has not already been stopped. -*/ -QDistanceSensor::~QDistanceSensor() -{ -} - -/*! - \fn QDistanceSensor::reading() const - - Returns the reading class for this sensor. - - \sa QSensor::reading() -*/ - -QDistanceReading *QDistanceSensor::reading() const -{ - return static_cast<QDistanceReading*>(QSensor::reading()); -} - -QT_END_NAMESPACE - -#include "moc_qdistancesensor.cpp" diff --git a/src/sensors/qdistancesensor.h b/src/sensors/qdistancesensor.h deleted file mode 100644 index a6aef947..00000000 --- a/src/sensors/qdistancesensor.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 BlackBerry Limited. All rights reserved. -** 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 QDISTANCESENSOR_H -#define QDISTANCESENSOR_H - -#include <QtSensors/qsensor.h> - -QT_BEGIN_NAMESPACE - -class QDistanceReadingPrivate; - -class Q_SENSORS_EXPORT QDistanceReading : public QSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal distance READ distance) - DECLARE_READING(QDistanceReading) -public: - qreal distance() const; - void setDistance(qreal distance); -}; - -class Q_SENSORS_EXPORT QDistanceFilter : public QSensorFilter -{ -public: - virtual bool filter(QDistanceReading *reading) = 0; -private: - bool filter(QSensorReading *reading) override; -}; - -class Q_SENSORS_EXPORT QDistanceSensor : public QSensor -{ - Q_OBJECT -public: - explicit QDistanceSensor(QObject *parent = Q_NULLPTR); - ~QDistanceSensor(); - QDistanceReading *reading() const; - static char const * const type; - -private: - Q_DISABLE_COPY(QDistanceSensor) -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/sensors/qdistancesensor_p.h b/src/sensors/qdistancesensor_p.h deleted file mode 100644 index 262fdb1e..00000000 --- a/src/sensors/qdistancesensor_p.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 BlackBerry Limited. All rights reserved. -** 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 QDISTANCESENSOR_P_H -#define QDISTANCESENSOR_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. -// - -QT_BEGIN_NAMESPACE - -class QDistanceReadingPrivate -{ -public: - QDistanceReadingPrivate() - : distance(0.0) - { - } - - /* - * Note that this class is copied so you may need to implement - * a copy constructor if you have complex types or pointers - * as values. - */ - - qreal distance; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/sensors/qgyroscope.cpp b/src/sensors/qgyroscope.cpp index 585da99b..8ffd6934 100644 --- a/src/sensors/qgyroscope.cpp +++ b/src/sensors/qgyroscope.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qgyroscope.h" #include "qgyroscope_p.h" @@ -153,7 +117,7 @@ bool QGyroscopeFilter::filter(QSensorReading *reading) return filter(static_cast<QGyroscopeReading*>(reading)); } -char const * const QGyroscope::type("QGyroscope"); +char const * const QGyroscope::sensorType("QGyroscope"); /*! \class QGyroscope @@ -176,7 +140,7 @@ char const * const QGyroscope::type("QGyroscope"); Construct the sensor as a child of \a parent. */ QGyroscope::QGyroscope(QObject *parent) - : QSensor(QGyroscope::type, parent) + : QSensor(QGyroscope::sensorType, parent) { } diff --git a/src/sensors/qgyroscope.h b/src/sensors/qgyroscope.h index 7d7e287e..43c1a452 100644 --- a/src/sensors/qgyroscope.h +++ b/src/sensors/qgyroscope.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QGYROSCOPE_H #define QGYROSCOPE_H @@ -76,10 +40,10 @@ class Q_SENSORS_EXPORT QGyroscope : public QSensor { Q_OBJECT public: - explicit QGyroscope(QObject *parent = Q_NULLPTR); + explicit QGyroscope(QObject *parent = nullptr); virtual ~QGyroscope(); QGyroscopeReading *reading() const; - static char const * const type; + static char const * const sensorType; private: Q_DISABLE_COPY(QGyroscope) diff --git a/src/sensors/qgyroscope_p.h b/src/sensors/qgyroscope_p.h index b8158421..dcc552cd 100644 --- a/src/sensors/qgyroscope_p.h +++ b/src/sensors/qgyroscope_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QGYROSCOPE_P_H #define QGYROSCOPE_P_H @@ -51,6 +15,8 @@ // We mean it. // +#include <QtCore/private/qglobal_p.h> + QT_BEGIN_NAMESPACE class QGyroscopeReadingPrivate diff --git a/src/sensors/qholstersensor.cpp b/src/sensors/qholstersensor.cpp deleted file mode 100644 index 8bb14748..00000000 --- a/src/sensors/qholstersensor.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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 <qholstersensor.h> -#include "qholstersensor_p.h" - -QT_BEGIN_NAMESPACE - -IMPLEMENT_READING(QHolsterReading) - -/*! - \class QHolsterReading - \ingroup sensors_reading - \inmodule QtSensors - \since 5.1 - - \brief The QHolsterReading class holds readings from the holster sensor. - - \section2 QHolsterReading Units - The holster sensor can detect if a device is holstered or not. A holster is a pocket, - similar to a gun holster, specifically made for the device. If the device is inside of this - pocket, it is holstered. The holster supports the device in detecting whether the device is - holstered or not. -*/ - -/*! - \property QHolsterReading::holstered - \brief A value indicating whether the device is holstered. - - \sa {QHolsterReading Units} -*/ - -bool QHolsterReading::holstered() const -{ - return d->holstered; -} - -/*! - Sets the holstered value to \a holstered. -*/ -void QHolsterReading::setHolstered(bool holstered) -{ - d->holstered = holstered; -} - -// ===================================================================== - -/*! - \class QHolsterFilter - \ingroup sensors_filter - \inmodule QtSensors - \since 5.1 - - \brief The QHolsterFilter class is a convenience wrapper around QSensorFilter. - - The only difference is that the filter() method features a pointer to QHolsterReading - instead of QSensorReading. -*/ - -/*! - \fn QHolsterFilter::filter(QHolsterReading *reading) - - Called when \a reading changes. Returns false to prevent the reading from propagating. - - \sa QSensorFilter::filter() -*/ - -bool QHolsterFilter::filter(QSensorReading *reading) -{ - return filter(static_cast<QHolsterReading*>(reading)); -} - -char const * const QHolsterSensor::type("QHolsterSensor"); - -/*! - \class QHolsterSensor - \ingroup sensors_type - \inmodule QtSensors - \since 5.1 - - \brief The QHolsterSensor class is a convenience wrapper around QSensor. - - The only behavioural difference is that this class sets the type properly. - - This class also features a reading() function that returns a QHolsterReading instead of a QSensorReading. - - For details about how the sensor works, see \l QHolsterReading. - - \sa QHolsterReading -*/ - -/*! - Construct the sensor as a child of \a parent. -*/ -QHolsterSensor::QHolsterSensor(QObject *parent) - : QSensor(QHolsterSensor::type, parent) -{ -} - -/*! - Destroy the sensor. Stops the sensor if it has not already been stopped. -*/ -QHolsterSensor::~QHolsterSensor() -{ -} - -/*! - \fn QHolsterSensor::reading() const - - Returns the reading class for this sensor. - - \sa QSensor::reading() -*/ - -QHolsterReading *QHolsterSensor::reading() const -{ - return static_cast<QHolsterReading*>(QSensor::reading()); -} - -QT_END_NAMESPACE - -#include "moc_qholstersensor.cpp" diff --git a/src/sensors/qholstersensor.h b/src/sensors/qholstersensor.h deleted file mode 100644 index 43d02899..00000000 --- a/src/sensors/qholstersensor.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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 QHOLSTERSENSOR_H -#define QHOLSTERSENSOR_H - -#include <QtSensors/qsensor.h> - -QT_BEGIN_NAMESPACE - -class QHolsterReadingPrivate; - -class Q_SENSORS_EXPORT QHolsterReading : public QSensorReading -{ - Q_OBJECT - Q_PROPERTY(bool holstered READ holstered) - DECLARE_READING(QHolsterReading) -public: - bool holstered() const; - void setHolstered(bool holstered); -}; - -class Q_SENSORS_EXPORT QHolsterFilter : public QSensorFilter -{ -public: - virtual bool filter(QHolsterReading *reading) = 0; -private: - bool filter(QSensorReading *reading) override; -}; - -class Q_SENSORS_EXPORT QHolsterSensor : public QSensor -{ - Q_OBJECT -public: - explicit QHolsterSensor(QObject *parent = Q_NULLPTR); - ~QHolsterSensor(); - QHolsterReading *reading() const; - static char const * const type; - -private: - Q_DISABLE_COPY(QHolsterSensor) -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/sensors/qholstersensor_p.h b/src/sensors/qholstersensor_p.h deleted file mode 100644 index 3d8b9801..00000000 --- a/src/sensors/qholstersensor_p.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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 QHOLSTERSENSOR_P_H -#define QHOLSTERSENSOR_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. -// - -QT_BEGIN_NAMESPACE - -class QHolsterReadingPrivate -{ -public: - QHolsterReadingPrivate() - : holstered(false) - { - } - - bool holstered; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/sensors/qhumiditysensor.cpp b/src/sensors/qhumiditysensor.cpp index e566c6a6..9c0db944 100644 --- a/src/sensors/qhumiditysensor.cpp +++ b/src/sensors/qhumiditysensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Canonical 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Canonical Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <qhumiditysensor.h> #include "qhumiditysensor_p.h" @@ -129,7 +93,7 @@ bool QHumidityFilter::filter(QSensorReading *reading) return filter(static_cast<QHumidityReading*>(reading)); } -char const * const QHumiditySensor::type("QHumiditySensor"); +char const * const QHumiditySensor::sensorType("QHumiditySensor"); /*! @@ -153,7 +117,7 @@ char const * const QHumiditySensor::type("QHumiditySensor"); Construct the sensor as a child of \a parent. */ QHumiditySensor::QHumiditySensor(QObject *parent) - : QSensor(QHumiditySensor::type, parent) + : QSensor(QHumiditySensor::sensorType, parent) { } diff --git a/src/sensors/qhumiditysensor.h b/src/sensors/qhumiditysensor.h index f24d2be2..76a83b2c 100644 --- a/src/sensors/qhumiditysensor.h +++ b/src/sensors/qhumiditysensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Canonical 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Canonical Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QHUMIDITYSENSOR_H #define QHUMIDITYSENSOR_H @@ -75,11 +39,11 @@ class Q_SENSORS_EXPORT QHumiditySensor : public QSensor { Q_OBJECT public: - explicit QHumiditySensor(QObject *parent = Q_NULLPTR); + explicit QHumiditySensor(QObject *parent = nullptr); ~QHumiditySensor(); QHumidityReading *reading() const; - static char const * const type; + static char const * const sensorType; private: Q_DECLARE_PRIVATE(QHumiditySensor) diff --git a/src/sensors/qhumiditysensor_p.h b/src/sensors/qhumiditysensor_p.h index 95b070ea..1d357c98 100644 --- a/src/sensors/qhumiditysensor_p.h +++ b/src/sensors/qhumiditysensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Canonical 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Canonical Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QHUMIDITYSENSOR_P_H #define QHUMIDITYSENSOR_P_H diff --git a/src/sensors/qirproximitysensor.cpp b/src/sensors/qirproximitysensor.cpp index 2be5a43a..4d205d05 100644 --- a/src/sensors/qirproximitysensor.cpp +++ b/src/sensors/qirproximitysensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <qirproximitysensor.h> #include "qirproximitysensor_p.h" @@ -49,6 +13,7 @@ IMPLEMENT_READING(QIRProximityReading) \ingroup sensors_reading \inmodule QtSensors \since 5.1 + \internal \brief The QIRProximityReading class holds readings from the IR proximity sensor. @@ -101,6 +66,7 @@ void QIRProximityReading::setReflectance(qreal reflectance) \ingroup sensors_filter \inmodule QtSensors \since 5.1 + \internal \brief The QIRProximityFilter class is a convenience wrapper around QSensorFilter. @@ -121,13 +87,14 @@ bool QIRProximityFilter::filter(QSensorReading *reading) return filter(static_cast<QIRProximityReading*>(reading)); } -char const * const QIRProximitySensor::type("QIRProximitySensor"); +char const * const QIRProximitySensor::sensorType("QIRProximitySensor"); /*! \class QIRProximitySensor \ingroup sensors_type \inmodule QtSensors \since 5.1 + \internal \brief The QIRProximitySensor class is a convenience wrapper around QSensor. @@ -144,7 +111,7 @@ char const * const QIRProximitySensor::type("QIRProximitySensor"); Construct the sensor as a child of \a parent. */ QIRProximitySensor::QIRProximitySensor(QObject *parent) - : QSensor(QIRProximitySensor::type, parent) + : QSensor(QIRProximitySensor::sensorType, parent) { } diff --git a/src/sensors/qirproximitysensor.h b/src/sensors/qirproximitysensor.h index 2941d6e0..ce22ab39 100644 --- a/src/sensors/qirproximitysensor.h +++ b/src/sensors/qirproximitysensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QIRPROXIMITYSENSOR_H #define QIRPROXIMITYSENSOR_H @@ -68,10 +32,10 @@ class Q_SENSORS_EXPORT QIRProximitySensor : public QSensor { Q_OBJECT public: - explicit QIRProximitySensor(QObject *parent = Q_NULLPTR); + explicit QIRProximitySensor(QObject *parent = nullptr); virtual ~QIRProximitySensor(); QIRProximityReading *reading() const; - static char const * const type; + static char const * const sensorType; private: Q_DISABLE_COPY(QIRProximitySensor) diff --git a/src/sensors/qirproximitysensor_p.h b/src/sensors/qirproximitysensor_p.h index 02c8275f..fb850928 100644 --- a/src/sensors/qirproximitysensor_p.h +++ b/src/sensors/qirproximitysensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QIRPROXIMITYSENSOR_P_H #define QIRPROXIMITYSENSOR_P_H @@ -51,6 +15,8 @@ // We mean it. // +#include <QtCore/private/qglobal_p.h> + QT_BEGIN_NAMESPACE class QIRProximityReadingPrivate diff --git a/src/sensors/qlidsensor.cpp b/src/sensors/qlidsensor.cpp index 893987b7..bc413242 100644 --- a/src/sensors/qlidsensor.cpp +++ b/src/sensors/qlidsensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Canonical, 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Canonical, Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <qlidsensor.h> #include "qlidsensor_p.h" @@ -48,6 +12,7 @@ IMPLEMENT_READING(QLidReading) \ingroup sensors_reading \inmodule QtSensors \since 5.9 + \internal \brief The QLidReading class holds readings from the Lid sensor. @@ -110,6 +75,7 @@ void QLidReading::setFrontLidClosed(bool closed) \ingroup sensors_filter \inmodule QtSensors \since 5.9 + \internal \brief The QLidFilter class is a convenience wrapper around QSensorFilter. @@ -130,13 +96,14 @@ bool QLidFilter::filter(QSensorReading *reading) return filter(static_cast<QLidReading*>(reading)); } -char const * const QLidSensor::type("QLidSensor"); +char const * const QLidSensor::sensorType("QLidSensor"); /*! \class QLidSensor \ingroup sensors_type \inmodule QtSensors \since 5.9 + \internal \brief The QLidSensor class is a convenience wrapper around QSensor. @@ -154,7 +121,7 @@ char const * const QLidSensor::type("QLidSensor"); Construct the sensor as a child of \a parent. */ QLidSensor::QLidSensor(QObject *parent) - : QSensor(QLidSensor::type, parent) + : QSensor(QLidSensor::sensorType, parent) { } diff --git a/src/sensors/qlidsensor.h b/src/sensors/qlidsensor.h index f7992cac..c0861ff9 100644 --- a/src/sensors/qlidsensor.h +++ b/src/sensors/qlidsensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Canonical, 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Canonical, Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QLIDSENSOR_H #define QLIDSENSOR_H @@ -76,10 +40,10 @@ class Q_SENSORS_EXPORT QLidSensor : public QSensor { Q_OBJECT public: - explicit QLidSensor(QObject *parent = Q_NULLPTR); + explicit QLidSensor(QObject *parent = nullptr); ~QLidSensor(); QLidReading *reading() const; - static char const * const type; + static char const * const sensorType; private: Q_DISABLE_COPY(QLidSensor) diff --git a/src/sensors/qlidsensor_p.h b/src/sensors/qlidsensor_p.h index 93d3b99e..ff14c0bd 100644 --- a/src/sensors/qlidsensor_p.h +++ b/src/sensors/qlidsensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Canonical, 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Canonical, Ltd +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QLIDSENSOR_P_H #define QLIDSENSOR_P_H @@ -50,6 +14,8 @@ // We mean it. // +#include <QtCore/private/qglobal_p.h> + QT_BEGIN_NAMESPACE class QLidReadingPrivate diff --git a/src/sensors/qlightsensor.cpp b/src/sensors/qlightsensor.cpp index efff15f9..0803f0e5 100644 --- a/src/sensors/qlightsensor.cpp +++ b/src/sensors/qlightsensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qlightsensor.h" #include "qlightsensor_p.h" @@ -105,7 +69,7 @@ bool QLightFilter::filter(QSensorReading *reading) return filter(static_cast<QLightReading*>(reading)); } -char const * const QLightSensor::type("QLightSensor"); +char const * const QLightSensor::sensorType("QLightSensor"); /*! \class QLightSensor @@ -128,7 +92,7 @@ char const * const QLightSensor::type("QLightSensor"); Construct the sensor as a child of \a parent. */ QLightSensor::QLightSensor(QObject *parent) - : QSensor(QLightSensor::type, *new QLightSensorPrivate, parent) + : QSensor(QLightSensor::sensorType, *new QLightSensorPrivate, parent) { } diff --git a/src/sensors/qlightsensor.h b/src/sensors/qlightsensor.h index 03f1871e..89dfbcd5 100644 --- a/src/sensors/qlightsensor.h +++ b/src/sensors/qlightsensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QLIGHTSENSOR_H #define QLIGHTSENSOR_H @@ -71,10 +35,10 @@ class Q_SENSORS_EXPORT QLightSensor : public QSensor Q_OBJECT Q_PROPERTY(qreal fieldOfView READ fieldOfView NOTIFY fieldOfViewChanged) public: - explicit QLightSensor(QObject *parent = Q_NULLPTR); + explicit QLightSensor(QObject *parent = nullptr); virtual ~QLightSensor(); QLightReading *reading() const; - static char const * const type; + static char const * const sensorType; qreal fieldOfView() const; void setFieldOfView(qreal fieldOfView); diff --git a/src/sensors/qlightsensor_p.h b/src/sensors/qlightsensor_p.h index f57b6088..4a570ca2 100644 --- a/src/sensors/qlightsensor_p.h +++ b/src/sensors/qlightsensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QLIGHTSENSOR_P_H #define QLIGHTSENSOR_P_H diff --git a/src/sensors/qmagnetometer.cpp b/src/sensors/qmagnetometer.cpp index ac2231ec..601ebb0a 100644 --- a/src/sensors/qmagnetometer.cpp +++ b/src/sensors/qmagnetometer.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qmagnetometer.h" #include "qmagnetometer_p.h" @@ -199,7 +163,7 @@ bool QMagnetometerFilter::filter(QSensorReading *reading) return filter(static_cast<QMagnetometerReading*>(reading)); } -char const * const QMagnetometer::type("QMagnetometer"); +char const * const QMagnetometer::sensorType("QMagnetometer"); /*! \class QMagnetometer @@ -222,7 +186,7 @@ char const * const QMagnetometer::type("QMagnetometer"); Construct the sensor as a child of \a parent. */ QMagnetometer::QMagnetometer(QObject *parent) - : QSensor(QMagnetometer::type, *new QMagnetometerPrivate, parent) + : QSensor(QMagnetometer::sensorType, *new QMagnetometerPrivate, parent) { } diff --git a/src/sensors/qmagnetometer.h b/src/sensors/qmagnetometer.h index f8b0fbfb..2e55a504 100644 --- a/src/sensors/qmagnetometer.h +++ b/src/sensors/qmagnetometer.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QMAGNETOMETER_H #define QMAGNETOMETER_H @@ -83,10 +47,10 @@ class Q_SENSORS_EXPORT QMagnetometer : public QSensor Q_OBJECT Q_PROPERTY(bool returnGeoValues READ returnGeoValues WRITE setReturnGeoValues NOTIFY returnGeoValuesChanged) public: - explicit QMagnetometer(QObject *parent = Q_NULLPTR); + explicit QMagnetometer(QObject *parent = nullptr); virtual ~QMagnetometer(); QMagnetometerReading *reading() const; - static char const * const type; + static char const * const sensorType; bool returnGeoValues() const; void setReturnGeoValues(bool returnGeoValues); diff --git a/src/sensors/qmagnetometer_p.h b/src/sensors/qmagnetometer_p.h index 634378d5..7052e9e8 100644 --- a/src/sensors/qmagnetometer_p.h +++ b/src/sensors/qmagnetometer_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QMAGNETOMETER_P_H #define QMAGNETOMETER_P_H @@ -59,7 +23,7 @@ class QMagnetometerPrivate : public QSensorPrivate { public: QMagnetometerPrivate() - : returnGeoValues(false) + : returnGeoValues(true) { } diff --git a/src/sensors/qorientationsensor.cpp b/src/sensors/qorientationsensor.cpp index 91d10749..4e0702f6 100644 --- a/src/sensors/qorientationsensor.cpp +++ b/src/sensors/qorientationsensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qorientationsensor.h" #include "qorientationsensor_p.h" @@ -154,7 +118,7 @@ bool QOrientationFilter::filter(QSensorReading *reading) return filter(static_cast<QOrientationReading*>(reading)); } -char const * const QOrientationSensor::type("QOrientationSensor"); +char const * const QOrientationSensor::sensorType("QOrientationSensor"); /*! \class QOrientationSensor @@ -177,7 +141,7 @@ char const * const QOrientationSensor::type("QOrientationSensor"); Construct the sensor as a child of \a parent. */ QOrientationSensor::QOrientationSensor(QObject *parent) - : QSensor(QOrientationSensor::type, parent) + : QSensor(QOrientationSensor::sensorType, parent) { } diff --git a/src/sensors/qorientationsensor.h b/src/sensors/qorientationsensor.h index 89823ca2..b9436822 100644 --- a/src/sensors/qorientationsensor.h +++ b/src/sensors/qorientationsensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QORIENTATIONSENSOR_H #define QORIENTATIONSENSOR_H @@ -49,7 +13,6 @@ class QOrientationReadingPrivate; class Q_SENSORS_EXPORT QOrientationReading : public QSensorReading { Q_OBJECT - Q_ENUMS(Orientation) Q_PROPERTY(Orientation orientation READ orientation) DECLARE_READING(QOrientationReading) public: @@ -62,6 +25,7 @@ public: FaceUp, FaceDown }; + Q_ENUM(Orientation) Orientation orientation() const; void setOrientation(Orientation orientation); @@ -79,10 +43,10 @@ class Q_SENSORS_EXPORT QOrientationSensor : public QSensor { Q_OBJECT public: - explicit QOrientationSensor(QObject *parent = Q_NULLPTR); + explicit QOrientationSensor(QObject *parent = nullptr); virtual ~QOrientationSensor(); QOrientationReading *reading() const; - static char const * const type; + static char const * const sensorType; private: Q_DISABLE_COPY(QOrientationSensor) @@ -91,4 +55,3 @@ private: QT_END_NAMESPACE #endif - diff --git a/src/sensors/qorientationsensor_p.h b/src/sensors/qorientationsensor_p.h index 69b70157..4c39817c 100644 --- a/src/sensors/qorientationsensor_p.h +++ b/src/sensors/qorientationsensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QORIENTATIONSENSOR_P_H #define QORIENTATIONSENSOR_P_H @@ -51,6 +15,8 @@ // We mean it. // +#include <QtCore/private/qglobal_p.h> + QT_BEGIN_NAMESPACE class QOrientationReadingPrivate diff --git a/src/sensors/qpressuresensor.cpp b/src/sensors/qpressuresensor.cpp index 643f1fa1..393e861f 100644 --- a/src/sensors/qpressuresensor.cpp +++ b/src/sensors/qpressuresensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Research In Motion +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <qpressuresensor.h> #include "qpressuresensor_p.h" @@ -131,7 +95,7 @@ bool QPressureFilter::filter(QSensorReading *reading) return filter(static_cast<QPressureReading*>(reading)); } -char const * const QPressureSensor::type("QPressureSensor"); +char const * const QPressureSensor::sensorType("QPressureSensor"); /*! \class QPressureSensor @@ -154,7 +118,7 @@ char const * const QPressureSensor::type("QPressureSensor"); Construct the sensor as a child of \a parent. */ QPressureSensor::QPressureSensor(QObject *parent) - : QSensor(QPressureSensor::type, parent) + : QSensor(QPressureSensor::sensorType, parent) { } diff --git a/src/sensors/qpressuresensor.h b/src/sensors/qpressuresensor.h index 29ac235f..a3841b03 100644 --- a/src/sensors/qpressuresensor.h +++ b/src/sensors/qpressuresensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Research In Motion +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QPRESSURESENSOR_H #define QPRESSURESENSOR_H @@ -71,10 +35,10 @@ class Q_SENSORS_EXPORT QPressureSensor : public QSensor { Q_OBJECT public: - explicit QPressureSensor(QObject *parent = Q_NULLPTR); + explicit QPressureSensor(QObject *parent = nullptr); ~QPressureSensor(); QPressureReading *reading() const; - static char const * const type; + static char const * const sensorType; private: Q_DISABLE_COPY(QPressureSensor) diff --git a/src/sensors/qpressuresensor_p.h b/src/sensors/qpressuresensor_p.h index 2caa1338..668e3956 100644 --- a/src/sensors/qpressuresensor_p.h +++ b/src/sensors/qpressuresensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Research In Motion +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QPRESSURESENSOR_P_H #define QPRESSURESENSOR_P_H @@ -50,6 +14,8 @@ // We mean it. // +#include <QtCore/private/qglobal_p.h> + QT_BEGIN_NAMESPACE class QPressureReadingPrivate diff --git a/src/sensors/qproximitysensor.cpp b/src/sensors/qproximitysensor.cpp index b568e6cd..73b609e3 100644 --- a/src/sensors/qproximitysensor.cpp +++ b/src/sensors/qproximitysensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qproximitysensor.h" #include "qproximitysensor_p.h" @@ -110,7 +74,7 @@ bool QProximityFilter::filter(QSensorReading *reading) return filter(static_cast<QProximityReading*>(reading)); } -char const * const QProximitySensor::type("QProximitySensor"); +char const * const QProximitySensor::sensorType("QProximitySensor"); /*! \class QProximitySensor @@ -133,7 +97,7 @@ char const * const QProximitySensor::type("QProximitySensor"); Construct the sensor as a child of \a parent. */ QProximitySensor::QProximitySensor(QObject *parent) - : QSensor(QProximitySensor::type, parent) + : QSensor(QProximitySensor::sensorType, parent) { } diff --git a/src/sensors/qproximitysensor.h b/src/sensors/qproximitysensor.h index 46a8b218..5f7dc3c7 100644 --- a/src/sensors/qproximitysensor.h +++ b/src/sensors/qproximitysensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QPROXIMITYSENSOR_H #define QPROXIMITYSENSOR_H @@ -68,10 +32,10 @@ class Q_SENSORS_EXPORT QProximitySensor : public QSensor { Q_OBJECT public: - explicit QProximitySensor(QObject *parent = Q_NULLPTR); + explicit QProximitySensor(QObject *parent = nullptr); virtual ~QProximitySensor(); QProximityReading *reading() const; - static char const * const type; + static char const * const sensorType; private: Q_DISABLE_COPY(QProximitySensor) diff --git a/src/sensors/qproximitysensor_p.h b/src/sensors/qproximitysensor_p.h index 81f1604d..63dc5311 100644 --- a/src/sensors/qproximitysensor_p.h +++ b/src/sensors/qproximitysensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QPROXIMITYSENSOR_P_H #define QPROXIMITYSENSOR_P_H @@ -51,6 +15,8 @@ // We mean it. // +#include <QtCore/private/qglobal_p.h> + QT_BEGIN_NAMESPACE class QProximityReadingPrivate diff --git a/src/sensors/qrotationsensor.cpp b/src/sensors/qrotationsensor.cpp index 44424b50..c1536def 100644 --- a/src/sensors/qrotationsensor.cpp +++ b/src/sensors/qrotationsensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qrotationsensor.h" #include "qrotationsensor_p.h" @@ -184,7 +148,7 @@ bool QRotationFilter::filter(QSensorReading *reading) return filter(static_cast<QRotationReading*>(reading)); } -char const * const QRotationSensor::type("QRotationSensor"); +char const * const QRotationSensor::sensorType("QRotationSensor"); /*! \class QRotationSensor @@ -207,7 +171,7 @@ char const * const QRotationSensor::type("QRotationSensor"); Construct the sensor as a child of \a parent. */ QRotationSensor::QRotationSensor(QObject *parent) - : QSensor(QRotationSensor::type, *new QRotationSensorPrivate, parent) + : QSensor(QRotationSensor::sensorType, *new QRotationSensorPrivate, parent) { } diff --git a/src/sensors/qrotationsensor.h b/src/sensors/qrotationsensor.h index d6c43acc..be9ecb65 100644 --- a/src/sensors/qrotationsensor.h +++ b/src/sensors/qrotationsensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QROTATIONSENSOR_H #define QROTATIONSENSOR_H @@ -76,10 +40,10 @@ class Q_SENSORS_EXPORT QRotationSensor : public QSensor Q_OBJECT Q_PROPERTY(bool hasZ READ hasZ NOTIFY hasZChanged) public: - explicit QRotationSensor(QObject *parent = Q_NULLPTR); + explicit QRotationSensor(QObject *parent = nullptr); virtual ~QRotationSensor(); QRotationReading *reading() const; - static char const * const type; + static char const * const sensorType; bool hasZ() const; void setHasZ(bool hasZ); diff --git a/src/sensors/qrotationsensor_p.h b/src/sensors/qrotationsensor_p.h index d1f07669..cc6f8a9a 100644 --- a/src/sensors/qrotationsensor_p.h +++ b/src/sensors/qrotationsensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QROTATIONSENSOR_P_H #define QROTATIONSENSOR_P_H diff --git a/src/sensors/qsensor.cpp b/src/sensors/qsensor.cpp index d8bb0bee..72c58fe8 100644 --- a/src/sensors/qsensor.cpp +++ b/src/sensors/qsensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qsensor.h" #include "qsensor_p.h" @@ -280,7 +244,7 @@ void QSensorPrivate::init(const QByteArray &sensorType) Only use this constructor if there is no derived sensor class available. Note that all built-in sensors have a derived class, so using this constructor should only be necessary - when implementing custom sensors, like in the \l {Qt Sensors - Grue Sensor Example}{Grue sensor example}. + when implementing custom sensors. */ QSensor::QSensor(const QByteArray &type, QObject *parent) : QObject(*new QSensorPrivate, parent) @@ -313,7 +277,7 @@ QSensor::~QSensor() { Q_D(QSensor); stop(); - Q_FOREACH (QSensorFilter *filter, d->filters) + for (QSensorFilter *filter : d->filters) filter->setSensor(0); delete d->backend; d->backend = 0; @@ -364,7 +328,10 @@ void QSensor::setIdentifier(const QByteArray &identifier) qWarning() << "ERROR: Cannot call QSensor::setIdentifier while connected to a backend!"; return; } + if (d->identifier == identifier) + return; d->identifier = identifier; + emit identifierChanged(); } /*! @@ -560,9 +527,6 @@ void QSensor::setSkipDuplicates(bool skipDuplicates) continuous range of rates. A discrete rate is noted by having both values the same. - See the sensor_explorer example for an example of how to interpret and use - this information. - Note that this information is not mandatory as not all sensors have a rate at which they run. In such cases, the list will be empty. @@ -847,7 +811,7 @@ void QSensor::setOutputRange(int index) return; } bool warn = true; - if (index >= 0 && index < d->outputRanges.count()) { + if (index >= 0 && index < d->outputRanges.size()) { warn = false; d->outputRange = index; } @@ -1362,7 +1326,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 +1354,3 @@ void QSensorReading::copyValuesFrom(QSensorReading *other) */ QT_END_NAMESPACE - -#include "moc_qsensor.cpp" - diff --git a/src/sensors/qsensor.h b/src/sensors/qsensor.h index 7dd7ea19..d6ba3311 100644 --- a/src/sensors/qsensor.h +++ b/src/sensors/qsensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QSENSOR_H #define QSENSOR_H @@ -56,33 +20,29 @@ class QSensorReading; class QSensorReadingPrivate; class QSensorFilter; -// This type is no longer used in the API but third party apps may be using it -typedef quint64 qtimestamp; +using qrange = QPair<int,int>; +using qrangelist = QList<qrange>; -typedef QPair<int,int> qrange; -typedef QList<qrange> qrangelist; struct qoutputrange { qreal minimum; qreal maximum; qreal accuracy; }; -typedef QList<qoutputrange> qoutputrangelist; + +using qoutputrangelist = QList<qoutputrange>; class Q_SENSORS_EXPORT QSensor : public QObject { friend class QSensorBackend; - Q_OBJECT - Q_ENUMS(Feature) - Q_ENUMS(AxesOrientationMode) - Q_PROPERTY(QByteArray identifier READ identifier WRITE setIdentifier) - Q_PROPERTY(QByteArray type READ type) + Q_PROPERTY(QByteArray identifier READ identifier WRITE setIdentifier NOTIFY identifierChanged) + Q_PROPERTY(QByteArray type READ type CONSTANT) Q_PROPERTY(bool connectedToBackend READ isConnectedToBackend) Q_PROPERTY(qrangelist availableDataRates READ availableDataRates) Q_PROPERTY(int dataRate READ dataRate WRITE setDataRate NOTIFY dataRateChanged) Q_PROPERTY(QSensorReading* reading READ reading NOTIFY readingChanged) - Q_PROPERTY(bool busy READ isBusy) + Q_PROPERTY(bool busy READ isBusy NOTIFY busyChanged) Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged) Q_PROPERTY(qoutputrangelist outputRanges READ outputRanges) Q_PROPERTY(int outputRange READ outputRange WRITE setOutputRange) @@ -108,6 +68,7 @@ public: PressureSensorTemperature, Reserved = 257 // Make sure at least 2 bytes are used for the enum to avoid breaking BC later }; + Q_ENUM(Feature) // Keep in sync with QmlSensor::AxesOrientationMode enum AxesOrientationMode { @@ -115,8 +76,9 @@ public: AutomaticOrientation, UserOrientation }; + Q_ENUM(AxesOrientationMode) - explicit QSensor(const QByteArray &type, QObject *parent = Q_NULLPTR); + explicit QSensor(const QByteArray &type, QObject *parent = nullptr); virtual ~QSensor(); QByteArray identifier() const; @@ -205,9 +167,10 @@ Q_SIGNALS: void maxBufferSizeChanged(int maxBufferSize); void efficientBufferSizeChanged(int efficientBufferSize); void bufferSizeChanged(int bufferSize); + void identifierChanged(); protected: - explicit QSensor(const QByteArray &type, QSensorPrivate &dd, QObject* parent = Q_NULLPTR); + explicit QSensor(const QByteArray &type, QSensorPrivate &dd, QObject* parent = nullptr); QSensorBackend *backend() const; private: @@ -261,7 +224,7 @@ private: #define DECLARE_READING_D(classname, pclassname)\ public:\ - classname(QObject *parent = Q_NULLPTR);\ + classname(QObject *parent = nullptr);\ virtual ~classname();\ void copyValuesFrom(QSensorReading *other) override;\ private:\ @@ -272,7 +235,7 @@ private: #define IMPLEMENT_READING_D(classname, pclassname)\ classname::classname(QObject *parent)\ - : QSensorReading(parent, Q_NULLPTR)\ + : QSensorReading(parent, nullptr)\ , d(new pclassname)\ {}\ classname::~classname() {}\ @@ -296,4 +259,3 @@ Q_DECLARE_METATYPE(qrangelist) Q_DECLARE_METATYPE(qoutputrangelist) #endif - diff --git a/src/sensors/qsensor_p.h b/src/sensors/qsensor_p.h index f3e41e4d..1b547fa1 100644 --- a/src/sensors/qsensor_p.h +++ b/src/sensors/qsensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QSENSOR_P_H #define QSENSOR_P_H @@ -77,7 +41,7 @@ public: , error(0) , alwaysOn(false) , skipDuplicates(false) - , axesOrientationMode(QSensor::FixedOrientation) + , axesOrientationMode(QSensor::AxesOrientationMode::FixedOrientation) , currentOrientation(0) , userOrientation(0) , bufferSize(1) diff --git a/src/sensors/qsensorbackend.cpp b/src/sensors/qsensorbackend.cpp index 31e2e811..beb56cf4 100644 --- a/src/sensors/qsensorbackend.cpp +++ b/src/sensors/qsensorbackend.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qsensorbackend.h" #include "qsensorbackend_p.h" @@ -318,21 +282,27 @@ void QSensorBackend::sensorStopped() } /*! - Inform the front end that the sensor is busy. - This implicitly calls sensorStopped() and - is typically called from start(). + Inform the front end of the sensor's busy state according + to the provided \a busy parameter. + + If the sensor is set \e busy this implicitly calls sensorStopped(). + Busy indication is typically done in start(). Note that the front end must call QSensor::isBusy() to see if the sensor is busy. If the sensor has stopped due to an error the sensorError() function should be called to notify the class of the error condition. */ -void QSensorBackend::sensorBusy() +void QSensorBackend::sensorBusy(bool busy) { Q_D(QSensorBackend); QSensorPrivate *sensorPrivate = d->m_sensor->d_func(); - sensorPrivate->active = false; - sensorPrivate->busy = true; + if (sensorPrivate->busy == busy) + return; + if (busy) + sensorPrivate->active = false; + sensorPrivate->busy = busy; + emit d->m_sensor->busyChanged(); } /*! diff --git a/src/sensors/qsensorbackend.h b/src/sensors/qsensorbackend.h index 3837c143..e890aec3 100644 --- a/src/sensors/qsensorbackend.h +++ b/src/sensors/qsensorbackend.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QSENSORBACKEND_H #define QSENSORBACKEND_H @@ -51,7 +15,7 @@ class Q_SENSORS_EXPORT QSensorBackend : public QObject { Q_OBJECT public: - explicit QSensorBackend(QSensor *sensor, QObject *parent = Q_NULLPTR); + explicit QSensorBackend(QSensor *sensor, QObject *parent = nullptr); virtual ~QSensorBackend(); virtual void start() = 0; @@ -80,7 +44,7 @@ public: // used by the backend to inform us of events void newReadingAvailable(); void sensorStopped(); - void sensorBusy(); + void sensorBusy(bool busy = true); void sensorError(int error); private: diff --git a/src/sensors/qsensorbackend_p.h b/src/sensors/qsensorbackend_p.h index 15835102..5d7ef2d2 100644 --- a/src/sensors/qsensorbackend_p.h +++ b/src/sensors/qsensorbackend_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Research In Motion +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QSENSORBACKEND_P_H #define QSENSORBACKEND_P_H diff --git a/src/sensors/qsensormanager.cpp b/src/sensors/qsensormanager.cpp index 425a87b9..8ce509f4 100644 --- a/src/sensors/qsensormanager.cpp +++ b/src/sensors/qsensormanager.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qsensormanager.h" #include <QDebug> @@ -53,7 +17,7 @@ QT_BEGIN_NAMESPACE typedef QHash<QByteArray,QSensorBackendFactory*> FactoryForIdentifierMap; typedef QHash<QByteArray,FactoryForIdentifierMap> BackendIdentifiersForTypeMap; -static QLoggingCategory sensorsCategory("qt.sensors"); +Q_LOGGING_CATEGORY(lcSensorManager, "qt.sensors"); class QSensorManagerPrivate : public QObject { @@ -96,19 +60,21 @@ public: QString config = QString::fromLocal8Bit(QTSENSORS_CONFIG_PATH); #else QStringList configs = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation); - if (configs.count() == 0) return; // QStandardPaths is broken? - QString config = configs.at(configs.count()-1); - if (config.isEmpty()) return; // QStandardPaths is broken? - config += QLatin1String("/QtProject/Sensors.conf"); + QString config; + for (const QString& c : configs) { + config = c + QLatin1String("/QtProject/Sensors.conf"); + if (QFile::exists(config)) + break; + } #endif - qCDebug(sensorsCategory) << "Loading config from" << config; + qCDebug(lcSensorManager) << "Loading config from" << config; if (!QFile::exists(config)) { - qCDebug(sensorsCategory) << "There is no config file" << config; + qCDebug(lcSensorManager) << "There is no config file" << config; return; } QFile cfgfile(config); if (!cfgfile.open(QFile::ReadOnly)) { - qCWarning(sensorsCategory) << "Can't open config file" << config; + qCWarning(lcSensorManager) << "Can't open config file" << config; return; } @@ -121,9 +87,9 @@ public: isconfig = true; else if (isconfig) { //read out setting line - line.remove(' '); - QStringList pair = line.split('='); - if (pair.count() == 2) + line.remove(QLatin1String(" ")); + QStringList pair = line.split(QStringLiteral("=")); + if (pair.size() == 2) defaultIdentifierForType.insert(pair[0].toLatin1(), pair[1].toLatin1()); } } @@ -159,9 +125,8 @@ public Q_SLOTS: // until things stop changing. do { sensorsChanged = false; - Q_FOREACH (QSensorChangesInterface *changes, changeListeners) { + for (QSensorChangesInterface *changes : changeListeners) changes->sensorsChanged(); - } } while (sensorsChanged); // We're going away now so clear the flag @@ -176,9 +141,9 @@ Q_GLOBAL_STATIC(QSensorManagerPrivate, sensorManagerPrivate) static void initPlugin(QObject *o, bool warnOnFail = true) { - qCDebug(sensorsCategory) << "Init plugin" << o; + qCDebug(lcSensorManager) << "Init plugin" << o; if (!o) { - qCWarning(sensorsCategory) << "Null plugin" << o; + qCWarning(lcSensorManager) << "Null plugin" << o; return; } @@ -186,7 +151,7 @@ static void initPlugin(QObject *o, bool warnOnFail = true) if (!d) return; // hardly likely but just in case... if (d->seenPlugins.contains(o)) { - qCDebug(sensorsCategory) << "Plugin is seen" << o; + qCDebug(lcSensorManager) << "Plugin is seen" << o; return; } @@ -197,11 +162,11 @@ static void initPlugin(QObject *o, bool warnOnFail = true) QSensorPluginInterface *plugin = qobject_cast<QSensorPluginInterface*>(o); if (plugin) { - qCDebug(sensorsCategory) << "Register sensors for " << plugin; + qCDebug(lcSensorManager) << "Register sensors for " << plugin; d->seenPlugins.insert(o); plugin->registerSensors(); } else if (warnOnFail) { - qCWarning(sensorsCategory) << "Can't cast to plugin" << o; + qCWarning(lcSensorManager) << "Can't cast to plugin" << o; } } @@ -213,14 +178,12 @@ void QSensorManagerPrivate::loadPlugins() SENSORLOG() << "initializing static plugins"; // Qt-style static plugins - Q_FOREACH (QObject *plugin, QPluginLoader::staticInstances()) { - initPlugin(plugin, false/*do not warn on fail*/); - } - + for (QObject *plugin : QPluginLoader::staticInstances()) + initPlugin(plugin, false /*do not warn on fail*/); if (d->loadExternalPlugins) { SENSORLOG() << "initializing plugins"; - QList<QJsonObject> meta = d->loader->metaData(); - for (int i = 0; i < meta.count(); i++) { + QList<QPluginParsedMetaData> meta = d->loader->metaData(); + for (qsizetype i = 0; i < meta.size(); i++) { QObject *plugin = d->loader->instance(i); initPlugin(plugin); } @@ -253,19 +216,23 @@ void QSensorManagerPrivate::loadPlugins() Register a sensor for \a type. The \a identifier must be unique. The \a factory will be asked to create instances of the backend. + + Sensor identifiers starting with \c generic or \c dummy are given lower + priority when choosing the default sensor if other sensors are found. */ void QSensorManager::registerBackend(const QByteArray &type, const QByteArray &identifier, QSensorBackendFactory *factory) { - Q_ASSERT(type.count()); - Q_ASSERT(identifier.count()); + Q_ASSERT(type.size()); + Q_ASSERT(identifier.size()); Q_ASSERT(factory); QSensorManagerPrivate *d = sensorManagerPrivate(); if (!d) return; // hardly likely but just in case... if (!d->backendsByType.contains(type)) { (void)d->backendsByType[type]; d->firstIdentifierForType[type] = identifier; - } else if (d->firstIdentifierForType[type].startsWith("generic.")) { - // Don't let a generic backend be the default when some other backend exists! + } else if (d->firstIdentifierForType[type].startsWith("generic.") || + d->firstIdentifierForType[type].startsWith("dummy.")) { + // Don't let a generic or dummy backend be the default when some other backend exists! d->firstIdentifierForType[type] = identifier; } FactoryForIdentifierMap &factoryByIdentifier = d->backendsByType[type]; @@ -304,7 +271,7 @@ void QSensorManager::unregisterBackend(const QByteArray &type, const QByteArray (void)factoryByIdentifier.take(identifier); // we don't own this pointer anyway if (d->firstIdentifierForType[type] == identifier) { - if (factoryByIdentifier.count()) { + if (factoryByIdentifier.size()) { d->firstIdentifierForType[type] = factoryByIdentifier.begin().key(); if (d->firstIdentifierForType[type].startsWith("generic.")) { // Don't let a generic backend be the default when some other backend exists! @@ -320,7 +287,7 @@ void QSensorManager::unregisterBackend(const QByteArray &type, const QByteArray (void)d->firstIdentifierForType.take(type); } } - if (!factoryByIdentifier.count()) + if (!factoryByIdentifier.size()) (void)d->backendsByType.take(type); // Notify the app that the available sensor list has changed. @@ -361,7 +328,7 @@ QSensorBackend *QSensorManager::createBackend(QSensor *sensor) if (backend) return backend; // Got it! // The default failed to instantiate so try any other registered sensors for this type - Q_FOREACH (const QByteArray &identifier, factoryByIdentifier.keys()) { + for (const QByteArray &identifier : factoryByIdentifier.keys()) { SENSORLOG() << "Trying" << identifier; if (identifier == defaultIdentifier) continue; // Don't do the default one again factory = factoryByIdentifier[identifier]; diff --git a/src/sensors/qsensormanager.h b/src/sensors/qsensormanager.h index 375c9ef1..5957ee7a 100644 --- a/src/sensors/qsensormanager.h +++ b/src/sensors/qsensormanager.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QSENSORMANAGER_H #define QSENSORMANAGER_H diff --git a/src/sensors/qsensorplugin.cpp b/src/sensors/qsensorplugin.cpp index 186539b7..bb85d574 100644 --- a/src/sensors/qsensorplugin.cpp +++ b/src/sensors/qsensorplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qsensorplugin.h" diff --git a/src/sensors/qsensorplugin.h b/src/sensors/qsensorplugin.h index fc3a44d7..3c8f4847 100644 --- a/src/sensors/qsensorplugin.h +++ b/src/sensors/qsensorplugin.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QSENSORPLUGIN_H #define QSENSORPLUGIN_H diff --git a/src/sensors/qsensorsglobal.h b/src/sensors/qsensorsglobal.h index 70985c27..4a6a130c 100644 --- a/src/sensors/qsensorsglobal.h +++ b/src/sensors/qsensorsglobal.h @@ -1,60 +1,11 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QSENSORSGLOBAL_H #define QSENSORSGLOBAL_H #include <QtCore/qglobal.h> - -QT_BEGIN_NAMESPACE - -#ifndef QT_STATIC -# if defined(QT_BUILD_SENSORS_LIB) -# define Q_SENSORS_EXPORT Q_DECL_EXPORT -# else -# define Q_SENSORS_EXPORT Q_DECL_IMPORT -# endif -#else -# define Q_SENSORS_EXPORT -#endif - -QT_END_NAMESPACE +#include <QtSensors/qtsensorsexports.h> #endif // QSENSORSGLOBAL_H diff --git a/src/sensors/qt_cmdline.cmake b/src/sensors/qt_cmdline.cmake new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/sensors/qt_cmdline.cmake diff --git a/src/sensors/qtapsensor.cpp b/src/sensors/qtapsensor.cpp index 9889a8c2..378f0e39 100644 --- a/src/sensors/qtapsensor.cpp +++ b/src/sensors/qtapsensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qtapsensor.h" #include "qtapsensor_p.h" @@ -49,6 +13,7 @@ IMPLEMENT_READING(QTapReading) \ingroup sensors_reading \inmodule QtSensors \since 5.1 + \internal \brief The QTapReading class represents one reading from the tap sensor. @@ -83,11 +48,17 @@ IMPLEMENT_READING(QTapReading) the detected axis. Previous versions of the API did not allow this. Applications that check for the _Pos and _Neg flags as values should be updated so they can work with all devices. - \oldcode + For example, if you have code like + + \code if (reading->tapDirection() == QTapReading::X_Pos) { ... } - \newcode + \endcode + + you can rewrite it as + + \code if (reading->tapDirection()&QTapReading::X_Pos) { ... } @@ -174,6 +145,7 @@ void QTapReading::setDoubleTap(bool doubleTap) \ingroup sensors_filter \inmodule QtSensors \since 5.1 + \internal \brief The QTapFilter class is a convenience wrapper around QSensorFilter. @@ -194,13 +166,14 @@ bool QTapFilter::filter(QSensorReading *reading) return filter(static_cast<QTapReading*>(reading)); } -char const * const QTapSensor::type("QTapSensor"); +char const * const QTapSensor::sensorType("QTapSensor"); /*! \class QTapSensor \ingroup sensors_type \inmodule QtSensors \since 5.1 + \internal \brief The QTapSensor class is a convenience wrapper around QSensor. @@ -217,7 +190,7 @@ char const * const QTapSensor::type("QTapSensor"); Construct the sensor as a child of \a parent. */ QTapSensor::QTapSensor(QObject *parent) - : QSensor(QTapSensor::type, *new QTapSensorPrivate, parent) + : QSensor(QTapSensor::sensorType, *new QTapSensorPrivate, parent) { } diff --git a/src/sensors/qtapsensor.h b/src/sensors/qtapsensor.h index 31ba67f6..6a76c311 100644 --- a/src/sensors/qtapsensor.h +++ b/src/sensors/qtapsensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QTAPSENSOR_H #define QTAPSENSOR_H @@ -49,7 +13,6 @@ class QTapReadingPrivate; class Q_SENSORS_EXPORT QTapReading : public QSensorReading { Q_OBJECT - Q_ENUMS(TapDirection) Q_PROPERTY(TapDirection tapDirection READ tapDirection) Q_PROPERTY(bool doubleTap READ isDoubleTap) DECLARE_READING(QTapReading) @@ -69,6 +32,7 @@ public: Y_Both = 0x0222, Z_Both = 0x0444 }; + Q_ENUM(TapDirection) TapDirection tapDirection() const; void setTapDirection(TapDirection tapDirection); @@ -93,10 +57,10 @@ class Q_SENSORS_EXPORT QTapSensor : public QSensor Q_PROPERTY(bool returnDoubleTapEvents READ returnDoubleTapEvents WRITE setReturnDoubleTapEvents NOTIFY returnDoubleTapEventsChanged) public: - explicit QTapSensor(QObject *parent = Q_NULLPTR); + explicit QTapSensor(QObject *parent = nullptr); virtual ~QTapSensor(); QTapReading *reading() const; - static char const * const type; + static char const * const sensorType; bool returnDoubleTapEvents() const; void setReturnDoubleTapEvents(bool returnDoubleTapEvents); @@ -112,4 +76,3 @@ private: QT_END_NAMESPACE #endif - diff --git a/src/sensors/qtapsensor_p.h b/src/sensors/qtapsensor_p.h index abfb134a..4a9a37f5 100644 --- a/src/sensors/qtapsensor_p.h +++ b/src/sensors/qtapsensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QTAPSENSOR_P_H #define QTAPSENSOR_P_H diff --git a/src/sensors/qtiltsensor.cpp b/src/sensors/qtiltsensor.cpp index 310ed36c..bda3c0a5 100644 --- a/src/sensors/qtiltsensor.cpp +++ b/src/sensors/qtiltsensor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qtiltsensor.h" #include "qtiltsensor_p.h" @@ -63,7 +27,8 @@ IMPLEMENT_READING(QTiltReading) /*! \property QTiltReading::yRotation - \brief This property holds the amount of tilt on the Y axis. + \brief This property holds the amount of tilt on the Y axis, + measured in degrees. */ qreal QTiltReading::yRotation() const { @@ -71,7 +36,7 @@ qreal QTiltReading::yRotation() const } /*! - Sets yRotation to \a y. + Sets yRotation to \a y degrees. */ void QTiltReading::setYRotation(qreal y) { @@ -80,7 +45,8 @@ void QTiltReading::setYRotation(qreal y) /*! \property QTiltReading::xRotation - \brief This property holds the amount of tilt on the X axis. + \brief This property holds the amount of tilt on the X axis, + measured in degrees. */ qreal QTiltReading::xRotation() const @@ -89,7 +55,7 @@ qreal QTiltReading::xRotation() const } /*! - Sets xRotation to \a x. + Sets xRotation to \a x degrees. */ void QTiltReading::setXRotation(qreal x) { @@ -123,7 +89,7 @@ bool QTiltFilter::filter(QSensorReading *reading) return filter(static_cast<QTiltReading*>(reading)); } -char const * const QTiltSensor::type("QTiltSensor"); +char const * const QTiltSensor::sensorType("QTiltSensor"); /*! \class QTiltSensor @@ -133,7 +99,7 @@ char const * const QTiltSensor::type("QTiltSensor"); \brief The QTiltSensor class is a convenience wrapper around QSensor. - The only behavioural difference is that this class sets the type properly.QMetaObject::invokeMethod(backend(), "calibrate"); + The only behavioural difference is that this class sets the type properly. This class also features a reading() function that returns a QTiltReading instead of a QSensorReading. @@ -148,7 +114,7 @@ char const * const QTiltSensor::type("QTiltSensor"); Construct the sensor as a child of \a parent. */ QTiltSensor::QTiltSensor(QObject *parent) - : QSensor(QTiltSensor::type, parent) + : QSensor(QTiltSensor::sensorType, parent) { } @@ -174,7 +140,7 @@ QTiltReading *QTiltSensor::reading() const } /*! - Calibrates the tilt sensor. Uses the current tilt angles as 0. + Calibrates the tilt sensor. Uses the current tilt angles as 0 degrees. */ void QTiltSensor::calibrate() { diff --git a/src/sensors/qtiltsensor.h b/src/sensors/qtiltsensor.h index 2e0d0a78..50584199 100644 --- a/src/sensors/qtiltsensor.h +++ b/src/sensors/qtiltsensor.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QTILTSENSOR_H #define QTILTSENSOR_H @@ -74,10 +38,10 @@ class Q_SENSORS_EXPORT QTiltSensor : public QSensor { Q_OBJECT public: - explicit QTiltSensor(QObject *parent = Q_NULLPTR); + explicit QTiltSensor(QObject *parent = nullptr); ~QTiltSensor(); QTiltReading *reading() const; - static char const * const type; + static char const * const sensorType; Q_INVOKABLE void calibrate(); diff --git a/src/sensors/qtiltsensor_p.h b/src/sensors/qtiltsensor_p.h index b6a49b00..838c6042 100644 --- a/src/sensors/qtiltsensor_p.h +++ b/src/sensors/qtiltsensor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QTILTSENSOR_P_H #define QTILTSENSOR_P_H @@ -51,6 +15,8 @@ // We mean it. // +#include <QtCore/private/qglobal_p.h> + QT_BEGIN_NAMESPACE class QTiltReadingPrivate diff --git a/src/sensors/sensorlog_p.h b/src/sensors/sensorlog_p.h index 49e73166..ae3956cb 100644 --- a/src/sensors/sensorlog_p.h +++ b/src/sensors/sensorlog_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QSENSORLOG_P_H #define QSENSORLOG_P_H @@ -51,6 +15,8 @@ // We mean it. // +#include <QtCore/private/qglobal_p.h> + QT_BEGIN_NAMESPACE #ifdef ENABLE_RUNTIME_SENSORLOG diff --git a/src/sensors/sensors.pro b/src/sensors/sensors.pro deleted file mode 100644 index c4035038..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/libqtsensors_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) |