diff options
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | examples/sensors/accelbubble/android/AndroidManifest.xml | 6 | ||||
-rw-r--r-- | examples/sensors/grue/plugin/gruesensorimpl.h | 4 | ||||
-rw-r--r-- | examples/sensors/maze/android/AndroidManifest.xml | 6 | ||||
-rw-r--r-- | examples/sensors/sensor_explorer/import/import.pro | 1 | ||||
-rw-r--r-- | examples/sensors/sensor_explorer/import/main.cpp | 28 | ||||
-rw-r--r-- | examples/sensors/sensor_explorer/import/main.h | 64 | ||||
-rw-r--r-- | src/imports/sensors/plugins.qmltypes | 2 | ||||
-rw-r--r-- | src/plugins/sensors/simulator/simulatoraccelerometer.cpp | 4 | ||||
-rw-r--r-- | src/plugins/sensors/simulator/simulatorambientlightsensor.cpp | 4 | ||||
-rw-r--r-- | src/plugins/sensors/simulator/simulatorcompass.cpp | 4 | ||||
-rw-r--r-- | src/plugins/sensors/simulator/simulatorirproximitysensor.cpp | 4 | ||||
-rw-r--r-- | src/plugins/sensors/simulator/simulatorlightsensor.cpp | 4 | ||||
-rw-r--r-- | src/plugins/sensors/simulator/simulatormagnetometer.cpp | 4 | ||||
-rw-r--r-- | src/plugins/sensors/simulator/simulatorproximitysensor.cpp | 4 | ||||
-rw-r--r-- | src/sensors/sensors.pro | 2 | ||||
-rw-r--r-- | tests/auto/qsensor/tst_qsensor.cpp | 6 |
17 files changed, 100 insertions, 49 deletions
diff --git a/.qmake.conf b/.qmake.conf index 543d0a84..db2e0b65 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,3 +1,3 @@ load(qt_build_config) -MODULE_VERSION = 5.13.2 +MODULE_VERSION = 5.14.0 diff --git a/examples/sensors/accelbubble/android/AndroidManifest.xml b/examples/sensors/accelbubble/android/AndroidManifest.xml index 4627978e..2fac659f 100644 --- a/examples/sensors/accelbubble/android/AndroidManifest.xml +++ b/examples/sensors/accelbubble/android/AndroidManifest.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --"> + <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true"> <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="portrait" android:launchMode="singleTop"> <intent-filter> <action android:name="android.intent.action.MAIN"/> @@ -18,12 +18,10 @@ <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> <!-- Deploy Qt libs as part of package --> <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/> - <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/> <!-- Run with local libs --> <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/> + <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> <!-- Used to specify custom system library path to run with local system libs --> diff --git a/examples/sensors/grue/plugin/gruesensorimpl.h b/examples/sensors/grue/plugin/gruesensorimpl.h index 0847ed9c..8a4a9565 100644 --- a/examples/sensors/grue/plugin/gruesensorimpl.h +++ b/examples/sensors/grue/plugin/gruesensorimpl.h @@ -54,7 +54,7 @@ #include <qsensorbackend.h> #include "gruesensor.h" #include <qambientlightsensor.h> -#include <QTime> +#include <QElapsedTimer> QT_BEGIN_NAMESPACE class QTimer; @@ -79,7 +79,7 @@ private: GrueSensorReading m_reading; QAmbientLightSensor *lightSensor; QTimer *darkTimer; - QTime timer; + QElapsedTimer timer; QAmbientLightReading::LightLevel lightLevel; }; diff --git a/examples/sensors/maze/android/AndroidManifest.xml b/examples/sensors/maze/android/AndroidManifest.xml index bfb126a6..ac1cd58f 100644 --- a/examples/sensors/maze/android/AndroidManifest.xml +++ b/examples/sensors/maze/android/AndroidManifest.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --"> + <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true"> <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="portrait" android:launchMode="singleTop"> <intent-filter> <action android:name="android.intent.action.MAIN"/> @@ -13,12 +13,10 @@ <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> <!-- Deploy Qt libs as part of package --> <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/> - <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/> <!-- Run with local libs --> <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/> + <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> <!-- Messages maps --> diff --git a/examples/sensors/sensor_explorer/import/import.pro b/examples/sensors/sensor_explorer/import/import.pro index 49a437e8..48509214 100644 --- a/examples/sensors/sensor_explorer/import/import.pro +++ b/examples/sensors/sensor_explorer/import/import.pro @@ -15,6 +15,7 @@ SOURCES = \ propertyinfo.cpp HEADERS = \ + main.h \ explorer.h \ sensoritem.h \ propertyinfo.h diff --git a/examples/sensors/sensor_explorer/import/main.cpp b/examples/sensors/sensor_explorer/import/main.cpp index b43ea339..4199b2f4 100644 --- a/examples/sensors/sensor_explorer/import/main.cpp +++ b/examples/sensors/sensor_explorer/import/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtSensors module of the Qt Toolkit. @@ -48,28 +48,18 @@ ** ****************************************************************************/ -#include <QtQml/QQmlExtensionPlugin> -#include <QtQml/QtQml> +#include "main.h" #include "explorer.h" -#include <QtCore/QDebug> QT_BEGIN_NAMESPACE -class SensorExplorerDeclarativeModule : public QQmlExtensionPlugin +void SensorExplorerDeclarativeModule::registerTypes(const char *uri) { - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid FILE "import.json") -public: - void registerTypes(const char *uri) override - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("Explorer")); - // @uri Explorer - qmlRegisterType<QSensorExplorer>(uri, 1, 0, "SensorExplorer"); - qmlRegisterType<QSensorItem>(uri, 1, 0, "SensorItem"); - qmlRegisterType<QPropertyInfo>(uri, 1, 0, "PropertyInfo"); - } -}; + Q_ASSERT(QLatin1String(uri) == QLatin1String("Explorer")); + // @uri Explorer + qmlRegisterType<QSensorExplorer>(uri, 1, 0, "SensorExplorer"); + qmlRegisterType<QSensorItem>(uri, 1, 0, "SensorItem"); + qmlRegisterType<QPropertyInfo>(uri, 1, 0, "PropertyInfo"); +} QT_END_NAMESPACE - -#include "main.moc" diff --git a/examples/sensors/sensor_explorer/import/main.h b/examples/sensors/sensor_explorer/import/main.h new file mode 100644 index 00000000..6964bec6 --- /dev/null +++ b/examples/sensors/sensor_explorer/import/main.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2019 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:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtQml/QQmlExtensionPlugin> +#include <QtQml/QtQml> + +QT_BEGIN_NAMESPACE + +class SensorExplorerDeclarativeModule : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid FILE "import.json") +public: + void registerTypes(const char *uri) override; +}; + +QT_END_NAMESPACE diff --git a/src/imports/sensors/plugins.qmltypes b/src/imports/sensors/plugins.qmltypes index b78e63c6..b148cbee 100644 --- a/src/imports/sensors/plugins.qmltypes +++ b/src/imports/sensors/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtSensors 5.13' +// 'qmlplugindump -nonrelocatable QtSensors 5.14' Module { dependencies: ["QtQuick 2.0"] diff --git a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp b/src/plugins/sensors/simulator/simulatoraccelerometer.cpp index 481128f4..280fc7ee 100644 --- a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp +++ b/src/plugins/sensors/simulator/simulatoraccelerometer.cpp @@ -54,9 +54,9 @@ void SimulatorAccelerometer::poll() QtMobility::QAccelerometerReadingData data = SensorsConnection::instance()->qtAccelerometerData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.x() != data.x || m_reading.y() != data.y || m_reading.z() != data.z) { diff --git a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp b/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp index 177684fe..5d84b36c 100644 --- a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp +++ b/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp @@ -76,9 +76,9 @@ void SimulatorAmbientLightSensor::poll() quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.lightLevel() != convertedLightLevel) { m_reading.setTimestamp(newTimestamp); m_reading.setLightLevel(convertedLightLevel); diff --git a/src/plugins/sensors/simulator/simulatorcompass.cpp b/src/plugins/sensors/simulator/simulatorcompass.cpp index fc68c513..e9d0f1d7 100644 --- a/src/plugins/sensors/simulator/simulatorcompass.cpp +++ b/src/plugins/sensors/simulator/simulatorcompass.cpp @@ -54,9 +54,9 @@ void SimulatorCompass::poll() QtMobility::QCompassReadingData data = SensorsConnection::instance()->qtCompassData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.azimuth() != data.azimuth || m_reading.calibrationLevel() != data.calibrationLevel) { m_reading.setTimestamp(newTimestamp); diff --git a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp index 4499128f..d041a86d 100644 --- a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp +++ b/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp @@ -54,9 +54,9 @@ void SimulatorIRProximitySensor::poll() QtMobility::QIRProximityReadingData data = SensorsConnection::instance()->qtIRProximityData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.reflectance() != data.irProximity) { m_reading.setTimestamp(newTimestamp); m_reading.setReflectance(data.irProximity); diff --git a/src/plugins/sensors/simulator/simulatorlightsensor.cpp b/src/plugins/sensors/simulator/simulatorlightsensor.cpp index 40d9edbd..bb4dd94d 100644 --- a/src/plugins/sensors/simulator/simulatorlightsensor.cpp +++ b/src/plugins/sensors/simulator/simulatorlightsensor.cpp @@ -54,9 +54,9 @@ void SimulatorLightSensor::poll() QtMobility::QLightReadingData data = SensorsConnection::instance()->qtLightData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.lux() != data.lux) { m_reading.setTimestamp(newTimestamp); m_reading.setLux(data.lux); diff --git a/src/plugins/sensors/simulator/simulatormagnetometer.cpp b/src/plugins/sensors/simulator/simulatormagnetometer.cpp index 64a31776..b54525ab 100644 --- a/src/plugins/sensors/simulator/simulatormagnetometer.cpp +++ b/src/plugins/sensors/simulator/simulatormagnetometer.cpp @@ -54,9 +54,9 @@ void SimulatorMagnetometer::poll() QtMobility::QMagnetometerReadingData data = SensorsConnection::instance()->qtMagnetometerData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.x() != data.x || m_reading.y() != data.y || m_reading.z() != data.z diff --git a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorproximitysensor.cpp index b4430959..6a28ce52 100644 --- a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp +++ b/src/plugins/sensors/simulator/simulatorproximitysensor.cpp @@ -54,9 +54,9 @@ void SimulatorProximitySensor::poll() QtMobility::QProximityReadingData data = SensorsConnection::instance()->qtProximityData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch() / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch(); if (m_reading.close() != data.close) { m_reading.setTimestamp(newTimestamp); m_reading.setClose(data.close); diff --git a/src/sensors/sensors.pro b/src/sensors/sensors.pro index c4035038..79cb6e45 100644 --- a/src/sensors/sensors.pro +++ b/src/sensors/sensors.pro @@ -13,7 +13,7 @@ qtHaveModule(simulator) { QMAKE_DOCS = $$PWD/doc/qtsensors.qdocconf ANDROID_LIB_DEPENDENCIES = \ - plugins/sensors/libqtsensors_android.so + plugins/sensors/libplugins_sensors_qtsensors_android.so PUBLIC_HEADERS += \ qsensorbackend.h\ diff --git a/tests/auto/qsensor/tst_qsensor.cpp b/tests/auto/qsensor/tst_qsensor.cpp index 911e9c2c..8e027971 100644 --- a/tests/auto/qsensor/tst_qsensor.cpp +++ b/tests/auto/qsensor/tst_qsensor.cpp @@ -139,7 +139,7 @@ private slots: QList<QByteArray> expected; expected << TestSensor::type << TestSensor2::type; QList<QByteArray> actual = QSensor::sensorTypes(); - qSort(actual); // The actual list is not in a defined order + std::sort(actual.begin(), actual.end()); // The actual list is not in a defined order QCOMPARE(actual, expected); } @@ -148,7 +148,7 @@ private slots: QList<QByteArray> expected; expected << "test sensor 2" << "test sensor 3" << testsensorimpl::id; QList<QByteArray> actual = QSensor::sensorsForType(TestSensor::type); - qSort(actual); // The actual list is not in a defined order + std::sort(actual.begin(), actual.end()); // The actual list is not in a defined order QCOMPARE(actual, expected); } @@ -776,7 +776,7 @@ private slots: QList<QByteArray> expected; expected << TestSensor::type << TestSensor2::type; QList<QByteArray> actual = QSensor::sensorTypes(); - qSort(actual); // The actual list is not in a defined order + std::sort(actual.begin(), actual.end()); // The actual list is not in a defined order QCOMPARE(actual, expected); } |