diff options
Diffstat (limited to 'src/imports/sensors')
51 files changed, 0 insertions, 6998 deletions
diff --git a/src/imports/sensors/plugin.json b/src/imports/sensors/plugin.json deleted file mode 100644 index 0967ef42..00000000 --- a/src/imports/sensors/plugin.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/src/imports/sensors/plugins.qmltypes b/src/imports/sensors/plugins.qmltypes deleted file mode 100644 index b78e63c6..00000000 --- a/src/imports/sensors/plugins.qmltypes +++ /dev/null @@ -1,613 +0,0 @@ -import QtQuick.tooling 1.2 - -// This file describes the plugin-supplied types contained in the library. -// It is used for QML tooling purposes only. -// -// This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtSensors 5.13' - -Module { - dependencies: ["QtQuick 2.0"] - Component { - name: "QmlAccelerometer" - prototype: "QmlSensor" - exports: [ - "QtSensors/Accelerometer 5.0", - "QtSensors/Accelerometer 5.1", - "QtSensors/Accelerometer 5.2" - ] - exportMetaObjectRevisions: [0, 1, 1] - Enum { - name: "AccelerationMode" - values: { - "Combined": 0, - "Gravity": 1, - "User": 2 - } - } - Property { name: "accelerationMode"; revision: 1; type: "AccelerationMode" } - Signal { - name: "accelerationModeChanged" - revision: 1 - Parameter { name: "accelerationMode"; type: "AccelerationMode" } - } - } - Component { - name: "QmlAccelerometerReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/AccelerometerReading 5.0", - "QtSensors/AccelerometerReading 5.1", - "QtSensors/AccelerometerReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "x"; type: "double"; isReadonly: true } - Property { name: "y"; type: "double"; isReadonly: true } - Property { name: "z"; type: "double"; isReadonly: true } - } - Component { - name: "QmlAltimeter" - prototype: "QmlSensor" - exports: ["QtSensors/Altimeter 5.1", "QtSensors/Altimeter 5.2"] - exportMetaObjectRevisions: [0, 0] - } - Component { - name: "QmlAltimeterReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/AltimeterReading 5.1", - "QtSensors/AltimeterReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0] - Property { name: "altitude"; type: "double"; isReadonly: true } - } - Component { - name: "QmlAmbientLightSensor" - prototype: "QmlSensor" - exports: [ - "QtSensors/AmbientLightSensor 5.0", - "QtSensors/AmbientLightSensor 5.1", - "QtSensors/AmbientLightSensor 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - } - Component { - name: "QmlAmbientLightSensorReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/AmbientLightReading 5.0", - "QtSensors/AmbientLightReading 5.1", - "QtSensors/AmbientLightReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "lightLevel"; type: "QAmbientLightReading::LightLevel"; isReadonly: true } - } - Component { - name: "QmlAmbientTemperatureReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/AmbientTemperatureReading 5.1", - "QtSensors/AmbientTemperatureReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0] - Property { name: "temperature"; type: "double"; isReadonly: true } - } - Component { - name: "QmlAmbientTemperatureSensor" - prototype: "QmlSensor" - exports: [ - "QtSensors/AmbientTemperatureSensor 5.1", - "QtSensors/AmbientTemperatureSensor 5.2" - ] - exportMetaObjectRevisions: [0, 0] - } - Component { - name: "QmlCompass" - prototype: "QmlSensor" - exports: [ - "QtSensors/Compass 5.0", - "QtSensors/Compass 5.1", - "QtSensors/Compass 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - } - Component { - name: "QmlCompassReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/CompassReading 5.0", - "QtSensors/CompassReading 5.1", - "QtSensors/CompassReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "azimuth"; type: "double"; isReadonly: true } - Property { name: "calibrationLevel"; type: "double"; isReadonly: true } - } - Component { - name: "QmlDistanceReading" - prototype: "QmlSensorReading" - exports: ["QtSensors/DistanceReading 5.4"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "distance"; type: "double"; isReadonly: true } - } - Component { - name: "QmlDistanceSensor" - prototype: "QmlSensor" - exports: ["QtSensors/DistanceSensor 5.4"] - exportMetaObjectRevisions: [0] - } - Component { - name: "QmlGyroscope" - prototype: "QmlSensor" - exports: [ - "QtSensors/Gyroscope 5.0", - "QtSensors/Gyroscope 5.1", - "QtSensors/Gyroscope 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - } - Component { - name: "QmlGyroscopeReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/GyroscopeReading 5.0", - "QtSensors/GyroscopeReading 5.1", - "QtSensors/GyroscopeReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "x"; type: "double"; isReadonly: true } - Property { name: "y"; type: "double"; isReadonly: true } - Property { name: "z"; type: "double"; isReadonly: true } - } - Component { - name: "QmlHolsterReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/HolsterReading 5.1", - "QtSensors/HolsterReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0] - Property { name: "holstered"; type: "bool"; isReadonly: true } - } - Component { - name: "QmlHolsterSensor" - prototype: "QmlSensor" - exports: [ - "QtSensors/HolsterSensor 5.1", - "QtSensors/HolsterSensor 5.2" - ] - exportMetaObjectRevisions: [0, 0] - } - Component { - name: "QmlHumidityReading" - prototype: "QmlSensorReading" - exports: ["QtSensors/HumidityReading 5.9"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "relativeHumidity"; type: "double"; isReadonly: true } - Property { name: "absoluteHumidity"; type: "double"; isReadonly: true } - } - Component { - name: "QmlHumiditySensor" - prototype: "QmlSensor" - exports: ["QtSensors/HumiditySensor 5.9"] - exportMetaObjectRevisions: [0] - } - Component { - name: "QmlIRProximitySensor" - prototype: "QmlSensor" - exports: [ - "QtSensors/IRProximitySensor 5.0", - "QtSensors/IRProximitySensor 5.1", - "QtSensors/IRProximitySensor 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - } - Component { - name: "QmlIRProximitySensorReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/IRProximityReading 5.0", - "QtSensors/IRProximityReading 5.1", - "QtSensors/IRProximityReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "reflectance"; type: "double"; isReadonly: true } - } - Component { - name: "QmlLidReading" - prototype: "QmlSensorReading" - exports: ["QtSensors/LidReading 5.9"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "backLidChanged"; type: "bool"; isReadonly: true } - Property { name: "frontLidClosed"; type: "bool"; isReadonly: true } - Signal { - name: "backLidChanged" - Parameter { name: "closed"; type: "bool" } - } - Signal { - name: "frontLidChanged" - type: "bool" - Parameter { name: "closed"; type: "bool" } - } - } - Component { - name: "QmlLidSensor" - prototype: "QmlSensor" - exports: ["QtSensors/LidSensor 5.9"] - exportMetaObjectRevisions: [0] - } - Component { - name: "QmlLightSensor" - prototype: "QmlSensor" - exports: [ - "QtSensors/LightSensor 5.0", - "QtSensors/LightSensor 5.1", - "QtSensors/LightSensor 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "fieldOfView"; type: "double"; isReadonly: true } - Signal { - name: "fieldOfViewChanged" - Parameter { name: "fieldOfView"; type: "double" } - } - } - Component { - name: "QmlLightSensorReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/LightReading 5.0", - "QtSensors/LightReading 5.1", - "QtSensors/LightReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "illuminance"; type: "double"; isReadonly: true } - } - Component { - name: "QmlMagnetometer" - prototype: "QmlSensor" - exports: [ - "QtSensors/Magnetometer 5.0", - "QtSensors/Magnetometer 5.1", - "QtSensors/Magnetometer 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "returnGeoValues"; type: "bool" } - Signal { - name: "returnGeoValuesChanged" - Parameter { name: "returnGeoValues"; type: "bool" } - } - } - Component { - name: "QmlMagnetometerReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/MagnetometerReading 5.0", - "QtSensors/MagnetometerReading 5.1", - "QtSensors/MagnetometerReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "x"; type: "double"; isReadonly: true } - Property { name: "y"; type: "double"; isReadonly: true } - Property { name: "z"; type: "double"; isReadonly: true } - Property { name: "calibrationLevel"; type: "double"; isReadonly: true } - } - Component { - name: "QmlOrientationSensor" - prototype: "QmlSensor" - exports: [ - "QtSensors/OrientationSensor 5.0", - "QtSensors/OrientationSensor 5.1", - "QtSensors/OrientationSensor 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - } - Component { - name: "QmlOrientationSensorReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/OrientationReading 5.0", - "QtSensors/OrientationReading 5.1", - "QtSensors/OrientationReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "orientation"; type: "QOrientationReading::Orientation"; isReadonly: true } - } - Component { - name: "QmlPressureReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/PressureReading 5.1", - "QtSensors/PressureReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 1] - Property { name: "pressure"; type: "double"; isReadonly: true } - Property { name: "temperature"; revision: 1; type: "double"; isReadonly: true } - Signal { name: "temperatureChanged"; revision: 1 } - } - Component { - name: "QmlPressureSensor" - prototype: "QmlSensor" - exports: [ - "QtSensors/PressureSensor 5.1", - "QtSensors/PressureSensor 5.2" - ] - exportMetaObjectRevisions: [0, 0] - } - Component { - name: "QmlProximitySensor" - prototype: "QmlSensor" - exports: [ - "QtSensors/ProximitySensor 5.0", - "QtSensors/ProximitySensor 5.1", - "QtSensors/ProximitySensor 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - } - Component { - name: "QmlProximitySensorReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/ProximityReading 5.0", - "QtSensors/ProximityReading 5.1", - "QtSensors/ProximityReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "near"; type: "bool"; isReadonly: true } - } - Component { - name: "QmlRotationSensor" - prototype: "QmlSensor" - exports: [ - "QtSensors/RotationSensor 5.0", - "QtSensors/RotationSensor 5.1", - "QtSensors/RotationSensor 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "hasZ"; type: "bool"; isReadonly: true } - Signal { - name: "hasZChanged" - Parameter { name: "hasZ"; type: "bool" } - } - } - Component { - name: "QmlRotationSensorReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/RotationReading 5.0", - "QtSensors/RotationReading 5.1", - "QtSensors/RotationReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "x"; type: "double"; isReadonly: true } - Property { name: "y"; type: "double"; isReadonly: true } - Property { name: "z"; type: "double"; isReadonly: true } - } - Component { - name: "QmlSensor" - prototype: "QObject" - exports: [ - "QtSensors/Sensor 5.0", - "QtSensors/Sensor 5.1", - "QtSensors/Sensor 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 1, 1] - Enum { - name: "AxesOrientationMode" - values: { - "FixedOrientation": 0, - "AutomaticOrientation": 1, - "UserOrientation": 2 - } - } - Property { name: "identifier"; type: "string" } - Property { name: "type"; type: "string"; isReadonly: true } - Property { name: "connectedToBackend"; type: "bool"; isReadonly: true } - Property { name: "availableDataRates"; type: "QmlSensorRange"; isList: true; isReadonly: true } - Property { name: "dataRate"; type: "int" } - Property { name: "reading"; type: "QmlSensorReading"; isReadonly: true; isPointer: true } - Property { name: "busy"; type: "bool"; isReadonly: true } - Property { name: "active"; type: "bool" } - Property { name: "outputRanges"; type: "QmlSensorOutputRange"; isList: true; isReadonly: true } - Property { name: "outputRange"; type: "int" } - Property { name: "description"; type: "string"; isReadonly: true } - Property { name: "error"; type: "int"; isReadonly: true } - Property { name: "alwaysOn"; type: "bool" } - Property { name: "skipDuplicates"; revision: 1; type: "bool" } - Property { name: "axesOrientationMode"; revision: 1; type: "AxesOrientationMode" } - Property { name: "currentOrientation"; revision: 1; type: "int"; isReadonly: true } - Property { name: "userOrientation"; revision: 1; type: "int" } - Property { name: "maxBufferSize"; revision: 1; type: "int"; isReadonly: true } - Property { name: "efficientBufferSize"; revision: 1; type: "int"; isReadonly: true } - Property { name: "bufferSize"; revision: 1; type: "int" } - Signal { - name: "skipDuplicatesChanged" - revision: 1 - Parameter { name: "skipDuplicates"; type: "bool" } - } - Signal { - name: "axesOrientationModeChanged" - revision: 1 - Parameter { name: "axesOrientationMode"; type: "AxesOrientationMode" } - } - Signal { - name: "currentOrientationChanged" - revision: 1 - Parameter { name: "currentOrientation"; type: "int" } - } - Signal { - name: "userOrientationChanged" - revision: 1 - Parameter { name: "userOrientation"; type: "int" } - } - Signal { - name: "maxBufferSizeChanged" - revision: 1 - Parameter { name: "maxBufferSize"; type: "int" } - } - Signal { - name: "efficientBufferSizeChanged" - revision: 1 - Parameter { name: "efficientBufferSize"; type: "int" } - } - Signal { - name: "bufferSizeChanged" - revision: 1 - Parameter { name: "bufferSize"; type: "int" } - } - Method { name: "start"; type: "bool" } - Method { name: "stop" } - } - Component { - name: "QmlSensorGesture" - prototype: "QObject" - exports: [ - "QtSensors/SensorGesture 5.0", - "QtSensors/SensorGesture 5.1", - "QtSensors/SensorGesture 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "availableGestures"; type: "QStringList"; isReadonly: true } - Property { name: "gestures"; type: "QStringList" } - Property { name: "validGestures"; type: "QStringList"; isReadonly: true } - Property { name: "invalidGestures"; type: "QStringList"; isReadonly: true } - Property { name: "enabled"; type: "bool" } - Signal { - name: "detected" - Parameter { name: "gesture"; type: "string" } - } - } - Component { - name: "QmlSensorGlobal" - prototype: "QObject" - exports: [ - "QtSensors/QmlSensors 5.0", - "QtSensors/QmlSensors 5.1", - "QtSensors/QmlSensors 5.2" - ] - isCreatable: false - isSingleton: true - exportMetaObjectRevisions: [0, 0, 0] - Signal { name: "availableSensorsChanged" } - Method { name: "sensorTypes"; type: "QStringList" } - Method { - name: "sensorsForType" - type: "QStringList" - Parameter { name: "type"; type: "string" } - } - Method { - name: "defaultSensorForType" - type: "string" - Parameter { name: "type"; type: "string" } - } - } - Component { - name: "QmlSensorOutputRange" - prototype: "QObject" - exports: [ - "QtSensors/OutputRange 5.0", - "QtSensors/OutputRange 5.1", - "QtSensors/OutputRange 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "minimum"; type: "double"; isReadonly: true } - Property { name: "maximum"; type: "double"; isReadonly: true } - Property { name: "accuracy"; type: "double"; isReadonly: true } - } - Component { - name: "QmlSensorRange" - prototype: "QObject" - exports: [ - "QtSensors/Range 5.0", - "QtSensors/Range 5.1", - "QtSensors/Range 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "minimum"; type: "int"; isReadonly: true } - Property { name: "maximum"; type: "int"; isReadonly: true } - } - Component { - name: "QmlSensorReading" - prototype: "QObject" - exports: [ - "QtSensors/SensorReading 5.0", - "QtSensors/SensorReading 5.1", - "QtSensors/SensorReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "timestamp"; type: "qulonglong"; isReadonly: true } - } - Component { - name: "QmlTapSensor" - prototype: "QmlSensor" - exports: [ - "QtSensors/TapSensor 5.0", - "QtSensors/TapSensor 5.1", - "QtSensors/TapSensor 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "returnDoubleTapEvents"; type: "bool" } - Signal { - name: "returnDoubleTapEventsChanged" - Parameter { name: "returnDoubleTapEvents"; type: "bool" } - } - } - Component { - name: "QmlTapSensorReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/TapReading 5.0", - "QtSensors/TapReading 5.1", - "QtSensors/TapReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "tapDirection"; type: "QTapReading::TapDirection"; isReadonly: true } - Property { name: "doubleTap"; type: "bool"; isReadonly: true } - Signal { name: "isDoubleTapChanged" } - } - Component { - name: "QmlTiltSensor" - prototype: "QmlSensor" - exports: [ - "QtSensors/TiltSensor 5.0", - "QtSensors/TiltSensor 5.1", - "QtSensors/TiltSensor 5.2" - ] - exportMetaObjectRevisions: [0, 0, 0] - Method { name: "calibrate" } - } - Component { - name: "QmlTiltSensorReading" - prototype: "QmlSensorReading" - exports: [ - "QtSensors/TiltReading 5.0", - "QtSensors/TiltReading 5.1", - "QtSensors/TiltReading 5.2" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 0, 0] - Property { name: "yRotation"; type: "double"; isReadonly: true } - Property { name: "xRotation"; type: "double"; isReadonly: true } - } -} diff --git a/src/imports/sensors/qmlaccelerometer.cpp b/src/imports/sensors/qmlaccelerometer.cpp deleted file mode 100644 index 8d78fbfc..00000000 --- a/src/imports/sensors/qmlaccelerometer.cpp +++ /dev/null @@ -1,188 +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 "qmlaccelerometer.h" -#include <QtSensors/QAccelerometer> - -/*! - \qmltype Accelerometer - \instantiates QmlAccelerometer - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The Accelerometer element reports on linear acceleration - along the X, Y and Z axes. - - The Accelerometer element reports on linear acceleration - along the X, Y and Z axes. - - This element wraps the QAccelerometer class. Please see the documentation for - QAccelerometer for details. - - \sa AccelerometerReading -*/ - -QmlAccelerometer::QmlAccelerometer(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QAccelerometer(this)) -{ - connect(m_sensor, SIGNAL(accelerationModeChanged(AccelerationMode)), - this, SIGNAL(accelerationModeChanged(AccelerationMode))); -} - -QmlAccelerometer::~QmlAccelerometer() -{ -} - -/*! - \qmlproperty AccelerationMode Accelerometer::accelerationMode - \since QtSensors 5.1 - - This property holds the current acceleration mode. - - Please see QAccelerometer::accelerationMode for information about this property. -*/ - -QmlAccelerometer::AccelerationMode QmlAccelerometer::accelerationMode() const -{ - return static_cast<QmlAccelerometer::AccelerationMode>(m_sensor->accelerationMode()); -} - -void QmlAccelerometer::setAccelerationMode(QmlAccelerometer::AccelerationMode accelerationMode) -{ - m_sensor->setAccelerationMode(static_cast<QAccelerometer::AccelerationMode>(accelerationMode)); -} - -QmlSensorReading *QmlAccelerometer::createReading() const -{ - return new QmlAccelerometerReading(m_sensor); -} - -QSensor *QmlAccelerometer::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype AccelerometerReading - \instantiates QmlAccelerometerReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The AccelerometerReading element holds the most recent Accelerometer reading. - - The AccelerometerReading element holds the most recent Accelerometer reading. - - This element wraps the QAccelerometerReading class. Please see the documentation for - QAccelerometerReading for details. - - This element cannot be directly created. -*/ - -QmlAccelerometerReading::QmlAccelerometerReading(QAccelerometer *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlAccelerometerReading::~QmlAccelerometerReading() -{ -} - -/*! - \qmlproperty qreal AccelerometerReading::x - This property holds the acceleration on the X axis. - - Please see QAccelerometerReading::x for information about this property. -*/ - -qreal QmlAccelerometerReading::x() const -{ - return m_x; -} - -/*! - \qmlproperty qreal AccelerometerReading::y - This property holds the acceleration on the Y axis. - - Please see QAccelerometerReading::y for information about this property. -*/ - -qreal QmlAccelerometerReading::y() const -{ - return m_y; -} - -/*! - \qmlproperty qreal AccelerometerReading::z - This property holds the acceleration on the Z axis. - - Please see QAccelerometerReading::z for information about this property. -*/ - -qreal QmlAccelerometerReading::z() const -{ - return m_z; -} - -QSensorReading *QmlAccelerometerReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlAccelerometerReading::readingUpdate() -{ - qreal aX = m_sensor->reading()->x(); - if (m_x != aX) { - m_x = aX; - Q_EMIT xChanged(); - } - qreal aY = m_sensor->reading()->y(); - if (m_y != aY) { - m_y = aY; - Q_EMIT yChanged(); - } - qreal aZ = m_sensor->reading()->z(); - if (m_z != aZ) { - m_z = aZ; - Q_EMIT zChanged(); - } -} diff --git a/src/imports/sensors/qmlaccelerometer.h b/src/imports/sensors/qmlaccelerometer.h deleted file mode 100644 index e04b9712..00000000 --- a/src/imports/sensors/qmlaccelerometer.h +++ /dev/null @@ -1,107 +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 QMLACCELEROMETER_H -#define QMLACCELEROMETER_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QAccelerometer; - -class QmlAccelerometer : public QmlSensor -{ - Q_OBJECT - Q_ENUMS(AccelerationMode) - Q_PROPERTY(AccelerationMode accelerationMode READ accelerationMode WRITE setAccelerationMode - NOTIFY accelerationModeChanged REVISION 1) -public: - explicit QmlAccelerometer(QObject *parent = 0); - ~QmlAccelerometer(); - - // Keep this enum in sync with QAccelerometer::AccelerationMode - enum AccelerationMode { - Combined, - Gravity, - User - }; - - AccelerationMode accelerationMode() const; - void setAccelerationMode(AccelerationMode accelerationMode); - -signals: - Q_REVISION(1) void accelerationModeChanged(AccelerationMode accelerationMode); - -private: - QSensor *sensor() const override; - QAccelerometer *m_sensor; - QmlSensorReading *createReading() const override; -}; - -class QmlAccelerometerReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal x READ x NOTIFY xChanged) - Q_PROPERTY(qreal y READ y NOTIFY yChanged) - Q_PROPERTY(qreal z READ z NOTIFY zChanged) -public: - explicit QmlAccelerometerReading(QAccelerometer *sensor); - ~QmlAccelerometerReading(); - - qreal x() const; - qreal y() const; - qreal z() const; - -Q_SIGNALS: - void xChanged(); - void yChanged(); - void zChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QAccelerometer *m_sensor; - qreal m_x; - qreal m_y; - qreal m_z; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlaltimeter.cpp b/src/imports/sensors/qmlaltimeter.cpp deleted file mode 100644 index 63c979d3..00000000 --- a/src/imports/sensors/qmlaltimeter.cpp +++ /dev/null @@ -1,131 +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 "qmlaltimeter.h" -#include <QtSensors/QAltimeter> - -/*! - \qmltype Altimeter - \instantiates QmlAltimeter - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.1 - \inherits Sensor - \brief The Altimeter element reports on altitude. - - The Altimeter element reports on altitude. - - This element wraps the QAltimeter class. Please see the documentation for - QAltimeter for details. - - \sa AltimeterReading -*/ - -QmlAltimeter::QmlAltimeter(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QAltimeter(this)) -{ -} - -QmlAltimeter::~QmlAltimeter() -{ -} - -QmlSensorReading *QmlAltimeter::createReading() const -{ - return new QmlAltimeterReading(m_sensor); -} - -QSensor *QmlAltimeter::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype AltimeterReading - \instantiates QmlAltimeterReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.1 - \inherits SensorReading - \brief The AltimeterReading element holds the most recent Altimeter reading. - - The AltimeterReading element holds the most recent Altimeter reading. - - This element wraps the QAltimeterReading class. Please see the documentation for - QAltimeterReading for details. - - This element cannot be directly created. -*/ - -QmlAltimeterReading::QmlAltimeterReading(QAltimeter *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) - , m_altitude(0) -{ -} - -QmlAltimeterReading::~QmlAltimeterReading() -{ -} - -/*! - \qmlproperty qreal AltimeterReading::altitude - This property holds the altitude of the device. - - Please see QAltimeterReading::altitude for information about this property. -*/ - -qreal QmlAltimeterReading::altitude() const -{ - return m_altitude; -} - -QSensorReading *QmlAltimeterReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlAltimeterReading::readingUpdate() -{ - qreal altitude = m_sensor->reading()->altitude(); - if (m_altitude != altitude) { - m_altitude = altitude; - Q_EMIT altitudeChanged(); - } -} diff --git a/src/imports/sensors/qmlaltimeter.h b/src/imports/sensors/qmlaltimeter.h deleted file mode 100644 index 04938b53..00000000 --- a/src/imports/sensors/qmlaltimeter.h +++ /dev/null @@ -1,84 +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 QMLALTIMETER_H -#define QMLALTIMETER_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QAltimeter; - -class QmlAltimeter : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlAltimeter(QObject *parent = 0); - ~QmlAltimeter(); - -private: - QSensor *sensor() const override; - QmlSensorReading *createReading() const override; - - QAltimeter *m_sensor; -}; - -class QmlAltimeterReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal altitude READ altitude NOTIFY altitudeChanged) -public: - explicit QmlAltimeterReading(QAltimeter *sensor); - ~QmlAltimeterReading(); - - qreal altitude() const; - -Q_SIGNALS: - void altitudeChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - - QAltimeter *m_sensor; - qreal m_altitude; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlambientlightsensor.cpp b/src/imports/sensors/qmlambientlightsensor.cpp deleted file mode 100644 index 5d9ab3b6..00000000 --- a/src/imports/sensors/qmlambientlightsensor.cpp +++ /dev/null @@ -1,141 +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 "qmlambientlightsensor.h" -#include <QtSensors/QAmbientLightSensor> - -/*! - \qmltype AmbientLightSensor - \instantiates QmlAmbientLightSensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The AmbientLightSensor element repors on ambient lighting conditions. - - The AmbientLightSensor element repors on ambient lighting conditions. - - This element wraps the QAmbientLightSensor class. Please see the documentation for - QAmbientLightSensor for details. - - \sa AmbientLightReading -*/ - -QmlAmbientLightSensor::QmlAmbientLightSensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QAmbientLightSensor(this)) -{ -} - -QmlAmbientLightSensor::~QmlAmbientLightSensor() -{ -} - -QmlSensorReading *QmlAmbientLightSensor::createReading() const -{ - return new QmlAmbientLightSensorReading(m_sensor); -} - -QSensor *QmlAmbientLightSensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype AmbientLightReading - \instantiates QmlAmbientLightSensorReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The AmbientLightReading element holds the most AmbientLightSensor reading. - - The AmbientLightReading element holds the most AmbientLightSensor reading. - - This element wraps the QAmbientLightReading class. Please see the documentation for - QAmbientLightReading for details. - - This element cannot be directly created. -*/ - -QmlAmbientLightSensorReading::QmlAmbientLightSensorReading(QAmbientLightSensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlAmbientLightSensorReading::~QmlAmbientLightSensorReading() -{ -} - -/*! - \qmlproperty LightLevel AmbientLightReading::lightLevel - This property holds the ambient light level. - - Please see QAmbientLightReading::lightLevel for information about this property. - - Note that LightLevel constants are exposed through the AmbientLightReading class. - \code - AmbientLightSensor { - onReadingChanged: { - if (reading.lightLevel == AmbientLightReading.Dark) - // do something - } - } - \endcode -*/ - -QAmbientLightReading::LightLevel QmlAmbientLightSensorReading::lightLevel() const -{ - return m_lightLevel; -} - -QSensorReading *QmlAmbientLightSensorReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlAmbientLightSensorReading::readingUpdate() -{ - QAmbientLightReading::LightLevel ll = m_sensor->reading()->lightLevel(); - if (m_lightLevel != ll) { - m_lightLevel = ll; - Q_EMIT lightLevelChanged(); - } -} diff --git a/src/imports/sensors/qmlambientlightsensor.h b/src/imports/sensors/qmlambientlightsensor.h deleted file mode 100644 index 4de42f31..00000000 --- a/src/imports/sensors/qmlambientlightsensor.h +++ /dev/null @@ -1,86 +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 QMLAMBIENTLIGHTSENSOR_H -#define QMLAMBIENTLIGHTSENSOR_H - -#include "qmlsensor.h" -#include <QtSensors/QAmbientLightSensor> - -QT_BEGIN_NAMESPACE - -class QAmbientLightSensor; - -class QmlAmbientLightSensor : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlAmbientLightSensor(QObject *parent = 0); - ~QmlAmbientLightSensor(); - -private: - QSensor *sensor() const override; - QAmbientLightSensor *m_sensor; - QmlSensorReading *createReading() const override; - -}; - -class QmlAmbientLightSensorReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(QAmbientLightReading::LightLevel lightLevel READ lightLevel NOTIFY lightLevelChanged) -public: - - explicit QmlAmbientLightSensorReading(QAmbientLightSensor *sensor); - ~QmlAmbientLightSensorReading(); - - QAmbientLightReading::LightLevel lightLevel() const; - -Q_SIGNALS: - void lightLevelChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QAmbientLightSensor *m_sensor; - QAmbientLightReading::LightLevel m_lightLevel; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlambienttemperaturesensor.cpp b/src/imports/sensors/qmlambienttemperaturesensor.cpp deleted file mode 100644 index 1958f6d8..00000000 --- a/src/imports/sensors/qmlambienttemperaturesensor.cpp +++ /dev/null @@ -1,131 +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 "qmlambienttemperaturesensor.h" -#include <QtSensors/QAmbientTemperatureSensor> - -/*! - \qmltype AmbientTemperatureSensor - \instantiates QmlAmbientTemperatureSensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.1 - \inherits Sensor - \brief The AmbientTemperatureSensor element reports on the ambient temperature. - - The AmbientTemperatureSensor element reports on the ambient temperature. - - This element wraps the QAmbientTemperatureSensor class. Please see the documentation for - QAmbientTemperatureSensor for details. - - \sa AmbientTemperatureReading -*/ - -QmlAmbientTemperatureSensor::QmlAmbientTemperatureSensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QAmbientTemperatureSensor(this)) -{ -} - -QmlAmbientTemperatureSensor::~QmlAmbientTemperatureSensor() -{ -} - -QmlSensorReading *QmlAmbientTemperatureSensor::createReading() const -{ - return new QmlAmbientTemperatureReading(m_sensor); -} - -QSensor *QmlAmbientTemperatureSensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype AmbientTemperatureReading - \instantiates QmlAmbientTemperatureReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.1 - \inherits SensorReading - \brief The AmbientTemperatureReading element holds the most recent temperature reading. - - The AmbientTemperatureReading element holds the most recent temperature reading. - - This element wraps the QAmbientTemperatureReading class. Please see the documentation for - QAmbientTemperatureReading for details. - - This element cannot be directly created. -*/ - -QmlAmbientTemperatureReading::QmlAmbientTemperatureReading(QAmbientTemperatureSensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) - , m_temperature(0) -{ -} - -QmlAmbientTemperatureReading::~QmlAmbientTemperatureReading() -{ -} - -/*! - \qmlproperty qreal AmbientTemperatureReading::temperature - This property holds the ambient temperature in degree Celsius. - - Please see QAmbientTemperatureReading::temperature for information about this property. -*/ - -qreal QmlAmbientTemperatureReading::temperature() const -{ - return m_temperature; -} - -QSensorReading *QmlAmbientTemperatureReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlAmbientTemperatureReading::readingUpdate() -{ - const qreal temperature = m_sensor->reading()->temperature(); - if (m_temperature != temperature) { - m_temperature = temperature; - Q_EMIT temperatureChanged(); - } -} diff --git a/src/imports/sensors/qmlambienttemperaturesensor.h b/src/imports/sensors/qmlambienttemperaturesensor.h deleted file mode 100644 index 31ec72fa..00000000 --- a/src/imports/sensors/qmlambienttemperaturesensor.h +++ /dev/null @@ -1,84 +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 QMLAMBIENTTEMPERATURESENSOR_H -#define QMLAMBIENTTEMPERATURESENSOR_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QAmbientTemperatureSensor; - -class QmlAmbientTemperatureSensor : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlAmbientTemperatureSensor(QObject *parent = 0); - ~QmlAmbientTemperatureSensor(); - -private: - QSensor *sensor() const override; - QmlSensorReading *createReading() const override; - - QAmbientTemperatureSensor *m_sensor; -}; - -class QmlAmbientTemperatureReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal temperature READ temperature NOTIFY temperatureChanged) -public: - explicit QmlAmbientTemperatureReading(QAmbientTemperatureSensor *sensor); - ~QmlAmbientTemperatureReading(); - - qreal temperature() const; - -Q_SIGNALS: - void temperatureChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - - QAmbientTemperatureSensor *m_sensor; - qreal m_temperature; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlcompass.cpp b/src/imports/sensors/qmlcompass.cpp deleted file mode 100644 index 38fc388e..00000000 --- a/src/imports/sensors/qmlcompass.cpp +++ /dev/null @@ -1,148 +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 "qmlcompass.h" -#include <QtSensors/QCompass> - -/*! - \qmltype Compass - \instantiates QmlCompass - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The Compass element reports on heading using magnetic north as a reference. - - The Compass element reports on heading using magnetic north as a reference. - - This element wraps the QCompass class. Please see the documentation for - QCompass for details. - - \sa CompassReading -*/ - -QmlCompass::QmlCompass(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QCompass(this)) -{ -} - -QmlCompass::~QmlCompass() -{ -} - -QmlSensorReading *QmlCompass::createReading() const -{ - return new QmlCompassReading(m_sensor); -} - -QSensor *QmlCompass::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype CompassReading - \instantiates QmlCompassReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The CompassReading element holds the most recent Compass reading. - - The CompassReading element holds the most recent Compass reading. - - This element wraps the QCompassReading class. Please see the documentation for - QCompassReading for details. - - This element cannot be directly created. -*/ - -QmlCompassReading::QmlCompassReading(QCompass *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlCompassReading::~QmlCompassReading() -{ -} - -/*! - \qmlproperty qreal CompassReading::azimuth - This property holds the azimuth of the device. - - Please see QCompassReading::azimuth for information about this property. -*/ - -qreal QmlCompassReading::azimuth() const -{ - return m_azimuth; -} - -/*! - \qmlproperty qreal CompassReading::calibrationLevel - This property holds the calibration level of the reading. - - Please see QCompassReading::calibrationLevel for information about this property. -*/ - -qreal QmlCompassReading::calibrationLevel() const -{ - return m_calibrationLevel; -} - -QSensorReading *QmlCompassReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlCompassReading::readingUpdate() -{ - qreal azm = m_sensor->reading()->azimuth(); - if (m_azimuth != azm) { - m_azimuth = azm; - Q_EMIT azimuthChanged(); - } - qreal calLevel = m_sensor->reading()->calibrationLevel(); - if (m_calibrationLevel != calLevel) { - m_calibrationLevel = calLevel; - Q_EMIT calibrationLevelChanged(); - } -} diff --git a/src/imports/sensors/qmlcompass.h b/src/imports/sensors/qmlcompass.h deleted file mode 100644 index ef4fd22f..00000000 --- a/src/imports/sensors/qmlcompass.h +++ /dev/null @@ -1,88 +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 QMLCOMPASS_H -#define QMLCOMPASS_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QCompass; - -class QmlCompass : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlCompass(QObject *parent = 0); - ~QmlCompass(); - - -private: - QSensor *sensor() const override; - QCompass *m_sensor; - QmlSensorReading *createReading() const override; -}; - -class QmlCompassReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal azimuth READ azimuth NOTIFY azimuthChanged) - Q_PROPERTY(qreal calibrationLevel READ calibrationLevel NOTIFY calibrationLevelChanged) -public: - explicit QmlCompassReading(QCompass *sensor); - ~QmlCompassReading(); - - qreal azimuth() const; - qreal calibrationLevel() const; - -Q_SIGNALS: - void azimuthChanged(); - void calibrationLevelChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QCompass *m_sensor; - qreal m_azimuth; - qreal m_calibrationLevel; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmldir b/src/imports/sensors/qmldir deleted file mode 100644 index 8ce4a5aa..00000000 --- a/src/imports/sensors/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -module QtSensors -plugin declarative_sensors -classname QtSensorsDeclarativeModule -typeinfo plugins.qmltypes diff --git a/src/imports/sensors/qmldistancesensor.cpp b/src/imports/sensors/qmldistancesensor.cpp deleted file mode 100644 index f715ae0d..00000000 --- a/src/imports/sensors/qmldistancesensor.cpp +++ /dev/null @@ -1,131 +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 "qmldistancesensor.h" -#include <QDistanceSensor> - -/*! - \qmltype DistanceSensor - \instantiates QmlDistanceSensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.4 - \inherits Sensor - \brief The DistanceSensor element reports the distance in cm from an object to the device. - - The DistanceSensor element reports the distance in cm from an object to the device. - - This element wraps the QDistanceSensor class. Please see the documentation for - QDistanceSensor for details. - - \sa DistanceReading -*/ - -QmlDistanceSensor::QmlDistanceSensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QDistanceSensor(this)) -{ -} - -QmlDistanceSensor::~QmlDistanceSensor() -{ -} - -QmlSensorReading *QmlDistanceSensor::createReading() const -{ - return new QmlDistanceReading(m_sensor); -} - -QSensor *QmlDistanceSensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype DistanceReading - \instantiates QmlDistanceReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.4 - \inherits SensorReading - \brief The DistanceReading element holds the most recent DistanceSensor reading. - - The DistanceReading element holds the most recent DistanceSensor reading. - - This element wraps the QDistanceReading class. Please see the documentation for - QDistanceReading for details. - - This element cannot be directly created. -*/ - -QmlDistanceReading::QmlDistanceReading(QDistanceSensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) - , m_distance(0.0) -{ -} - -QmlDistanceReading::~QmlDistanceReading() -{ -} - -/*! - \qmlproperty qreal DistanceReading::distance - This property holds the distance measurement - - Please see QDistanceReading::distance for information about this property. -*/ - -qreal QmlDistanceReading::distance() const -{ - return m_distance; -} - -QSensorReading *QmlDistanceReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlDistanceReading::readingUpdate() -{ - qreal distance = m_sensor->reading()->distance(); - if (m_distance != distance) { - m_distance = distance; - Q_EMIT distanceChanged(); - } -} diff --git a/src/imports/sensors/qmldistancesensor.h b/src/imports/sensors/qmldistancesensor.h deleted file mode 100644 index e60e0e7e..00000000 --- a/src/imports/sensors/qmldistancesensor.h +++ /dev/null @@ -1,85 +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 QMLDISTANCESENSOR_H -#define QMLDISTANCESENSOR_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QDistanceSensor; - -class QmlDistanceSensor : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlDistanceSensor(QObject *parent = 0); - ~QmlDistanceSensor(); - -private: - QSensor *sensor() const override; - QmlSensorReading *createReading() const override; - - QDistanceSensor *m_sensor; -}; - -class QmlDistanceReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal distance READ distance NOTIFY distanceChanged) -public: - explicit QmlDistanceReading(QDistanceSensor *sensor); - ~QmlDistanceReading(); - - qreal distance() const; - -Q_SIGNALS: - void distanceChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - - QDistanceSensor *m_sensor; - qreal m_distance; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlgyroscope.cpp b/src/imports/sensors/qmlgyroscope.cpp deleted file mode 100644 index 3f61b8d7..00000000 --- a/src/imports/sensors/qmlgyroscope.cpp +++ /dev/null @@ -1,164 +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 "qmlgyroscope.h" -#include <QtSensors/QGyroscope> - -/*! - \qmltype Gyroscope - \instantiates QmlGyroscope - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The Gyroscope element reports on rotational acceleration - around the X, Y and Z axes. - - This element wraps the QGyroscope class. Please see the documentation for - QGyroscope for details. - - \sa GyroscopeReading -*/ - -QmlGyroscope::QmlGyroscope(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QGyroscope(this)) -{ -} - -QmlGyroscope::~QmlGyroscope() -{ -} - -QmlSensorReading *QmlGyroscope::createReading() const -{ - return new QmlGyroscopeReading(m_sensor); -} - -QSensor *QmlGyroscope::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype GyroscopeReading - \instantiates QmlGyroscopeReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The GyroscopeReading element holds the most recent Gyroscope reading. - - The GyroscopeReading element holds the most recent Gyroscope reading. - - This element wraps the QGyroscopeReading class. Please see the documentation for - QGyroscopeReading for details. - - This element cannot be directly created. -*/ - -QmlGyroscopeReading::QmlGyroscopeReading(QGyroscope *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlGyroscopeReading::~QmlGyroscopeReading() -{ -} - -/*! - \qmlproperty qreal GyroscopeReading::x - This property holds the angular velocity around the x axis. - - Please see QGyroscopeReading::x for information about this property. -*/ - -qreal QmlGyroscopeReading::x() const -{ - return m_x; -} - -/*! - \qmlproperty qreal GyroscopeReading::y - This property holds the angular velocity around the y axis. - - Please see QGyroscopeReading::y for information about this property. -*/ - -qreal QmlGyroscopeReading::y() const -{ - return m_y; -} - -/*! - \qmlproperty qreal GyroscopeReading::z - This property holds the angular velocity around the z axis. - - Please see QGyroscopeReading::z for information about this property. -*/ - -qreal QmlGyroscopeReading::z() const -{ - return m_z; -} - -QSensorReading *QmlGyroscopeReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlGyroscopeReading::readingUpdate() -{ - qreal gx = m_sensor->reading()->x(); - if (m_x != gx) { - m_x = gx; - Q_EMIT xChanged(); - } - qreal gy = m_sensor->reading()->y(); - if (m_y != gy) { - m_y = gy; - Q_EMIT yChanged(); - } - qreal gz = m_sensor->reading()->z(); - if (m_z != gz) { - m_z = gz; - Q_EMIT zChanged(); - } -} diff --git a/src/imports/sensors/qmlgyroscope.h b/src/imports/sensors/qmlgyroscope.h deleted file mode 100644 index 010e4f04..00000000 --- a/src/imports/sensors/qmlgyroscope.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 QMLGYROSCOPE_H -#define QMLGYROSCOPE_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QGyroscope; - -class QmlGyroscope : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlGyroscope(QObject *parent = 0); - ~QmlGyroscope(); - - -private: - QSensor *sensor() const override; - QGyroscope *m_sensor; - QmlSensorReading *createReading() const override; -}; - -class QmlGyroscopeReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal x READ x NOTIFY xChanged) - Q_PROPERTY(qreal y READ y NOTIFY yChanged) - Q_PROPERTY(qreal z READ z NOTIFY zChanged) -public: - explicit QmlGyroscopeReading(QGyroscope *sensor); - ~QmlGyroscopeReading(); - - qreal x() const; - qreal y() const; - qreal z() const; - -Q_SIGNALS: - void xChanged(); - void yChanged(); - void zChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QGyroscope *m_sensor; - qreal m_x; - qreal m_y; - qreal m_z; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlholstersensor.cpp b/src/imports/sensors/qmlholstersensor.cpp deleted file mode 100644 index 704e2e97..00000000 --- a/src/imports/sensors/qmlholstersensor.cpp +++ /dev/null @@ -1,131 +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 "qmlholstersensor.h" -#include <QtSensors/QHolsterSensor> - -/*! - \qmltype HolsterSensor - \instantiates QmlHolsterSensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.1 - \inherits Sensor - \brief The HolsterSensor element reports on whether a device is holstered. - - The HolsterSensor element reports on whether a device is holstered. - - This element wraps the QHolsterSensor class. Please see the documentation for - QHolsterSensor for details. - - \sa HolsterReading -*/ - -QmlHolsterSensor::QmlHolsterSensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QHolsterSensor(this)) -{ -} - -QmlHolsterSensor::~QmlHolsterSensor() -{ -} - -QmlSensorReading *QmlHolsterSensor::createReading() const -{ - return new QmlHolsterReading(m_sensor); -} - -QSensor *QmlHolsterSensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype HolsterReading - \instantiates QmlHolsterReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.1 - \inherits SensorReading - \brief The HolsterReading element holds the most recent HolsterSensor reading. - - The HolsterReading element holds the most recent HolsterSensor reading. - - This element wraps the QHolsterReading class. Please see the documentation for - QHolsterReading for details. - - This element cannot be directly created. -*/ - -QmlHolsterReading::QmlHolsterReading(QHolsterSensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) - , m_holstered(false) -{ -} - -QmlHolsterReading::~QmlHolsterReading() -{ -} - -/*! - \qmlproperty qreal HolsterReading::holstered - This property holds whether the device is holstered. - - Please see QHolsterReading::holstered for information about this property. -*/ - -bool QmlHolsterReading::holstered() const -{ - return m_holstered; -} - -QSensorReading *QmlHolsterReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlHolsterReading::readingUpdate() -{ - const bool holstered = m_sensor->reading()->holstered(); - if (m_holstered != holstered) { - m_holstered = holstered; - Q_EMIT holsteredChanged(); - } -} diff --git a/src/imports/sensors/qmlholstersensor.h b/src/imports/sensors/qmlholstersensor.h deleted file mode 100644 index 630d1d85..00000000 --- a/src/imports/sensors/qmlholstersensor.h +++ /dev/null @@ -1,84 +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 QMLHOLSTERSENSOR_H -#define QMLHOLSTERSENSOR_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QHolsterSensor; - -class QmlHolsterSensor : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlHolsterSensor(QObject *parent = 0); - ~QmlHolsterSensor(); - -private: - QSensor *sensor() const override; - QmlSensorReading *createReading() const override; - - QHolsterSensor *m_sensor; -}; - -class QmlHolsterReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(bool holstered READ holstered NOTIFY holsteredChanged) -public: - explicit QmlHolsterReading(QHolsterSensor *sensor); - ~QmlHolsterReading(); - - bool holstered() const; - -Q_SIGNALS: - void holsteredChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - - QHolsterSensor *m_sensor; - bool m_holstered; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlhumiditysensor.cpp b/src/imports/sensors/qmlhumiditysensor.cpp deleted file mode 100644 index 3b30e972..00000000 --- a/src/imports/sensors/qmlhumiditysensor.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#include "qmlhumiditysensor.h" -#include <QtSensors/QHumiditySensor> - -/*! - \qmltype HumiditySensor - \instantiates QmlHumiditySensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.9 - \inherits Sensor - \brief The HumiditySensor element reports on humidity. - - The HumiditySensor element reports on humidity. - - This element wraps the QHumiditySensor class. Please see the documentation for - QHumiditySensor for details. - - \sa HumidityReading -*/ - -QmlHumiditySensor::QmlHumiditySensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QHumiditySensor(this)) -{ -} - -QmlHumiditySensor::~QmlHumiditySensor() -{ -} - -QmlSensorReading *QmlHumiditySensor::createReading() const -{ - return new QmlHumidityReading(m_sensor); -} - -QSensor *QmlHumiditySensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype HumidityReading - \instantiates QmlHumidityReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.9 - \inherits SensorReading - \brief The HumidityReading element holds the most recent HumiditySensor reading. - - The HumidityReading element holds the most recent HumiditySensor reading. - - This element wraps the QHumidityReading class. Please see the documentation for - QHumidityReading for details. - - This element cannot be directly created. -*/ - -QmlHumidityReading::QmlHumidityReading(QHumiditySensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) - , m_relativeHumidity(0) - , m_absoluteHumidity(0) -{ -} - -QmlHumidityReading::~QmlHumidityReading() -{ -} - -/*! - \qmlproperty qreal HumidityReading::relativeHumidity - This property holds the relative humidity as a percentage. - - Please see QHumidityReading::relativeHumidity for information about this property. -*/ - -qreal QmlHumidityReading::relativeHumidity() const -{ - return m_relativeHumidity; -} - -/*! - \qmlproperty qreal HumidityReading::absoluteHumidity - This property holds the absolute humidity in grams per cubic meter (g/m3). - - Please see QHumidityReading::absoluteHumidity for information about this property. -*/ - -qreal QmlHumidityReading::absoluteHumidity() const -{ - return m_absoluteHumidity; -} - -QSensorReading *QmlHumidityReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlHumidityReading::readingUpdate() -{ - qreal humidity = m_sensor->reading()->relativeHumidity(); - if (m_relativeHumidity != humidity) { - m_relativeHumidity = humidity; - Q_EMIT relativeHumidityChanged(); - } - qreal abs = m_sensor->reading()->absoluteHumidity(); - if (m_absoluteHumidity != abs) { - m_absoluteHumidity = abs; - Q_EMIT absoluteHumidityChanged(); - } -} diff --git a/src/imports/sensors/qmlhumiditysensor.h b/src/imports/sensors/qmlhumiditysensor.h deleted file mode 100644 index a84a428e..00000000 --- a/src/imports/sensors/qmlhumiditysensor.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef QMLHUMIDITYSENSOR_H -#define QMLHUMIDITYSENSOR_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QHumiditySensor; - -class QmlHumiditySensor : public QmlSensor -{ - Q_OBJECT - -public: - explicit QmlHumiditySensor(QObject *parent = Q_NULLPTR); - ~QmlHumiditySensor(); - -private: - QSensor *sensor() const override; - QmlSensorReading *createReading() const override; - - QHumiditySensor *m_sensor; -}; - -class QmlHumidityReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal relativeHumidity READ relativeHumidity NOTIFY relativeHumidityChanged) - Q_PROPERTY(qreal absoluteHumidity READ absoluteHumidity NOTIFY absoluteHumidityChanged) -public: - explicit QmlHumidityReading(QHumiditySensor *sensor); - ~QmlHumidityReading(); - - qreal relativeHumidity() const; - qreal absoluteHumidity() const; - -Q_SIGNALS: - void relativeHumidityChanged(); - void absoluteHumidityChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - - QHumiditySensor *m_sensor; - qreal m_relativeHumidity; - qreal m_absoluteHumidity; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlirproximitysensor.cpp b/src/imports/sensors/qmlirproximitysensor.cpp deleted file mode 100644 index 9b1e72ac..00000000 --- a/src/imports/sensors/qmlirproximitysensor.cpp +++ /dev/null @@ -1,129 +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 "qmlirproximitysensor.h" -#include <QtSensors/QIRProximitySensor> - -/*! - \qmltype IRProximitySensor - \instantiates QmlIRProximitySensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The IRProximitySensor element reports on infra-red reflectance values. - - This element wraps the QIRProximitySensor class. Please see the documentation for - QIRProximitySensor for details. - - \sa IRProximityReading -*/ - -QmlIRProximitySensor::QmlIRProximitySensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QIRProximitySensor(this)) -{ -} - -QmlIRProximitySensor::~QmlIRProximitySensor() -{ -} - -QmlSensorReading *QmlIRProximitySensor::createReading() const -{ - return new QmlIRProximitySensorReading(m_sensor); -} - -QSensor *QmlIRProximitySensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype IRProximityReading - \instantiates QmlIRProximitySensorReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The IRProximityReading element holds the most recent IR proximity reading. - - The IRProximityReading element holds the most recent IR proximity reading. - - This element wraps the QIRProximityReading class. Please see the documentation for - QIRProximityReading for details. - - This element cannot be directly created. -*/ - -QmlIRProximitySensorReading::QmlIRProximitySensorReading(QIRProximitySensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlIRProximitySensorReading::~QmlIRProximitySensorReading() -{ -} - -/*! - \qmlproperty qreal IRProximityReading::reflectance - This property holds the reflectance value. - - Please see QIRProximityReading::reflectance for information about this property. -*/ - -qreal QmlIRProximitySensorReading::reflectance() const -{ - return m_reflectance; -} - -QSensorReading *QmlIRProximitySensorReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlIRProximitySensorReading::readingUpdate() -{ - qreal fl = m_sensor->reading()->reflectance(); - if (m_reflectance != fl) { - m_reflectance = fl; - Q_EMIT reflectanceChanged(); - } -} diff --git a/src/imports/sensors/qmlirproximitysensor.h b/src/imports/sensors/qmlirproximitysensor.h deleted file mode 100644 index 8ba1d489..00000000 --- a/src/imports/sensors/qmlirproximitysensor.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 QMLIRPROXIMITYSENSOR_H -#define QMLIRPROXIMITYSENSOR_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QIRProximitySensor; - -class QmlIRProximitySensor : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlIRProximitySensor(QObject *parent = 0); - ~QmlIRProximitySensor(); - -private: - QSensor *sensor() const override; - QIRProximitySensor *m_sensor; - QmlSensorReading *createReading() const override; -}; - -class QmlIRProximitySensorReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal reflectance READ reflectance NOTIFY reflectanceChanged) -public: - explicit QmlIRProximitySensorReading(QIRProximitySensor *sensor); - ~QmlIRProximitySensorReading(); - - qreal reflectance() const; - -Q_SIGNALS: - void reflectanceChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QIRProximitySensor *m_sensor; - qreal m_reflectance; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmllidsensor.cpp b/src/imports/sensors/qmllidsensor.cpp deleted file mode 100644 index e6dfa4cb..00000000 --- a/src/imports/sensors/qmllidsensor.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ -#include "qmllidsensor.h" -#include <QtSensors/QLidSensor> - -/*! - \qmltype LidSensor - \instantiates QmlLidSensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.9 - \inherits Sensor - \brief The LidSensor element reports on whether a device is closed. - - The LidSensor element reports on whether a device is closed. - - This element wraps the QLidSensor class. Please see the documentation for - QLidSensor for details. - - \sa LidReading -*/ - -QmlLidSensor::QmlLidSensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QLidSensor(this)) -{ -} - -QmlLidSensor::~QmlLidSensor() -{ -} - -QmlSensorReading *QmlLidSensor::createReading() const -{ - return new QmlLidReading(m_sensor); -} - -QSensor *QmlLidSensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype LidReading - \instantiates QmlLidReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.9 - \inherits SensorReading - \brief The LidReading element holds the most recent LidSensor reading. - - The LidReading element holds the most recent LidSensor reading. - - This element wraps the QLidReading class. Please see the documentation for - QLidReading for details. - - This element cannot be directly created. -*/ - -QmlLidReading::QmlLidReading(QLidSensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) - , m_backClosed(false) - , m_frontClosed(true) -{ -} - -QmlLidReading::~QmlLidReading() -{ -} - -/*! - \qmlproperty qreal LidReading::backLidClosed - This property holds whether the back lid is closed. - - Please see QLidReading::backLidClosed for information about this property. -*/ - -bool QmlLidReading::backLidChanged() const -{ - return m_backClosed; -} - -/*! - \qmlproperty qreal LidReading::frontLidClosed - This property holds whether the front lid is closed. - - Please see QLidReading::frontLidClosed for information about this property. -*/ - -bool QmlLidReading::frontLidClosed() const -{ - return m_frontClosed; -} - -QSensorReading *QmlLidReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlLidReading::readingUpdate() -{ - const bool backClosed = m_sensor->reading()->backLidClosed(); - if (m_backClosed != backClosed) { - m_backClosed = backClosed; - Q_EMIT backLidChanged(m_backClosed); - } - const bool frontClosed = m_sensor->reading()->frontLidClosed(); - if (m_frontClosed != frontClosed) { - m_frontClosed = frontClosed; - Q_EMIT frontLidChanged(m_frontClosed); - } -} diff --git a/src/imports/sensors/qmllidsensor.h b/src/imports/sensors/qmllidsensor.h deleted file mode 100644 index 37c2faeb..00000000 --- a/src/imports/sensors/qmllidsensor.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ -#ifndef QMLLIDSENSOR_H -#define QMLLIDSENSOR_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QLidSensor; - -class QmlLidSensor : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlLidSensor(QObject *parent = 0); - ~QmlLidSensor(); - -private: - QSensor *sensor() const override; - QmlSensorReading *createReading() const override; - - QLidSensor *m_sensor; -}; - -class QmlLidReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(bool backLidChanged READ backLidChanged NOTIFY backLidChanged) - Q_PROPERTY(bool frontLidClosed READ frontLidClosed NOTIFY frontLidChanged) -public: - explicit QmlLidReading(QLidSensor *sensor); - ~QmlLidReading(); - - bool backLidChanged() const; - bool frontLidClosed() const; - -Q_SIGNALS: - void backLidChanged(bool closed); - bool frontLidChanged(bool closed); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - - QLidSensor *m_sensor; - bool m_backClosed; - bool m_frontClosed; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmllightsensor.cpp b/src/imports/sensors/qmllightsensor.cpp deleted file mode 100644 index 2c1eb860..00000000 --- a/src/imports/sensors/qmllightsensor.cpp +++ /dev/null @@ -1,145 +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 "qmllightsensor.h" -#include <QtSensors/QLightSensor> - -/*! - \qmltype LightSensor - \instantiates QmlLightSensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The LightSensor element reports on light levels using LUX. - - The LightSensor element reports on light levels using LUX. - - This element wraps the QLightSensor class. Please see the documentation for - QLightSensor for details. - - \sa LightReading -*/ - -QmlLightSensor::QmlLightSensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QLightSensor(this)) -{ - connect(m_sensor, SIGNAL(fieldOfViewChanged(qreal)), - this, SIGNAL(fieldOfViewChanged(qreal))); -} - -QmlLightSensor::~QmlLightSensor() -{ -} - -QmlSensorReading *QmlLightSensor::createReading() const -{ - return new QmlLightSensorReading(m_sensor); -} - -QSensor *QmlLightSensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmlproperty qreal LightSensor::fieldOfView - This property holds a value indicating the field of view. - - Please see QLightSensor::fieldOfView for information about this property. -*/ - -qreal QmlLightSensor::fieldOfView() const -{ - return m_sensor->fieldOfView(); -} - -/*! - \qmltype LightReading - \instantiates QmlLightSensorReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The LightReading element holds the most recent LightSensor reading. - - The LightReading element holds the most recent LightSensor reading. - - This element wraps the QLightReading class. Please see the documentation for - QLightReading for details. - - This element cannot be directly created. -*/ - -QmlLightSensorReading::QmlLightSensorReading(QLightSensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlLightSensorReading::~QmlLightSensorReading() -{ -} - -/*! - \qmlproperty qreal LightReading::illuminance - This property holds the light level. - - Please see QLightReading::illuminance for information about this property. -*/ - -qreal QmlLightSensorReading::illuminance() const -{ - return m_illuminance; -} - -QSensorReading *QmlLightSensorReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlLightSensorReading::readingUpdate() -{ - qreal ill = m_sensor->reading()->lux(); - if (m_illuminance != ill) { - m_illuminance = ill; - Q_EMIT illuminanceChanged(); - } -} diff --git a/src/imports/sensors/qmllightsensor.h b/src/imports/sensors/qmllightsensor.h deleted file mode 100644 index c77b4bfe..00000000 --- a/src/imports/sensors/qmllightsensor.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLLightSensor_H -#define QMLLightSensor_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QLightSensor; - -class QmlLightSensor : public QmlSensor -{ - Q_OBJECT - Q_PROPERTY(qreal fieldOfView READ fieldOfView NOTIFY fieldOfViewChanged) -public: - explicit QmlLightSensor(QObject *parent = 0); - ~QmlLightSensor(); - - qreal fieldOfView() const; - -Q_SIGNALS: - void fieldOfViewChanged(qreal fieldOfView); - -private: - QSensor *sensor() const override; - QLightSensor *m_sensor; - QmlSensorReading *createReading() const override; -}; - -class QmlLightSensorReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal illuminance READ illuminance NOTIFY illuminanceChanged) -public: - explicit QmlLightSensorReading(QLightSensor *sensor); - ~QmlLightSensorReading(); - - qreal illuminance() const; - -Q_SIGNALS: - void illuminanceChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QLightSensor *m_sensor; - qreal m_illuminance; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlmagnetometer.cpp b/src/imports/sensors/qmlmagnetometer.cpp deleted file mode 100644 index dba0ec4e..00000000 --- a/src/imports/sensors/qmlmagnetometer.cpp +++ /dev/null @@ -1,203 +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 "qmlmagnetometer.h" -#include <QtSensors/QMagnetometer> - -/*! - \qmltype Magnetometer - \instantiates QmlMagnetometer - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The Magnetometer element reports on magnetic field strength - along the Z, Y and Z axes. - - The Magnetometer element reports on magnetic field strength - along the Z, Y and Z axes. - - This element wraps the QMagnetometer class. Please see the documentation for - QMagnetometer for details. - - \sa MagnetometerReading -*/ - -QmlMagnetometer::QmlMagnetometer(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QMagnetometer(this)) -{ - connect(m_sensor, SIGNAL(returnGeoValuesChanged(bool)), - this, SIGNAL(returnGeoValuesChanged(bool))); -} - -QmlMagnetometer::~QmlMagnetometer() -{ -} - -QmlSensorReading *QmlMagnetometer::createReading() const -{ - return new QmlMagnetometerReading(m_sensor); -} - -QSensor *QmlMagnetometer::sensor() const -{ - return m_sensor; -} - -/*! - \qmlproperty bool Magnetometer::returnGeoValues - This property holds a value indicating if geomagnetic values should be returned. - - Please see QMagnetometer::returnGeoValues for information about this property. -*/ - -bool QmlMagnetometer::returnGeoValues() const -{ - return m_sensor->returnGeoValues(); -} - -void QmlMagnetometer::setReturnGeoValues(bool geo) -{ - m_sensor->setReturnGeoValues(geo); -} - -/*! - \qmltype MagnetometerReading - \instantiates QmlMagnetometerReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The MagnetometerReading element holds the most recent Magnetometer reading. - - The MagnetometerReading element holds the most recent Magnetometer reading. - - This element wraps the QMagnetometerReading class. Please see the documentation for - QMagnetometerReading for details. - - This element cannot be directly created. -*/ - -QmlMagnetometerReading::QmlMagnetometerReading(QMagnetometer *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlMagnetometerReading::~QmlMagnetometerReading() -{ -} - -/*! - \qmlproperty qreal MagnetometerReading::x - This property holds the raw magnetic flux density on the X axis. - - Please see QMagnetometerReading::x for information about this property. -*/ - -qreal QmlMagnetometerReading::x() const -{ - return m_x; -} - -/*! - \qmlproperty qreal MagnetometerReading::y - This property holds the raw magnetic flux density on the Y axis. - - Please see QMagnetometerReading::y for information about this property. -*/ - -qreal QmlMagnetometerReading::y() const -{ - return m_y; -} - -/*! - \qmlproperty qreal MagnetometerReading::z - This property holds the raw magnetic flux density on the Z axis. - - Please see QMagnetometerReading::z for information about this property. -*/ - -qreal QmlMagnetometerReading::z() const -{ - return m_z; -} - -/*! - \qmlproperty qreal MagnetometerReading::calibrationLevel - This property holds the accuracy of the reading. - - Please see QMagnetometerReading::calibrationLevel for information about this property. -*/ - -qreal QmlMagnetometerReading::calibrationLevel() const -{ - return m_calibrationLevel; -} - -QSensorReading *QmlMagnetometerReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlMagnetometerReading::readingUpdate() -{ - qreal magX = m_sensor->reading()->x(); - if (m_x != magX) { - m_x = magX; - Q_EMIT xChanged(); - } - qreal magY = m_sensor->reading()->y(); - if (m_y != magY) { - m_y = magY; - Q_EMIT yChanged(); - } - qreal magZ = m_sensor->reading()->z(); - if (m_z != magZ) { - m_z = magZ; - Q_EMIT zChanged(); - } - qreal calLevel = m_sensor->reading()->calibrationLevel(); - if (m_calibrationLevel != calLevel) { - m_calibrationLevel = calLevel; - Q_EMIT calibrationLevelChanged(); - } -} diff --git a/src/imports/sensors/qmlmagnetometer.h b/src/imports/sensors/qmlmagnetometer.h deleted file mode 100644 index 3c3c2bae..00000000 --- a/src/imports/sensors/qmlmagnetometer.h +++ /dev/null @@ -1,102 +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 QMLMAGNETOMETER_H -#define QMLMAGNETOMETER_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QMagnetometer; - -class QmlMagnetometer : public QmlSensor -{ - Q_OBJECT - Q_PROPERTY(bool returnGeoValues READ returnGeoValues WRITE setReturnGeoValues NOTIFY returnGeoValuesChanged) -public: - explicit QmlMagnetometer(QObject *parent = 0); - ~QmlMagnetometer(); - - bool returnGeoValues() const; - void setReturnGeoValues(bool geo); - -Q_SIGNALS: - void returnGeoValuesChanged(bool returnGeoValues); - -private: - QSensor *sensor() const override; - QMagnetometer *m_sensor; - QmlSensorReading *createReading() const override; -}; - -class QmlMagnetometerReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal x READ x NOTIFY xChanged) - Q_PROPERTY(qreal y READ y NOTIFY yChanged) - Q_PROPERTY(qreal z READ z NOTIFY zChanged) - Q_PROPERTY(qreal calibrationLevel READ calibrationLevel NOTIFY calibrationLevelChanged) -public: - explicit QmlMagnetometerReading(QMagnetometer *sensor); - ~QmlMagnetometerReading(); - - qreal x() const; - qreal y() const; - qreal z() const; - qreal calibrationLevel() const; - -Q_SIGNALS: - void xChanged(); - void yChanged(); - void zChanged(); - void calibrationLevelChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QMagnetometer *m_sensor; - qreal m_x; - qreal m_y; - qreal m_z; - qreal m_calibrationLevel; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlorientationsensor.cpp b/src/imports/sensors/qmlorientationsensor.cpp deleted file mode 100644 index 25bda074..00000000 --- a/src/imports/sensors/qmlorientationsensor.cpp +++ /dev/null @@ -1,141 +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 "qmlorientationsensor.h" -#include <QtSensors/QOrientationSensor> - -/*! - \qmltype OrientationSensor - \instantiates QmlOrientationSensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The OrientationSensor element reports device orientation. - - The OrientationSensor element reports device orientation. - - This element wraps the QOrientationSensor class. Please see the documentation for - QOrientationSensor for details. - - \sa OrientationReading -*/ - -QmlOrientationSensor::QmlOrientationSensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QOrientationSensor(this)) -{ -} - -QmlOrientationSensor::~QmlOrientationSensor() -{ -} - -QmlSensorReading *QmlOrientationSensor::createReading() const -{ - return new QmlOrientationSensorReading(m_sensor); -} - -QSensor *QmlOrientationSensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype OrientationReading - \instantiates QmlOrientationSensorReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The OrientationReading element holds the most recent OrientationSensor reading. - - The OrientationReading element holds the most recent OrientationSensor reading. - - This element wraps the QOrientationReading class. Please see the documentation for - QOrientationReading for details. - - This element cannot be directly created. -*/ - -QmlOrientationSensorReading::QmlOrientationSensorReading(QOrientationSensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlOrientationSensorReading::~QmlOrientationSensorReading() -{ -} - -/*! - \qmlproperty Orientation OrientationReading::orientation - This property holds the orientation of the device. - - Please see QOrientationReading::orientation for information about this property. - - Note that Orientation constants are exposed through the OrientationReading class. - \code - OrientationSensor { - onReadingChanged: { - if (reading.orientation == OrientationReading.TopUp) - // do something - } - } - \endcode -*/ - -QOrientationReading::Orientation QmlOrientationSensorReading::orientation() const -{ - return m_orientation; -} - -QSensorReading *QmlOrientationSensorReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlOrientationSensorReading::readingUpdate() -{ - QOrientationReading::Orientation o = m_sensor->reading()->orientation(); - if (m_orientation != o) { - m_orientation = o; - Q_EMIT orientationChanged(); - } -} diff --git a/src/imports/sensors/qmlorientationsensor.h b/src/imports/sensors/qmlorientationsensor.h deleted file mode 100644 index bdb1b1e4..00000000 --- a/src/imports/sensors/qmlorientationsensor.h +++ /dev/null @@ -1,86 +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 QMLORIENTATIONSENSOR_H -#define QMLORIENTATIONSENSOR_H - -#include "qmlsensor.h" -#include <QtSensors/QOrientationSensor> - -QT_BEGIN_NAMESPACE - -class QOrientationSensor; - -class QmlOrientationSensor : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlOrientationSensor(QObject *parent = 0); - ~QmlOrientationSensor(); - - -private: - QSensor *sensor() const override; - QOrientationSensor *m_sensor; - QmlSensorReading *createReading() const override; -}; - -class QmlOrientationSensorReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(QOrientationReading::Orientation orientation READ orientation NOTIFY orientationChanged) -public: - - explicit QmlOrientationSensorReading(QOrientationSensor *sensor); - ~QmlOrientationSensorReading(); - - QOrientationReading::Orientation orientation() const; - -Q_SIGNALS: - void orientationChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QOrientationSensor *m_sensor; - QOrientationReading::Orientation m_orientation; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlpressuresensor.cpp b/src/imports/sensors/qmlpressuresensor.cpp deleted file mode 100644 index 4ef27ba7..00000000 --- a/src/imports/sensors/qmlpressuresensor.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 "qmlpressuresensor.h" -#include <QtSensors/QPressureSensor> - -/*! - \qmltype PressureSensor - \instantiates QmlPressureSensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.1 - \inherits Sensor - \brief The PressureSensor element reports on atmospheric pressure values. - - The PressureSensor element reports on atmospheric pressure values. - - This element wraps the QPressureSensor class. Please see the documentation for - QPressureSensor for details. - - \sa PressureReading -*/ - -QmlPressureSensor::QmlPressureSensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QPressureSensor(this)) -{ -} - -QmlPressureSensor::~QmlPressureSensor() -{ -} - -QmlSensorReading *QmlPressureSensor::createReading() const -{ - return new QmlPressureReading(m_sensor); -} - -QSensor *QmlPressureSensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype PressureReading - \instantiates QmlPressureReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.1 - \inherits SensorReading - \brief The PressureReading element holds the most recent PressureSensor reading. - - The PressureReading element holds the most recent PressureSensor reading. - - This element wraps the QPressureReading class. Please see the documentation for - QPressureReading for details. - - This element cannot be directly created. -*/ - -QmlPressureReading::QmlPressureReading(QPressureSensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) - , m_pressure(0) - , m_temperature(0) -{ -} - -QmlPressureReading::~QmlPressureReading() -{ -} - -/*! - \qmlproperty qreal PressureReading::pressure - This property holds the atmospheric pressure value in Pascals. - - Please see QPressureReading::pressure for information about this property. -*/ - -qreal QmlPressureReading::pressure() const -{ - return m_pressure; -} - -/*! - \qmlproperty qreal PressureReading::temperature - This property holds the pressure sensor's temperature value in degrees Celsius. - - Please see QPressureReading::temperature for information about this property. - \since QtSensors 5.2 -*/ - -qreal QmlPressureReading::temperature() const -{ - return m_temperature; -} - -QSensorReading *QmlPressureReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlPressureReading::readingUpdate() -{ - qreal pressure = m_sensor->reading()->pressure(); - if (m_pressure != pressure) { - m_pressure = pressure; - Q_EMIT pressureChanged(); - } - - qreal temperature = m_sensor->reading()->temperature(); - if (m_temperature != temperature) { - m_temperature = temperature; - Q_EMIT temperatureChanged(); - } -} diff --git a/src/imports/sensors/qmlpressuresensor.h b/src/imports/sensors/qmlpressuresensor.h deleted file mode 100644 index 6304d69c..00000000 --- a/src/imports/sensors/qmlpressuresensor.h +++ /dev/null @@ -1,88 +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 QMLPRESSURESENSOR_H -#define QMLPRESSURESENSOR_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QPressureSensor; - -class QmlPressureSensor : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlPressureSensor(QObject *parent = 0); - ~QmlPressureSensor(); - -private: - QSensor *sensor() const override; - QmlSensorReading *createReading() const override; - - QPressureSensor *m_sensor; -}; - -class QmlPressureReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal pressure READ pressure NOTIFY pressureChanged) - Q_PROPERTY(qreal temperature READ temperature NOTIFY temperatureChanged REVISION 1) -public: - explicit QmlPressureReading(QPressureSensor *sensor); - ~QmlPressureReading(); - - qreal pressure() const; - qreal temperature() const; - -Q_SIGNALS: - void pressureChanged(); - Q_REVISION(1) void temperatureChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - - QPressureSensor *m_sensor; - qreal m_pressure; - qreal m_temperature; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlproximitysensor.cpp b/src/imports/sensors/qmlproximitysensor.cpp deleted file mode 100644 index 84993574..00000000 --- a/src/imports/sensors/qmlproximitysensor.cpp +++ /dev/null @@ -1,131 +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 "qmlproximitysensor.h" -#include <QtSensors/QProximitySensor> - -/*! - \qmltype ProximitySensor - \instantiates QmlProximitySensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The ProximitySensor element reports on object proximity. - - The ProximitySensor element reports on object proximity. - - This element wraps the QProximitySensor class. Please see the documentation for - QProximitySensor for details. - - \sa ProximityReading -*/ - -QmlProximitySensor::QmlProximitySensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QProximitySensor(this)) -{ -} - -QmlProximitySensor::~QmlProximitySensor() -{ -} - -QmlSensorReading *QmlProximitySensor::createReading() const -{ - return new QmlProximitySensorReading(m_sensor); -} - -QSensor *QmlProximitySensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmltype ProximityReading - \instantiates QmlProximitySensorReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The ProximityReading element holds the most recent ProximitySensor reading. - - The ProximityReading element holds the most recent ProximitySensor reading. - - This element wraps the QProximityReading class. Please see the documentation for - QProximityReading for details. - - This element cannot be directly created. -*/ - -QmlProximitySensorReading::QmlProximitySensorReading(QProximitySensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlProximitySensorReading::~QmlProximitySensorReading() -{ -} - -/*! - \qmlproperty bool ProximityReading::near - This property holds a value indicating if something is near. - - Please see QProximityReading::near for information about this property. -*/ - -bool QmlProximitySensorReading::near() const -{ - return m_near; -} - -QSensorReading *QmlProximitySensorReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlProximitySensorReading::readingUpdate() -{ - bool pNear = m_sensor->reading()->close(); - if (m_near != pNear) { - m_near = pNear; - Q_EMIT nearChanged(); - } -} diff --git a/src/imports/sensors/qmlproximitysensor.h b/src/imports/sensors/qmlproximitysensor.h deleted file mode 100644 index 8bab8cfa..00000000 --- a/src/imports/sensors/qmlproximitysensor.h +++ /dev/null @@ -1,86 +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 QMLPROXIMITYSENSOR_H -#define QMLPROXIMITYSENSOR_H - -#include "qmlsensor.h" -#ifdef near -#undef near -#endif -QT_BEGIN_NAMESPACE - -class QProximitySensor; - -class QmlProximitySensor : public QmlSensor -{ - Q_OBJECT -public: - explicit QmlProximitySensor(QObject *parent = 0); - ~QmlProximitySensor(); - - -private: - QSensor *sensor() const override; - QProximitySensor *m_sensor; - QmlSensorReading *createReading() const override; -}; - -class QmlProximitySensorReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(bool near READ near NOTIFY nearChanged) -public: - explicit QmlProximitySensorReading(QProximitySensor *sensor); - ~QmlProximitySensorReading(); - - bool near() const; - -Q_SIGNALS: - void nearChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QProximitySensor *m_sensor; - bool m_near; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlrotationsensor.cpp b/src/imports/sensors/qmlrotationsensor.cpp deleted file mode 100644 index ffa47fd9..00000000 --- a/src/imports/sensors/qmlrotationsensor.cpp +++ /dev/null @@ -1,184 +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 "qmlrotationsensor.h" -#include <QtSensors/QRotationSensor> - -/*! - \qmltype RotationSensor - \instantiates QmlRotationSensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The RotationSensor element reports on device rotation - around the X, Y and Z axes. - - The RotationSensor element reports on device rotation - around the X, Y and Z axes. - - This element wraps the QRotationSensor class. Please see the documentation for - QRotationSensor for details. - - \sa RotationReading -*/ - -QmlRotationSensor::QmlRotationSensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QRotationSensor(this)) -{ - connect(m_sensor, SIGNAL(hasZChanged(bool)), this, SIGNAL(hasZChanged(bool))); -} - -QmlRotationSensor::~QmlRotationSensor() -{ -} - -QmlSensorReading *QmlRotationSensor::createReading() const -{ - return new QmlRotationSensorReading(m_sensor); -} - -QSensor *QmlRotationSensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmlproperty qreal RotationSensor::hasZ - This property holds a value indicating if the z angle is available. - - Please see QRotationSensor::hasZ for information about this property. -*/ - -bool QmlRotationSensor::hasZ() const -{ - return m_sensor->hasZ(); -} - -void QmlRotationSensor::_update() -{ -} - -/*! - \qmltype RotationReading - \instantiates QmlRotationSensorReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The RotationReading element holds the most recent RotationSensor reading. - - The RotationReading element holds the most recent RotationSensor reading. - - This element wraps the QRotationReading class. Please see the documentation for - QRotationReading for details. - - This element cannot be directly created. -*/ - -QmlRotationSensorReading::QmlRotationSensorReading(QRotationSensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlRotationSensorReading::~QmlRotationSensorReading() -{ -} - -/*! - \qmlproperty qreal RotationReading::x - This property holds the rotation around the x axis. - - Please see QRotationReading::x for information about this property. -*/ - -qreal QmlRotationSensorReading::x() const -{ - return m_x; -} - -/*! - \qmlproperty qreal RotationReading::y - This property holds the rotation around the y axis. - - Please see QRotationReading::y for information about this property. -*/ - -qreal QmlRotationSensorReading::y() const -{ - return m_y; -} - -/*! - \qmlproperty qreal RotationReading::z - This property holds the rotation around the z axis. - - Please see QRotationReading::z for information about this property. -*/ - -qreal QmlRotationSensorReading::z() const -{ - return m_z; -} - -QSensorReading *QmlRotationSensorReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlRotationSensorReading::readingUpdate() -{ - qreal rX = m_sensor->reading()->x(); - if (m_x != rX) { - m_x = rX; - Q_EMIT xChanged(); - } - qreal rY = m_sensor->reading()->y(); - if (m_y != rY) { - m_y = rY; - Q_EMIT yChanged(); - } - qreal rZ = m_sensor->reading()->z(); - if (m_z != rZ) { - m_z = rZ; - Q_EMIT zChanged(); - } -} diff --git a/src/imports/sensors/qmlrotationsensor.h b/src/imports/sensors/qmlrotationsensor.h deleted file mode 100644 index c0760ac9..00000000 --- a/src/imports/sensors/qmlrotationsensor.h +++ /dev/null @@ -1,98 +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 QMLROTATIONSENSOR_H -#define QMLROTATIONSENSOR_H - -#include "qmlsensor.h" - -QT_BEGIN_NAMESPACE - -class QRotationSensor; - -class QmlRotationSensor : public QmlSensor -{ - Q_OBJECT - Q_PROPERTY(bool hasZ READ hasZ NOTIFY hasZChanged) -public: - explicit QmlRotationSensor(QObject *parent = 0); - ~QmlRotationSensor(); - - bool hasZ() const; - -Q_SIGNALS: - void hasZChanged(bool hasZ); - -private: - QSensor *sensor() const override; - void _update() override; - QRotationSensor *m_sensor; - QmlSensorReading *createReading() const override; -}; - -class QmlRotationSensorReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal x READ x NOTIFY xChanged) - Q_PROPERTY(qreal y READ y NOTIFY yChanged) - Q_PROPERTY(qreal z READ z NOTIFY zChanged) -public: - explicit QmlRotationSensorReading(QRotationSensor *sensor); - ~QmlRotationSensorReading(); - - qreal x() const; - qreal y() const; - qreal z() const; - -Q_SIGNALS: - void xChanged(); - void yChanged(); - void zChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QRotationSensor *m_sensor; - qreal m_x; - qreal m_y; - qreal m_z; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmlsensor.cpp b/src/imports/sensors/qmlsensor.cpp deleted file mode 100644 index 0389af4a..00000000 --- a/src/imports/sensors/qmlsensor.cpp +++ /dev/null @@ -1,546 +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 "qmlsensor.h" -#include <QtSensors/QSensor> -#include <QDebug> - -QT_BEGIN_NAMESPACE - -/*! - \qmltype Sensor - \instantiates QmlSensor - \inqmlmodule QtSensors - \since QtSensors 5.0 - \brief The Sensor element serves as a base type for sensors. - - The Sensor element serves as a base type for sensors. - - This element wraps the QSensor class. Please see the documentation for - QSensor for details. - - This element cannot be directly created. Please use one of the sub-classes instead. -*/ - -QmlSensor::QmlSensor(QObject *parent) - : QObject(parent) - , m_parsed(false) - , m_active(false) - , m_reading(0) -{ -} - -QmlSensor::~QmlSensor() -{ -} - -/*! - \qmlproperty string Sensor::identifier - This property holds the backend identifier for the sensor. - - Please see QSensor::identifier for information about this property. -*/ - -QString QmlSensor::identifier() const -{ - return m_identifier; -} - -void QmlSensor::setIdentifier(const QString &identifier) -{ - if (m_parsed) return; - m_identifier = identifier; - Q_EMIT identifierChanged(); -} - -/*! - \qmlproperty string Sensor::type - This property holds the type of the sensor. -*/ - -QString QmlSensor::type() const -{ - return QString::fromLatin1(sensor()->type()); -} - -/*! - \qmlproperty bool Sensor::connectedToBackend - This property holds a value indicating if the sensor has connected to a backend. - - Please see QSensor::connectedToBackend for information about this property. -*/ - -bool QmlSensor::isConnectedToBackend() const -{ - return sensor()->isConnectedToBackend(); -} - -/*! - \qmlproperty bool Sensor::busy - This property holds a value to indicate if the sensor is busy. - - Please see QSensor::busy for information about this property. -*/ - -bool QmlSensor::isBusy() const -{ - return sensor()->isBusy(); -} - -/*! - \qmlproperty bool Sensor::active - This property holds a value to indicate if the sensor is active. - - Please see QSensor::active for information about this property. -*/ - -void QmlSensor::setActive(bool active) -{ - m_active = active; - if (!m_parsed) return; // delay (it'll get called again later)! - bool wasActive = sensor()->isActive(); - if (wasActive == active) return; - if (active) { - sensor()->start(); - m_active = sensor()->isActive(); - } else { - sensor()->stop(); - } - if (m_active != wasActive) - emit activeChanged(); -} - -bool QmlSensor::isActive() const -{ - return m_active; -} - -/*! - \qmlproperty bool Sensor::alwaysOn - This property holds a value to indicate if the sensor should remain running when the screen is off. - - Please see QSensor::alwaysOn for information about this property. -*/ - -bool QmlSensor::isAlwaysOn() const -{ - return sensor()->isAlwaysOn(); -} - -void QmlSensor::setAlwaysOn(bool alwaysOn) -{ - sensor()->setAlwaysOn(alwaysOn); -} - -/*! - \qmlproperty bool Sensor::skipDuplicates - \since QtSensors 5.1 - - This property indicates whether duplicate reading values should be omitted. - - Please see QSensor::skipDuplicates for information about this property. -*/ - -bool QmlSensor::skipDuplicates() const -{ - return sensor()->skipDuplicates(); -} - -void QmlSensor::setSkipDuplicates(bool skipDuplicates) -{ - sensor()->setSkipDuplicates(skipDuplicates); -} - -/*! - \qmlproperty list<Range> Sensor::availableDataRates - This property holds the data rates that the sensor supports. - - Please see QSensor::availableDataRates for information about this property. -*/ - -QQmlListProperty<QmlSensorRange> QmlSensor::availableDataRates() const -{ - QList<QmlSensorRange*> ret; - ret.reserve(sensor()->availableDataRates().size()); - foreach (const qrange &r, sensor()->availableDataRates()) { - QmlSensorRange *range = new QmlSensorRange; - //QQmlEngine::setObjectOwnership(range, QQmlEngine::JavaScriptOwnership); - range->setMinumum(r.first); - range->setMaximum(r.second); - ret << range; - } - return QQmlListProperty<QmlSensorRange>(const_cast<QmlSensor*>(this), ret); -} - -/*! - \qmlproperty int Sensor::dataRate - This property holds the data rate that the sensor should be run at. - - Please see QSensor::dataRate for information about this property. -*/ - -int QmlSensor::dataRate() const -{ - return sensor()->dataRate(); -} - -void QmlSensor::setDataRate(int rate) -{ - if (rate != dataRate()) { - sensor()->setDataRate(rate); - Q_EMIT dataRateChanged(); - } -} - -/*! - \qmlproperty list<OutputRange> Sensor::outputRanges - This property holds a list of output ranges the sensor supports. - - Please see QSensor::outputRanges for information about this property. -*/ - -QQmlListProperty<QmlSensorOutputRange> QmlSensor::outputRanges() const -{ - QList<QmlSensorOutputRange*> ret; - ret.reserve(sensor()->outputRanges().size()); - foreach (const qoutputrange &r, sensor()->outputRanges()) { - QmlSensorOutputRange *range = new QmlSensorOutputRange; - //QQmlEngine::setObjectOwnership(range, QQmlEngine::JavaScriptOwnership); - range->setMinimum(r.minimum); - range->setMaximum(r.maximum); - range->setAccuracy(r.accuracy); - ret << range; - } - return QQmlListProperty<QmlSensorOutputRange>(const_cast<QmlSensor*>(this), ret); -} - -/*! - \qmlproperty int Sensor::outputRange - This property holds the output range in use by the sensor. - - Please see QSensor::outputRange for information about this property. -*/ - -int QmlSensor::outputRange() const -{ - return sensor()->outputRange(); -} - -void QmlSensor::setOutputRange(int index) -{ - int oldRange = outputRange(); - if (oldRange == index) return; - sensor()->setOutputRange(index); - if (sensor()->outputRange() == index) - Q_EMIT outputRangeChanged(); -} - -/*! - \qmlproperty string Sensor::description - This property holds a descriptive string for the sensor. -*/ - -QString QmlSensor::description() const -{ - return sensor()->description(); -} - -/*! - \qmlproperty int Sensor::error - This property holds the last error code set on the sensor. -*/ - -int QmlSensor::error() const -{ - return sensor()->error(); -} - -/*! - \qmlproperty SensorReading Sensor::reading - This property holds the reading class. - - Please see QSensor::reading for information about this property. - \sa {QML Reading types} -*/ - -QmlSensorReading *QmlSensor::reading() const -{ - return m_reading; -} - -/*! - \qmlproperty Sensor::AxesOrientationMode Sensor::axesOrientationMode - \since QtSensors 5.1 - This property holds the mode that affects how the screen orientation changes reading values. - - Please see QSensor::axesOrientationMode for information about this property. -*/ - -QmlSensor::AxesOrientationMode QmlSensor::axesOrientationMode() const -{ - return static_cast<QmlSensor::AxesOrientationMode>(sensor()->axesOrientationMode()); -} - -void QmlSensor::setAxesOrientationMode(QmlSensor::AxesOrientationMode axesOrientationMode) -{ - sensor()->setAxesOrientationMode(static_cast<QSensor::AxesOrientationMode>(axesOrientationMode)); -} - -/*! - \qmlproperty int Sensor::currentOrientation - \since QtSensors 5.1 - This property holds the current orientation that is used for rotating the reading values. - - Please see QSensor::currentOrientation for information about this property. -*/ - -int QmlSensor::currentOrientation() const -{ - return sensor()->currentOrientation(); -} - -/*! - \qmlproperty int Sensor::userOrientation - \since QtSensors 5.1 - This property holds the angle used for rotating the reading values in the UserOrientation mode. - - Please see QSensor::userOrientation for information about this property. -*/ - -int QmlSensor::userOrientation() const -{ - return sensor()->userOrientation(); -} - -void QmlSensor::setUserOrientation(int userOrientation) -{ - sensor()->setUserOrientation(userOrientation); -} - -/*! - \qmlproperty int Sensor::maxBufferSize - \since QtSensors 5.1 - This property holds the maximum buffer size. - - Please see QSensor::maxBufferSize for information about this property. -*/ - -int QmlSensor::maxBufferSize() const -{ - return sensor()->maxBufferSize(); -} - -/*! - \qmlproperty int Sensor::efficientBufferSize - \since QtSensors 5.1 - The property holds the most efficient buffer size. - - Please see QSensor::efficientBufferSize for information about this property. -*/ - -int QmlSensor::efficientBufferSize() const -{ - return sensor()->efficientBufferSize(); -} - -/*! - \qmlproperty int Sensor::bufferSize - \since QtSensors 5.1 - This property holds the size of the buffer. - - Please see QSensor::bufferSize for information about this property. -*/ - -int QmlSensor::bufferSize() const -{ - return sensor()->bufferSize(); -} - -void QmlSensor::setBufferSize(int bufferSize) -{ - sensor()->setBufferSize(bufferSize); -} - -/*! - \qmlmethod bool Sensor::start() - Start retrieving values from the sensor. Returns true if the sensor - was started, false otherwise. - - Please see QSensor::start() for information. -*/ - -bool QmlSensor::start() -{ - setActive(true); - return isActive(); -} - -/*! - \qmlmethod bool Sensor::stop() - Stop retrieving values from the sensor. - Returns true if the sensor was stopped, false otherwise. - - Please see QSensor::stop() for information. -*/ - -void QmlSensor::stop() -{ - setActive(false); -} - -void QmlSensor::classBegin() -{ -} - -void QmlSensor::componentComplete() -{ - m_parsed = true; - - connect(sensor(), SIGNAL(sensorError(int)), this, SIGNAL(errorChanged())); - connect(sensor(), SIGNAL(activeChanged()), this, SIGNAL(activeChanged())); - connect(sensor(), SIGNAL(alwaysOnChanged()), this, SIGNAL(alwaysOnChanged())); - connect(sensor(), SIGNAL(skipDuplicatesChanged(bool)), this, SIGNAL(skipDuplicatesChanged(bool))); - connect(sensor(), SIGNAL(axesOrientationModeChanged(AxesOrientationMode)), - this, SIGNAL(axesOrientationModeChanged(AxesOrientationMode))); - connect(sensor(), SIGNAL(userOrientationChanged(int)), this, SIGNAL(userOrientationChanged(int))); - connect(sensor(), SIGNAL(currentOrientationChanged(int)), this, SIGNAL(currentOrientationChanged(int))); - connect(sensor(), SIGNAL(bufferSizeChanged(int)), this, SIGNAL(bufferSizeChanged(int))); - connect(sensor(), SIGNAL(maxBufferSizeChanged(int)), this, SIGNAL(maxBufferSizeChanged(int))); - connect(sensor(), SIGNAL(efficientBufferSizeChanged(int)), this, SIGNAL(efficientBufferSizeChanged(int))); - - // We need to set this on the sensor object now - sensor()->setIdentifier(m_identifier.toLocal8Bit()); - - // These can change! - QByteArray oldIdentifier = sensor()->identifier(); - int oldDataRate = dataRate(); - int oldOutputRange = outputRange(); - - bool ok = sensor()->connectToBackend(); - if (ok) { - Q_EMIT connectedToBackendChanged(); - m_reading = createReading(); - m_reading->setParent(this); - } - - if (oldIdentifier != sensor()->identifier()) { - m_identifier = QString::fromLatin1(sensor()->identifier()); - Q_EMIT identifierChanged(); - } - if (oldDataRate != dataRate()) - Q_EMIT dataRateChanged(); - if (oldOutputRange != outputRange()) - Q_EMIT outputRangeChanged(); - - // meta-data should become non-empty - if (!description().isEmpty()) - Q_EMIT descriptionChanged(); - if (sensor()->availableDataRates().count()) - Q_EMIT availableDataRatesChanged(); - if (sensor()->outputRanges().count()) - Q_EMIT outputRangesChanged(); - - _update(); - - connect(sensor(), SIGNAL(readingChanged()), this, SLOT(updateReading())); - if (m_active) { - m_active = false; - start(); - } -} - -void QmlSensor::_update() -{ -} - -void QmlSensor::updateReading() -{ - if (m_reading) { - m_reading->update(); - Q_EMIT readingChanged(); - } -} - -/*! - \qmltype SensorReading - \instantiates QmlSensorReading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \brief The SensorReading element serves as a base type for sensor readings. - - The SensorReading element serves as a base type for sensor readings. - - This element wraps the QSensorReading class. Please see the documentation for - QSensorReading for details. - - This element cannot be directly created. -*/ - -QmlSensorReading::QmlSensorReading(QSensor *) - : QObject(0) -{ -} - -QmlSensorReading::~QmlSensorReading() -{ -} - -/*! - \qmlproperty quint64 SensorReading::timestamp - A timestamp for the reading. - - Please see QSensorReading::timestamp for information about this property. -*/ - -quint64 QmlSensorReading::timestamp() const -{ - return m_timestamp; -} - -void QmlSensorReading::update() -{ - quint64 ts = reading()->timestamp(); - if (m_timestamp != ts) { - m_timestamp = ts; - Q_EMIT timestampChanged(); - } - readingUpdate(); -} - -QT_END_NAMESPACE diff --git a/src/imports/sensors/qmlsensor.h b/src/imports/sensors/qmlsensor.h deleted file mode 100644 index e46278b2..00000000 --- a/src/imports/sensors/qmlsensor.h +++ /dev/null @@ -1,203 +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 QMLSENSOR_H -#define QMLSENSOR_H - -#include <QQmlParserStatus> -#include <QQmlListProperty> -#include "qmlsensorrange.h" - -QT_BEGIN_NAMESPACE - -class QSensor; -class QSensorReading; - -class QmlSensorReading; - -class QmlSensor : public QObject, public QQmlParserStatus -{ - Q_OBJECT - Q_ENUMS(AxesOrientationMode) - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QString identifier READ identifier WRITE setIdentifier NOTIFY identifierChanged) - Q_PROPERTY(QString type READ type NOTIFY typeChanged) - Q_PROPERTY(bool connectedToBackend READ isConnectedToBackend NOTIFY connectedToBackendChanged) - Q_PROPERTY(QQmlListProperty<QmlSensorRange> availableDataRates READ availableDataRates NOTIFY availableDataRatesChanged) - Q_PROPERTY(int dataRate READ dataRate WRITE setDataRate NOTIFY dataRateChanged) - Q_PROPERTY(QmlSensorReading* reading READ reading NOTIFY readingChanged) - Q_PROPERTY(bool busy READ isBusy) - Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged) - Q_PROPERTY(QQmlListProperty<QmlSensorOutputRange> outputRanges READ outputRanges NOTIFY outputRangesChanged) - Q_PROPERTY(int outputRange READ outputRange WRITE setOutputRange NOTIFY outputRangeChanged) - Q_PROPERTY(QString description READ description NOTIFY descriptionChanged) - Q_PROPERTY(int error READ error NOTIFY errorChanged) - Q_PROPERTY(bool alwaysOn READ isAlwaysOn WRITE setAlwaysOn NOTIFY alwaysOnChanged) - Q_PROPERTY(bool skipDuplicates READ skipDuplicates WRITE setSkipDuplicates NOTIFY skipDuplicatesChanged REVISION 1) - Q_PROPERTY(AxesOrientationMode axesOrientationMode READ axesOrientationMode WRITE setAxesOrientationMode NOTIFY axesOrientationModeChanged REVISION 1) - Q_PROPERTY(int currentOrientation READ currentOrientation NOTIFY currentOrientationChanged REVISION 1) - Q_PROPERTY(int userOrientation READ userOrientation WRITE setUserOrientation NOTIFY userOrientationChanged REVISION 1) - Q_PROPERTY(int maxBufferSize READ maxBufferSize NOTIFY maxBufferSizeChanged REVISION 1) - Q_PROPERTY(int efficientBufferSize READ efficientBufferSize NOTIFY efficientBufferSizeChanged REVISION 1) - Q_PROPERTY(int bufferSize READ bufferSize WRITE setBufferSize NOTIFY bufferSizeChanged REVISION 1) - -public: - // Keep in sync with QSensor::AxesOrientationMode - enum AxesOrientationMode { - FixedOrientation, - AutomaticOrientation, - UserOrientation - }; - - explicit QmlSensor(QObject *parent = 0); - ~QmlSensor(); - - QString identifier() const; - void setIdentifier(const QString &identifier); - - QString type() const; - - bool isConnectedToBackend() const; - - bool isBusy() const; - - void setActive(bool active); - bool isActive() const; - - bool isAlwaysOn() const; - void setAlwaysOn(bool alwaysOn); - - bool skipDuplicates() const; - void setSkipDuplicates(bool skipDuplicates); - - QQmlListProperty<QmlSensorRange> availableDataRates() const; - int dataRate() const; - void setDataRate(int rate); - - QQmlListProperty<QmlSensorOutputRange> outputRanges() const; - int outputRange() const; - void setOutputRange(int index); - - QString description() const; - int error() const; - - QmlSensorReading *reading() const; - - AxesOrientationMode axesOrientationMode() const; - void setAxesOrientationMode(AxesOrientationMode axesOrientationMode); - - int currentOrientation() const; - - int userOrientation() const; - void setUserOrientation(int userOrientation); - - int maxBufferSize() const; - - int efficientBufferSize() const; - - int bufferSize() const; - void setBufferSize(int bufferSize); - -public Q_SLOTS: - bool start(); - void stop(); - -Q_SIGNALS: - void identifierChanged(); - void typeChanged(); - void connectedToBackendChanged(); - void availableDataRatesChanged(); - void dataRateChanged(); - void readingChanged(); - void activeChanged(); - void outputRangesChanged(); - void outputRangeChanged(); - void descriptionChanged(); - void errorChanged(); - void alwaysOnChanged(); - Q_REVISION(1) void skipDuplicatesChanged(bool skipDuplicates); - Q_REVISION(1) void axesOrientationModeChanged(AxesOrientationMode axesOrientationMode); - Q_REVISION(1) void currentOrientationChanged(int currentOrientation); - Q_REVISION(1) void userOrientationChanged(int userOrientation); - Q_REVISION(1) void maxBufferSizeChanged(int maxBufferSize); - Q_REVISION(1) void efficientBufferSizeChanged(int efficientBufferSize); - Q_REVISION(1) void bufferSizeChanged(int bufferSize); - -protected: - virtual QSensor *sensor() const = 0; - virtual QmlSensorReading *createReading() const = 0; - -private Q_SLOTS: - void updateReading(); - -protected Q_SLOTS: - void componentComplete() override; - -private: - void classBegin() override; - virtual void _update(); - bool m_parsed; - bool m_active; - QString m_identifier; - QmlSensorReading *m_reading; -}; - -class QmlSensorReading : public QObject -{ - Q_OBJECT - Q_PROPERTY(quint64 timestamp READ timestamp NOTIFY timestampChanged) -public: - explicit QmlSensorReading(QSensor *sensor); - ~QmlSensorReading(); - - quint64 timestamp() const; - void update(); - -Q_SIGNALS: - void timestampChanged(); - -private: - virtual QSensorReading *reading() const = 0; - virtual void readingUpdate() = 0; - quint64 m_timestamp; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/imports/sensors/qmlsensorgesture.cpp b/src/imports/sensors/qmlsensorgesture.cpp deleted file mode 100644 index 2e7f104c..00000000 --- a/src/imports/sensors/qmlsensorgesture.cpp +++ /dev/null @@ -1,262 +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 "qmlsensorgesture.h" -#include <QtSensors/qsensorgesture.h> -#include <QtSensors/qsensorgesturemanager.h> - -QT_BEGIN_NAMESPACE - -/*! - \qmltype SensorGesture - \instantiates QmlSensorGesture - \inqmlmodule QtSensors - \since QtSensors 5.0 - \brief Provides notifications when sensor-based gestures are detected. - - This type provides notification when sensor gestures are triggered. - - The following QML code creates a "shake" and "SecondCounter" SensorGesture QML type, and - displays the detected gesture in a text type. - - QtSensors.shake gesture is available with the Qt Sensors API, but the QtSensors.SecondCounter - sensor gesture is provided as example code for the \l {Qt Sensors - SensorGesture QML Type example} - - \qml - Item { - SensorGesture { - id: sensorGesture - enabled: false - gestures : ["QtSensors.shake", "QtSensors.SecondCounter"] - onDetected:{ - detectedText.text = gesture - } - } - Text { - id: detectedText - x:5 - y:160 - } - } - \endqml - - \l {Qt Sensor Gestures} contains a list of currently supported sensor gestures and their - descriptions. - - -*/ -QmlSensorGesture::QmlSensorGesture(QObject* parent) - : QObject(parent) - , isEnabled(false) - , initDone(false) - , sensorGesture(0) - , sensorGestureManager(new QSensorGestureManager(this)) -{ - connect(sensorGestureManager, SIGNAL(newSensorGestureAvailable()), SIGNAL(availableGesturesChanged())); -} - -QmlSensorGesture::~QmlSensorGesture() -{ -} - -/* - QQmlParserStatus interface implementation -*/ -void QmlSensorGesture::classBegin() -{ -} - -void QmlSensorGesture::componentComplete() -{ - /* - this is needed in the case the customer defines the type(s) and set it enabled = true - */ - initDone = true; - setEnabled(isEnabled); -} -/* - End of QQmlParserStatus interface implementation -*/ - -/*! - \qmlproperty stringlist SensorGesture::availableGestures - This property can be used to determine all available gestures on the system. -*/ -QStringList QmlSensorGesture::availableGestures() -{ - return sensorGestureManager->gestureIds(); -} - -/*! - \qmlproperty stringlist SensorGesture::gestures - Set this property to a list of the gestures that the application is interested in detecting. - This property cannot be changed while the type is enabled. - - The properties validGestures and invalidGestures will be set as appropriate immediately. - To determine all available getures on the system please use the - \l {SensorGesture::availableGestures} {availableGestures} property. - - \sa {QtSensorGestures Plugins} -*/ -QStringList QmlSensorGesture::gestures() const -{ - return gestureList; -} - -void QmlSensorGesture::setGestures(const QStringList& value) -{ - if (gestureList == value) - return; - - if (initDone && enabled()) { - qWarning() << "Cannot change gestures while running."; - return; - } - gestureList = value; - createGesture(); - Q_EMIT gesturesChanged(); -} - - -/*! - \qmlproperty stringlist SensorGesture::validGestures - This property holds the requested gestures that were found on the system. -*/ -QStringList QmlSensorGesture::validGestures() const -{ - if (sensorGesture) - return sensorGesture->validIds(); - return QStringList(); -} - -/*! - \qmlproperty stringlist SensorGesture::invalidGestures - This property holds the requested gestures that were not found on the system. -*/ -QStringList QmlSensorGesture::invalidGestures() const -{ - if (sensorGesture) - return sensorGesture->invalidIds(); - return QStringList(); -} - -/*! - \qmlproperty bool SensorGesture::enabled - This property can be used to activate or deactivate the sensor gesture. - Default value is false; - \sa {SensorGesture::detected}, {detected} -*/ -bool QmlSensorGesture::enabled() const -{ - return isEnabled; -} - -void QmlSensorGesture::setEnabled(bool value) -{ - bool hasChanged = false; - if (isEnabled != value) { - isEnabled = value; - hasChanged = true; - } - if (!initDone) - return; - - if (sensorGesture) { - if (value) { - sensorGesture->startDetection(); - } else { - sensorGesture->stopDetection(); - } - } - if (hasChanged) - Q_EMIT enabledChanged(); -} - -/*! - \qmlsignal SensorGesture::detected(string gesture) - This signal is emitted whenever a gesture is detected. - The \a gesture parameter contains the gesture that was detected. - - The corresponding handler is \c onDetected. -*/ - -/* - private function implementation -*/ -void QmlSensorGesture::deleteGesture() -{ - if (sensorGesture) { - bool emitInvalidChange = !invalidGestures().isEmpty(); - bool emitValidChange = !validGestures().isEmpty(); - - if (sensorGesture->isActive()) { - sensorGesture->stopDetection(); - } - delete sensorGesture; - sensorGesture = 0; - - if (emitInvalidChange) { - Q_EMIT invalidGesturesChanged(); - } - if (emitValidChange) { - Q_EMIT validGesturesChanged(); - } - } -} - -void QmlSensorGesture::createGesture() -{ - deleteGesture(); - sensorGesture = new QSensorGesture(gestureList, this); - if (!validGestures().isEmpty()) { - QObject::connect(sensorGesture - , SIGNAL(detected(QString)) - , this - , SIGNAL(detected(QString))); - Q_EMIT validGesturesChanged(); - } - if (!invalidGestures().isEmpty()) - Q_EMIT invalidGesturesChanged(); -} - -/* - End of private function implementation -*/ - -QT_END_NAMESPACE diff --git a/src/imports/sensors/qmlsensorgesture.h b/src/imports/sensors/qmlsensorgesture.h deleted file mode 100644 index 7cd4acaa..00000000 --- a/src/imports/sensors/qmlsensorgesture.h +++ /dev/null @@ -1,100 +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 QMLSENSORGESTURE_H -#define QMLSENSORGESTURE_H - -#include <QQmlParserStatus> -#include <QStringList> - -QT_BEGIN_NAMESPACE - -class QSensorGesture; -class QSensorGestureManager; - -class QmlSensorGesture : public QObject, public QQmlParserStatus -{ - Q_OBJECT - Q_PROPERTY(QStringList availableGestures READ availableGestures NOTIFY availableGesturesChanged) - Q_PROPERTY(QStringList gestures READ gestures WRITE setGestures NOTIFY gesturesChanged) - Q_PROPERTY(QStringList validGestures READ validGestures NOTIFY validGesturesChanged) - Q_PROPERTY(QStringList invalidGestures READ invalidGestures NOTIFY invalidGesturesChanged) - Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) - Q_INTERFACES(QQmlParserStatus) - -public: - explicit QmlSensorGesture(QObject* parent = 0); - ~QmlSensorGesture(); - void classBegin() override; - void componentComplete() override; - -Q_SIGNALS: - void detected(const QString &gesture); - void availableGesturesChanged(); - void gesturesChanged(); - void validGesturesChanged(); - void invalidGesturesChanged(); - void enabledChanged(); - -public: - QStringList availableGestures(); - QStringList gestures() const; - void setGestures(const QStringList& value); - bool enabled() const; - void setEnabled(bool value); - QStringList validGestures() const; - QStringList invalidGestures() const; - -private: - void deleteGesture(); - void createGesture(); - -private: - QStringList gestureIds; - bool isEnabled; - bool initDone; - QStringList gestureList; - - QSensorGesture* sensorGesture; - QSensorGestureManager* sensorGestureManager; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/imports/sensors/qmlsensorglobal.cpp b/src/imports/sensors/qmlsensorglobal.cpp deleted file mode 100644 index c2a67e85..00000000 --- a/src/imports/sensors/qmlsensorglobal.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 "qmlsensorglobal.h" -#include <QtSensors/QSensor> - -QT_BEGIN_NAMESPACE - -/*! - \qmltype QmlSensors - \instantiates QmlSensorGlobal - \inqmlmodule QtSensors - \since QtSensors 5.0 - \brief The QmlSensors singleton provides the module API. - - The QmlSensors singleton provides the module API. - - This element cannot be directly created. It can only be accessed via a namespace import. - - \code - import QtSensors 5.11 - import QtSensors 5.11 as Sensors - ... - Component.onCompleted: { - var types = Sensors.QmlSensors.sensorTypes(); - console.log(types.join(", ")); - } - \endcode -*/ - -QmlSensorGlobal::QmlSensorGlobal(QObject *parent) - : QObject(parent) - , m_sensor(new QSensor(QByteArray(), this)) -{ - connect(m_sensor, SIGNAL(availableSensorsChanged()), this, SIGNAL(availableSensorsChanged())); -} - -QmlSensorGlobal::~QmlSensorGlobal() -{ -} - -/*! - \qmlmethod list<string> QmlSensors::sensorTypes() - Returns a list of the sensor types that have been registered. - - Please see QSensor::sensorTypes() for information. -*/ -QStringList QmlSensorGlobal::sensorTypes() const -{ - QStringList ret; - const QList<QByteArray> sensorTypes = QSensor::sensorTypes(); - ret.reserve(sensorTypes.count()); - foreach (const QByteArray &type, sensorTypes) - ret << QString::fromLocal8Bit(type); - return ret; -} - -/*! - \qmlmethod list<string> QmlSensors::sensorsForType(type) - Returns a list of the sensor identifiers that have been registered for \a type. - - Please see QSensor::sensorsForType() for information. -*/ -QStringList QmlSensorGlobal::sensorsForType(const QString &type) const -{ - QStringList ret; - const QList<QByteArray> sensors = QSensor::sensorsForType(type.toLocal8Bit()); - ret.reserve(sensors.count()); - foreach (const QByteArray &identifier, sensors) - ret << QString::fromLocal8Bit(identifier); - return ret; -} - -/*! - \qmlmethod string QmlSensors::defaultSensorForType(type) - Returns the default sensor identifier that has been registered for \a type. - - Please see QSensor::defaultSensorForType() for information. -*/ -QString QmlSensorGlobal::defaultSensorForType(const QString &type) const -{ - return QString::fromLocal8Bit(QSensor::defaultSensorForType(type.toLocal8Bit())); -} - -QT_END_NAMESPACE diff --git a/src/imports/sensors/qmlsensorglobal.h b/src/imports/sensors/qmlsensorglobal.h deleted file mode 100644 index b6524cd2..00000000 --- a/src/imports/sensors/qmlsensorglobal.h +++ /dev/null @@ -1,70 +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 QMLSENSORGLOBAL_H -#define QMLSENSORGLOBAL_H - -#include <QObject> -#include <QStringList> - -QT_BEGIN_NAMESPACE - -class QSensor; - -class QmlSensorGlobal : public QObject -{ - Q_OBJECT -public: - explicit QmlSensorGlobal(QObject *parent = 0); - ~QmlSensorGlobal(); - - Q_INVOKABLE QStringList sensorTypes() const; - Q_INVOKABLE QStringList sensorsForType(const QString &type) const; - Q_INVOKABLE QString defaultSensorForType(const QString &type) const; - -Q_SIGNALS: - void availableSensorsChanged(); - -private: - QSensor *m_sensor; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/imports/sensors/qmlsensorrange.cpp b/src/imports/sensors/qmlsensorrange.cpp deleted file mode 100644 index 128f4a65..00000000 --- a/src/imports/sensors/qmlsensorrange.cpp +++ /dev/null @@ -1,88 +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 "qmlsensorrange.h" - -QmlSensorRange::QmlSensorRange(QObject *parent) - : QObject(parent), - min(0), - max(0) -{ -} - -QmlSensorRange::~QmlSensorRange() -{ -} - -int QmlSensorRange::minimum() const -{ - return min; -} - -int QmlSensorRange::maximum() const -{ - return max; -} - -QmlSensorOutputRange::QmlSensorOutputRange(QObject *parent) - : QObject(parent), - min(0), - max(0), - acc(0) -{ -} - -QmlSensorOutputRange::~QmlSensorOutputRange() -{ -} - -qreal QmlSensorOutputRange::minimum() const -{ - return min; -} - -qreal QmlSensorOutputRange::maximum() const -{ - return max; -} - -qreal QmlSensorOutputRange::accuracy() const -{ - return acc; -} diff --git a/src/imports/sensors/qmlsensorrange.h b/src/imports/sensors/qmlsensorrange.h deleted file mode 100644 index 4c638f6f..00000000 --- a/src/imports/sensors/qmlsensorrange.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 QMLSENSORRANGE_H -#define QMLSENSORRANGE_H - -#include <QObject> - -QT_BEGIN_NAMESPACE - -class QmlSensorRange : public QObject -{ - Q_OBJECT - Q_PROPERTY(int minimum READ minimum) - Q_PROPERTY(int maximum READ maximum) -public: - explicit QmlSensorRange(QObject *parent = 0); - ~QmlSensorRange(); - - int minimum() const; - void setMinumum(int mini) { min = mini; } - - int maximum() const; - void setMaximum(int maxi) { max = maxi; } - -private: - - int min; - int max; -}; - -class QmlSensorOutputRange : public QObject -{ - Q_OBJECT - Q_PROPERTY(qreal minimum READ minimum) - Q_PROPERTY(qreal maximum READ maximum) - Q_PROPERTY(qreal accuracy READ accuracy) -public: - explicit QmlSensorOutputRange(QObject *parent = 0); - ~QmlSensorOutputRange(); - - qreal minimum() const; - void setMinimum(int mini) { min = mini; } - - qreal maximum() const; - void setMaximum(int maxi) { max = maxi; } - - qreal accuracy() const; - void setAccuracy(int accu) { acc = accu; } - -private: - qreal min; - qreal max; - qreal acc; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmltapsensor.cpp b/src/imports/sensors/qmltapsensor.cpp deleted file mode 100644 index 76f34c2e..00000000 --- a/src/imports/sensors/qmltapsensor.cpp +++ /dev/null @@ -1,179 +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 "qmltapsensor.h" -#include <QtSensors/QTapSensor> - -/*! - \qmltype TapSensor - \instantiates QmlTapSensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The TapSensor element reports tap and double tap events - along the X, Y and Z axes. - - The TapSensor element reports tap and double tap events - along the X, Y and Z axes. - - This element wraps the QTapSensor class. Please see the documentation for - QTapSensor for details. - - \sa TapReading -*/ - -QmlTapSensor::QmlTapSensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QTapSensor(this)) -{ - connect(m_sensor, SIGNAL(returnDoubleTapEventsChanged(bool)), - this, SIGNAL(returnDoubleTapEventsChanged(bool))); -} - -QmlTapSensor::~QmlTapSensor() -{ -} - -QmlSensorReading *QmlTapSensor::createReading() const -{ - return new QmlTapSensorReading(m_sensor); -} - -QSensor *QmlTapSensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmlproperty bool TapSensor::returnDoubleTapEvents - This property holds a value indicating if double tap events should be reported. - - Please see QTapSensor::returnDoubleTapEvents for information about this property. -*/ - -bool QmlTapSensor::returnDoubleTapEvents() const -{ - return m_sensor->returnDoubleTapEvents(); -} - -void QmlTapSensor::setReturnDoubleTapEvents(bool ret) -{ - m_sensor->setReturnDoubleTapEvents(ret); -} - -/*! - \qmltype TapReading - \instantiates QmlTapSensorReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The TapReading element holds the most recent TapSensor reading. - - The TapReading element holds the most recent TapSensor reading. - - This element wraps the QTapReading class. Please see the documentation for - QTapReading for details. - - This element cannot be directly created. -*/ - -QmlTapSensorReading::QmlTapSensorReading(QTapSensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlTapSensorReading::~QmlTapSensorReading() -{ -} - -/*! - \qmlproperty TapDirection TapReading::tapDirection - This property holds the direction of the tap. - - Please see QTapReading::tapDirection for information about this property. - - Note that TapDirection constants are exposed through the TapReading class. - \code - TapSensor { - onReadingChanged: { - if ((reading.tapDirection & TapReading.X_Both)) - // do something - } - } - \endcode -*/ - -QTapReading::TapDirection QmlTapSensorReading::tapDirection() const -{ - return m_tapDirection; -} - -/*! - \qmlproperty bool TapReading::doubleTap - This property holds a value indicating if there was a single or double tap. - - Please see QTapReading::doubleTap for information about this property. -*/ - -bool QmlTapSensorReading::isDoubleTap() const -{ - return m_isDoubleTap; -} - -QSensorReading *QmlTapSensorReading::reading() const -{ - return const_cast<QTapSensor*>(m_sensor)->reading(); -} - -void QmlTapSensorReading::readingUpdate() -{ - QTapReading::TapDirection td = m_sensor->reading()->tapDirection(); - if (m_tapDirection != td) { - m_tapDirection = td; - Q_EMIT tapDirectionChanged(); - } - bool dTap = m_sensor->reading()->isDoubleTap(); - if (m_isDoubleTap != dTap) { - m_isDoubleTap = dTap; - Q_EMIT isDoubleTapChanged(); - } -} diff --git a/src/imports/sensors/qmltapsensor.h b/src/imports/sensors/qmltapsensor.h deleted file mode 100644 index 260cb2c2..00000000 --- a/src/imports/sensors/qmltapsensor.h +++ /dev/null @@ -1,96 +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 QMLTAPSENSOR_H -#define QMLTAPSENSOR_H - -#include "qmlsensor.h" -#include <QtSensors/QTapSensor> - -QT_BEGIN_NAMESPACE - -class QTapSensor; - -class QmlTapSensor : public QmlSensor -{ - Q_OBJECT - Q_PROPERTY(bool returnDoubleTapEvents READ returnDoubleTapEvents WRITE setReturnDoubleTapEvents NOTIFY returnDoubleTapEventsChanged) -public: - explicit QmlTapSensor(QObject *parent = 0); - ~QmlTapSensor(); - - bool returnDoubleTapEvents() const; - void setReturnDoubleTapEvents(bool ret); - -Q_SIGNALS: - void returnDoubleTapEventsChanged(bool returnDoubleTapEvents); - -private: - QSensor *sensor() const override; - QTapSensor *m_sensor; - QmlSensorReading *createReading() const override; -}; - -class QmlTapSensorReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(QTapReading::TapDirection tapDirection READ tapDirection NOTIFY tapDirectionChanged) - Q_PROPERTY(bool doubleTap READ isDoubleTap NOTIFY isDoubleTapChanged) -public: - - explicit QmlTapSensorReading(QTapSensor *sensor); - ~QmlTapSensorReading(); - - QTapReading::TapDirection tapDirection() const; - bool isDoubleTap() const; - -Q_SIGNALS: - void tapDirectionChanged(); - void isDoubleTapChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QTapSensor *m_sensor; - QTapReading::TapDirection m_tapDirection; - bool m_isDoubleTap; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/qmltiltsensor.cpp b/src/imports/sensors/qmltiltsensor.cpp deleted file mode 100644 index 6129a5c9..00000000 --- a/src/imports/sensors/qmltiltsensor.cpp +++ /dev/null @@ -1,163 +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 "qmltiltsensor.h" -#include <QtSensors/qtiltsensor.h> - -QT_BEGIN_NAMESPACE -QT_END_NAMESPACE - -/*! - \qmltype TiltSensor - \instantiates QmlTiltSensor - \ingroup qml-sensors_type - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits Sensor - \brief The TiltSensor element reports tilt events - along the X and Y axes. - - The TiltSensor element reports tilt events along the X and Y axes. - - This element wraps the QTiltSensor class. Please see the documentation for - QTiltSensor for details. - - \sa TiltReading -*/ - -QmlTiltSensor::QmlTiltSensor(QObject *parent) - : QmlSensor(parent) - , m_sensor(new QTiltSensor(this)) -{ -} - -QmlTiltSensor::~QmlTiltSensor() -{ -} - -QmlSensorReading *QmlTiltSensor::createReading() const -{ - return new QmlTiltSensorReading(m_sensor); -} - -QSensor *QmlTiltSensor::sensor() const -{ - return m_sensor; -} - -/*! - \qmlmethod TiltSensor::calibrate() - Calibrate the tilt sensor. - - Please see QTiltSensor::calibrate() for information about this property. -*/ -void QmlTiltSensor::calibrate() -{ - m_sensor->calibrate(); -} - -/*! - \qmltype TiltReading - \instantiates QmlTiltSensorReading - \ingroup qml-sensors_reading - \inqmlmodule QtSensors - \since QtSensors 5.0 - \inherits SensorReading - \brief The TiltReading element holds the most recent TiltSensor reading. - - The TiltReading element holds the most recent TiltSensor reading. - - This element wraps the QTiltReading class. Please see the documentation for - QTiltReading for details. - - This element cannot be directly created. -*/ - -QmlTiltSensorReading::QmlTiltSensorReading(QTiltSensor *sensor) - : QmlSensorReading(sensor) - , m_sensor(sensor) -{ -} - -QmlTiltSensorReading::~QmlTiltSensorReading() -{ -} - -/*! - \qmlproperty qreal TiltReading::yRotation - This property holds the amount of tilt on the Y axis. - - Please see QTiltReading::yRotation for information about this property. -*/ - -qreal QmlTiltSensorReading::yRotation() const -{ - return m_yRotation; -} - -/*! - \qmlproperty qreal TiltReading::xRotation - This property holds the amount of tilt on the X axis. - - Please see QTiltReading::xRotation for information about this property. -*/ - -qreal QmlTiltSensorReading::xRotation() const -{ - return m_xRotation; -} - -QSensorReading *QmlTiltSensorReading::reading() const -{ - return m_sensor->reading(); -} - -void QmlTiltSensorReading::readingUpdate() -{ - qreal tiltY = m_sensor->reading()->yRotation(); - if (m_yRotation != tiltY) { - m_yRotation = tiltY; - Q_EMIT yRotationChanged(); - } - qreal tiltX = m_sensor->reading()->xRotation(); - if (m_xRotation != tiltX) { - m_xRotation = tiltX; - Q_EMIT xRotationChanged(); - } -} diff --git a/src/imports/sensors/qmltiltsensor.h b/src/imports/sensors/qmltiltsensor.h deleted file mode 100644 index c922cb8c..00000000 --- a/src/imports/sensors/qmltiltsensor.h +++ /dev/null @@ -1,90 +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 QMLTILTSENSOR_H -#define QMLTILTSENSOR_H - -#include "qmlsensor.h" -#include <QtSensors/QTiltSensor> - -QT_BEGIN_NAMESPACE - -class QTiltSensor; - -class QmlTiltSensor : public QmlSensor -{ - Q_OBJECT -public: - - explicit QmlTiltSensor(QObject *parent = 0); - ~QmlTiltSensor(); - Q_INVOKABLE void calibrate(); - -private: - QSensor *sensor() const override; - QTiltSensor *m_sensor; - QmlSensorReading *createReading() const override; -}; - -class QmlTiltSensorReading : public QmlSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal yRotation READ yRotation NOTIFY yRotationChanged) - Q_PROPERTY(qreal xRotation READ xRotation NOTIFY xRotationChanged) -public: - explicit QmlTiltSensorReading(QTiltSensor *sensor); - ~QmlTiltSensorReading(); - - qreal yRotation() const; - qreal xRotation() const; - -Q_SIGNALS: - void yRotationChanged(); - void xRotationChanged(); - -private: - QSensorReading *reading() const override; - void readingUpdate() override; - QTiltSensor *m_sensor; - qreal m_yRotation; - qreal m_xRotation; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/imports/sensors/sensors.cpp b/src/imports/sensors/sensors.cpp deleted file mode 100644 index ce80a45c..00000000 --- a/src/imports/sensors/sensors.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 <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> -#include <QtSensors/QSensorManager> - -#include <QtSensors/qaccelerometer.h> -#include <QtSensors/qaltimeter.h> -#include <QtSensors/qambientlightsensor.h> -#include <QtSensors/qambienttemperaturesensor.h> -#include <QtSensors/qcompass.h> -#include <QtSensors/qdistancesensor.h> -#include <QtSensors/qhumiditysensor.h> -#include <QtSensors/qmagnetometer.h> -#include <QtSensors/qorientationsensor.h> -#include <QtSensors/qproximitysensor.h> -#include <QtSensors/qrotationsensor.h> -#include <QtSensors/qtapsensor.h> -#include <QtSensors/qlightsensor.h> -#include <QtSensors/qgyroscope.h> -#include <QtSensors/qirproximitysensor.h> -#include <QtSensors/qtiltsensor.h> -#include <QtSensors/qlidsensor.h> - -#include "qmlsensorglobal.h" -#include "qmlsensor.h" -#include "qmlaccelerometer.h" -#include "qmlaltimeter.h" -#include "qmlambientlightsensor.h" -#include "qmlambienttemperaturesensor.h" -#include "qmlcompass.h" -#include "qmldistancesensor.h" -#include "qmlgyroscope.h" -#include "qmlholstersensor.h" -#include "qmlhumiditysensor.h" -#include "qmlirproximitysensor.h" -#include "qmllightsensor.h" -#include "qmlmagnetometer.h" -#include "qmlorientationsensor.h" -#include "qmlpressuresensor.h" -#include "qmlproximitysensor.h" -#include "qmlrotationsensor.h" -#include "qmltapsensor.h" -#include "qmltiltsensor.h" -#include "qmlsensorgesture.h" -#include "qmllidsensor.h" - -QT_BEGIN_NAMESPACE - -static QObject *global_object_50(QQmlEngine *, QJSEngine *) -{ - return new QmlSensorGlobal; -} - -class QtSensorsDeclarativeModule : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid FILE "plugin.json") -public: - QtSensorsDeclarativeModule(QObject *parent = 0) : QQmlExtensionPlugin(parent) { } - void registerTypes(const char *uri) override - { - char const * const package = "QtSensors"; - if (QLatin1String(uri) != QLatin1String(package)) return; - int major; - int minor; - - // Register the 5.0 interfaces - major = 5; - minor = 0; - qmlRegisterSingletonType <QmlSensorGlobal >(package, major, minor, "QmlSensors", global_object_50); - qmlRegisterUncreatableType<QmlSensorRange >(package, major, minor, "Range", QLatin1String("Cannot create Range")); - qmlRegisterUncreatableType<QmlSensorOutputRange >(package, major, minor, "OutputRange", QLatin1String("Cannot create OutputRange")); - qmlRegisterUncreatableType<QmlSensor >(package, major, minor, "Sensor", QLatin1String("Cannot create Sensor")); - qmlRegisterUncreatableType<QmlSensorReading >(package, major, minor, "SensorReading", QLatin1String("Cannot create SensorReading")); - qmlRegisterType <QmlAccelerometer >(package, major, minor, "Accelerometer"); - qmlRegisterUncreatableType<QmlAccelerometerReading >(package, major, minor, "AccelerometerReading", QLatin1String("Cannot create AccelerometerReading")); - qmlRegisterType <QmlAmbientLightSensor >(package, major, minor, "AmbientLightSensor"); - qmlRegisterUncreatableType<QmlAmbientLightSensorReading>(package, major, minor, "AmbientLightReading", QLatin1String("Cannot create AmbientLightReading")); - qmlRegisterType <QmlCompass >(package, major, minor, "Compass"); - qmlRegisterUncreatableType<QmlCompassReading >(package, major, minor, "CompassReading", QLatin1String("Cannot create CompassReading")); - qmlRegisterType <QmlGyroscope >(package, major, minor, "Gyroscope"); - qmlRegisterUncreatableType<QmlGyroscopeReading >(package, major, minor, "GyroscopeReading", QLatin1String("Cannot create GyroscopeReading")); - qmlRegisterType <QmlIRProximitySensor >(package, major, minor, "IRProximitySensor"); - qmlRegisterUncreatableType<QmlIRProximitySensorReading >(package, major, minor, "IRProximityReading", QLatin1String("Cannot create IRProximityReading")); - qmlRegisterType <QmlLightSensor >(package, major, minor, "LightSensor"); - qmlRegisterUncreatableType<QmlLightSensorReading >(package, major, minor, "LightReading", QLatin1String("Cannot create LightReading")); - qmlRegisterType <QmlMagnetometer >(package, major, minor, "Magnetometer"); - qmlRegisterUncreatableType<QmlMagnetometerReading >(package, major, minor, "MagnetometerReading", QLatin1String("Cannot create MagnetometerReading")); - qmlRegisterType <QmlOrientationSensor >(package, major, minor, "OrientationSensor"); - qmlRegisterUncreatableType<QmlOrientationSensorReading >(package, major, minor, "OrientationReading", QLatin1String("Cannot create OrientationReading")); - qmlRegisterType <QmlProximitySensor >(package, major, minor, "ProximitySensor"); - qmlRegisterUncreatableType<QmlProximitySensorReading >(package, major, minor, "ProximityReading", QLatin1String("Cannot create ProximityReading")); - qmlRegisterType <QmlRotationSensor >(package, major, minor, "RotationSensor"); - qmlRegisterUncreatableType<QmlRotationSensorReading >(package, major, minor, "RotationReading", QLatin1String("Cannot create RotationReading")); - qmlRegisterType <QmlTapSensor >(package, major, minor, "TapSensor"); - qmlRegisterUncreatableType<QmlTapSensorReading >(package, major, minor, "TapReading", QLatin1String("Cannot create TapReading")); - qmlRegisterType <QmlTiltSensor >(package, major, minor, "TiltSensor"); - qmlRegisterUncreatableType<QmlTiltSensorReading >(package, major, minor, "TiltReading", QLatin1String("Cannot create TiltReading")); - - qmlRegisterType <QmlSensorGesture >(package, major, minor, "SensorGesture"); - - // Register the 5.1 interfaces - minor = 1; - qmlRegisterSingletonType <QmlSensorGlobal >(package, major, minor, "QmlSensors", global_object_50); - qmlRegisterUncreatableType<QmlSensorRange >(package, major, minor, "Range", QLatin1String("Cannot create Range")); - qmlRegisterUncreatableType<QmlSensorOutputRange >(package, major, minor, "OutputRange", QLatin1String("Cannot create OutputRange")); - qmlRegisterUncreatableType<QmlSensor,1 >(package, major, minor, "Sensor", QLatin1String("Cannot create Sensor")); - qmlRegisterUncreatableType<QmlSensorReading >(package, major, minor, "SensorReading", QLatin1String("Cannot create SensorReading")); - qmlRegisterType <QmlAccelerometer,1 >(package, major, minor, "Accelerometer"); - qmlRegisterUncreatableType<QmlAccelerometerReading >(package, major, minor, "AccelerometerReading", QLatin1String("Cannot create AccelerometerReading")); - qmlRegisterType <QmlAltimeter >(package, major, minor, "Altimeter"); - qmlRegisterUncreatableType<QmlAltimeterReading >(package, major, minor, "AltimeterReading", QLatin1String("Cannot create AltimeterReading")); - qmlRegisterType <QmlAmbientLightSensor >(package, major, minor, "AmbientLightSensor"); - qmlRegisterUncreatableType<QmlAmbientLightSensorReading>(package, major, minor, "AmbientLightReading", QLatin1String("Cannot create AmbientLightReading")); - qmlRegisterType <QmlAmbientTemperatureSensor >(package, major, minor, "AmbientTemperatureSensor"); - qmlRegisterUncreatableType<QmlAmbientTemperatureReading>(package, major, minor, "AmbientTemperatureReading", QLatin1String("Cannot create AmbientTemperatureReading")); - qmlRegisterType <QmlCompass >(package, major, minor, "Compass"); - qmlRegisterUncreatableType<QmlCompassReading >(package, major, minor, "CompassReading", QLatin1String("Cannot create CompassReading")); - qmlRegisterType <QmlGyroscope >(package, major, minor, "Gyroscope"); - qmlRegisterUncreatableType<QmlGyroscopeReading >(package, major, minor, "GyroscopeReading", QLatin1String("Cannot create GyroscopeReading")); - qmlRegisterType <QmlHolsterSensor >(package, major, minor, "HolsterSensor"); - qmlRegisterUncreatableType<QmlHolsterReading >(package, major, minor, "HolsterReading", QLatin1String("Cannot create HolsterReading")); - qmlRegisterType <QmlIRProximitySensor >(package, major, minor, "IRProximitySensor"); - qmlRegisterUncreatableType<QmlIRProximitySensorReading >(package, major, minor, "IRProximityReading", QLatin1String("Cannot create IRProximityReading")); - qmlRegisterType <QmlLightSensor >(package, major, minor, "LightSensor"); - qmlRegisterUncreatableType<QmlLightSensorReading >(package, major, minor, "LightReading", QLatin1String("Cannot create LightReading")); - qmlRegisterType <QmlMagnetometer >(package, major, minor, "Magnetometer"); - qmlRegisterUncreatableType<QmlMagnetometerReading >(package, major, minor, "MagnetometerReading", QLatin1String("Cannot create MagnetometerReading")); - qmlRegisterType <QmlOrientationSensor >(package, major, minor, "OrientationSensor"); - qmlRegisterUncreatableType<QmlOrientationSensorReading >(package, major, minor, "OrientationReading", QLatin1String("Cannot create OrientationReading")); - qmlRegisterType <QmlPressureSensor >(package, major, minor, "PressureSensor"); - qmlRegisterUncreatableType<QmlPressureReading >(package, major, minor, "PressureReading", QLatin1String("Cannot create PressureReading")); - qmlRegisterType <QmlProximitySensor >(package, major, minor, "ProximitySensor"); - qmlRegisterUncreatableType<QmlProximitySensorReading >(package, major, minor, "ProximityReading", QLatin1String("Cannot create ProximityReading")); - qmlRegisterType <QmlRotationSensor >(package, major, minor, "RotationSensor"); - qmlRegisterUncreatableType<QmlRotationSensorReading >(package, major, minor, "RotationReading", QLatin1String("Cannot create RotationReading")); - qmlRegisterType <QmlTapSensor >(package, major, minor, "TapSensor"); - qmlRegisterUncreatableType<QmlTapSensorReading >(package, major, minor, "TapReading", QLatin1String("Cannot create TapReading")); - qmlRegisterType <QmlTiltSensor >(package, major, minor, "TiltSensor"); - qmlRegisterUncreatableType<QmlTiltSensorReading >(package, major, minor, "TiltReading", QLatin1String("Cannot create TiltReading")); - - qmlRegisterType <QmlSensorGesture >(package, major, minor, "SensorGesture"); - - // Register the 5.2 interfaces - minor = 2; - qmlRegisterSingletonType <QmlSensorGlobal >(package, major, minor, "QmlSensors", global_object_50); - qmlRegisterUncreatableType<QmlSensorRange >(package, major, minor, "Range", QLatin1String("Cannot create Range")); - qmlRegisterUncreatableType<QmlSensorOutputRange >(package, major, minor, "OutputRange", QLatin1String("Cannot create OutputRange")); - qmlRegisterUncreatableType<QmlSensor,1 >(package, major, minor, "Sensor", QLatin1String("Cannot create Sensor")); - qmlRegisterUncreatableType<QmlSensorReading >(package, major, minor, "SensorReading", QLatin1String("Cannot create SensorReading")); - qmlRegisterType <QmlAccelerometer,1 >(package, major, minor, "Accelerometer"); - qmlRegisterUncreatableType<QmlAccelerometerReading >(package, major, minor, "AccelerometerReading", QLatin1String("Cannot create AccelerometerReading")); - qmlRegisterType <QmlAltimeter >(package, major, minor, "Altimeter"); - qmlRegisterUncreatableType<QmlAltimeterReading >(package, major, minor, "AltimeterReading", QLatin1String("Cannot create AltimeterReading")); - qmlRegisterType <QmlAmbientLightSensor >(package, major, minor, "AmbientLightSensor"); - qmlRegisterUncreatableType<QmlAmbientLightSensorReading>(package, major, minor, "AmbientLightReading", QLatin1String("Cannot create AmbientLightReading")); - qmlRegisterType <QmlAmbientTemperatureSensor >(package, major, minor, "AmbientTemperatureSensor"); - qmlRegisterUncreatableType<QmlAmbientTemperatureReading>(package, major, minor, "AmbientTemperatureReading", QLatin1String("Cannot create AmbientTemperatureReading")); - qmlRegisterType <QmlCompass >(package, major, minor, "Compass"); - qmlRegisterUncreatableType<QmlCompassReading >(package, major, minor, "CompassReading", QLatin1String("Cannot create CompassReading")); - qmlRegisterType <QmlGyroscope >(package, major, minor, "Gyroscope"); - qmlRegisterUncreatableType<QmlGyroscopeReading >(package, major, minor, "GyroscopeReading", QLatin1String("Cannot create GyroscopeReading")); - qmlRegisterType <QmlHolsterSensor >(package, major, minor, "HolsterSensor"); - qmlRegisterUncreatableType<QmlHolsterReading >(package, major, minor, "HolsterReading", QLatin1String("Cannot create HolsterReading")); - qmlRegisterType <QmlIRProximitySensor >(package, major, minor, "IRProximitySensor"); - qmlRegisterUncreatableType<QmlIRProximitySensorReading >(package, major, minor, "IRProximityReading", QLatin1String("Cannot create IRProximityReading")); - qmlRegisterType <QmlLightSensor >(package, major, minor, "LightSensor"); - qmlRegisterUncreatableType<QmlLightSensorReading >(package, major, minor, "LightReading", QLatin1String("Cannot create LightReading")); - qmlRegisterType <QmlMagnetometer >(package, major, minor, "Magnetometer"); - qmlRegisterUncreatableType<QmlMagnetometerReading >(package, major, minor, "MagnetometerReading", QLatin1String("Cannot create MagnetometerReading")); - qmlRegisterType <QmlOrientationSensor >(package, major, minor, "OrientationSensor"); - qmlRegisterUncreatableType<QmlOrientationSensorReading >(package, major, minor, "OrientationReading", QLatin1String("Cannot create OrientationReading")); - qmlRegisterType <QmlPressureSensor >(package, major, minor, "PressureSensor"); - qmlRegisterUncreatableType<QmlPressureReading,1 >(package, major, minor, "PressureReading", QLatin1String("Cannot create PressureReading")); - qmlRegisterType <QmlProximitySensor >(package, major, minor, "ProximitySensor"); - qmlRegisterUncreatableType<QmlProximitySensorReading >(package, major, minor, "ProximityReading", QLatin1String("Cannot create ProximityReading")); - qmlRegisterType <QmlRotationSensor >(package, major, minor, "RotationSensor"); - qmlRegisterUncreatableType<QmlRotationSensorReading >(package, major, minor, "RotationReading", QLatin1String("Cannot create RotationReading")); - qmlRegisterType <QmlTapSensor >(package, major, minor, "TapSensor"); - qmlRegisterUncreatableType<QmlTapSensorReading >(package, major, minor, "TapReading", QLatin1String("Cannot create TapReading")); - qmlRegisterType <QmlTiltSensor >(package, major, minor, "TiltSensor"); - qmlRegisterUncreatableType<QmlTiltSensorReading >(package, major, minor, "TiltReading", QLatin1String("Cannot create TiltReading")); - - qmlRegisterType <QmlSensorGesture >(package, major, minor, "SensorGesture"); - - // Register the 5.4 interfaces - minor = 4; - qmlRegisterType <QmlDistanceSensor >(package, major, minor, "DistanceSensor"); - qmlRegisterUncreatableType<QmlDistanceReading >(package, major, minor, "DistanceReading", QLatin1String("Cannot create DistanceReading")); - - // Register the new 5.9 interfaces - // Implicitly registers 5.3 - 5.8 too - minor = 9; - qmlRegisterType <QmlLidSensor >(package, major, minor, "LidSensor"); - qmlRegisterUncreatableType<QmlLidReading >(package, major, minor, "LidReading", QLatin1String("Cannot create LidReading")); - qmlRegisterType <QmlHumiditySensor >(package, major, minor, "HumiditySensor"); - qmlRegisterUncreatableType<QmlHumidityReading >(package, major, minor, "HumidityReading", QLatin1String("Cannot create HumidityReading")); - - // Register the latest Qt version as QML type version - qmlRegisterModule(package, QT_VERSION_MAJOR, QT_VERSION_MINOR); - } -}; - -QT_END_NAMESPACE - -#include "sensors.moc" diff --git a/src/imports/sensors/sensors.pro b/src/imports/sensors/sensors.pro deleted file mode 100644 index d6279168..00000000 --- a/src/imports/sensors/sensors.pro +++ /dev/null @@ -1,56 +0,0 @@ -QT += qml sensors sensors-private - -HEADERS += \ - qmlsensor.h \ - qmlsensorrange.h \ - qmlaccelerometer.h \ - qmlaltimeter.h \ - qmlambientlightsensor.h \ - qmlambienttemperaturesensor.h \ - qmlcompass.h \ - qmldistancesensor.h \ - qmlgyroscope.h \ - qmlholstersensor.h \ - qmlirproximitysensor.h \ - qmllightsensor.h \ - qmlmagnetometer.h \ - qmlorientationsensor.h \ - qmlpressuresensor.h\ - qmlproximitysensor.h \ - qmltapsensor.h \ - qmlrotationsensor.h \ - qmlsensorglobal.h \ - qmltiltsensor.h \ - qmlsensorgesture.h \ - qmlhumiditysensor.h \ - qmllidsensor.h - -SOURCES += sensors.cpp \ - qmlsensor.cpp \ - qmlsensorrange.cpp \ - qmlaccelerometer.cpp \ - qmlaltimeter.cpp \ - qmlambientlightsensor.cpp \ - qmlambienttemperaturesensor.cpp \ - qmlcompass.cpp \ - qmldistancesensor.cpp \ - qmlgyroscope.cpp \ - qmlholstersensor.cpp \ - qmlirproximitysensor.cpp \ - qmllightsensor.cpp \ - qmlmagnetometer.cpp \ - qmlorientationsensor.cpp \ - qmlpressuresensor.cpp\ - qmlproximitysensor.cpp \ - qmltapsensor.cpp \ - qmlrotationsensor.cpp \ - qmlsensorglobal.cpp \ - qmltiltsensor.cpp \ - qmlsensorgesture.cpp \ - qmlhumiditysensor.cpp \ - qmllidsensor.cpp - -load(qml_plugin) - -OTHER_FILES += \ - plugin.json qmldir plugins.qmltypes |