diff options
Diffstat (limited to 'examples')
24 files changed, 67 insertions, 62 deletions
diff --git a/examples/bluetooth/heartrate-game/bluetoothbaseclass.cpp b/examples/bluetooth/heartrate-game/bluetoothbaseclass.cpp index cd163a47..5db621c4 100644 --- a/examples/bluetooth/heartrate-game/bluetoothbaseclass.cpp +++ b/examples/bluetooth/heartrate-game/bluetoothbaseclass.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "bluetoothbaseclass.h" diff --git a/examples/bluetooth/heartrate-game/bluetoothbaseclass.h b/examples/bluetooth/heartrate-game/bluetoothbaseclass.h index 5f770635..42545686 100644 --- a/examples/bluetooth/heartrate-game/bluetoothbaseclass.h +++ b/examples/bluetooth/heartrate-game/bluetoothbaseclass.h @@ -1,4 +1,4 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #ifndef BLUETOOTHBASECLASS_H @@ -9,6 +9,7 @@ class BluetoothBaseClass : public QObject { Q_OBJECT + Q_PROPERTY(QString error READ error WRITE setError NOTIFY errorChanged) Q_PROPERTY(QString info READ info WRITE setInfo NOTIFY infoChanged) diff --git a/examples/bluetooth/heartrate-game/connectionhandler.h b/examples/bluetooth/heartrate-game/connectionhandler.h index 8125fa09..17d33ba9 100644 --- a/examples/bluetooth/heartrate-game/connectionhandler.h +++ b/examples/bluetooth/heartrate-game/connectionhandler.h @@ -1,20 +1,22 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #ifndef CONNECTIONHANDLER_H #define CONNECTIONHANDLER_H -#include <QObject> #include <QBluetoothLocalDevice> +#include <QObject> + class ConnectionHandler : public QObject { + Q_OBJECT + Q_PROPERTY(bool alive READ alive NOTIFY deviceChanged) Q_PROPERTY(QString name READ name NOTIFY deviceChanged) Q_PROPERTY(QString address READ address NOTIFY deviceChanged) Q_PROPERTY(bool requiresAddressType READ requiresAddressType CONSTANT) - Q_OBJECT public: explicit ConnectionHandler(QObject *parent = nullptr); diff --git a/examples/bluetooth/heartrate-game/devicefinder.cpp b/examples/bluetooth/heartrate-game/devicefinder.cpp index e3f6ca82..a45f4fba 100644 --- a/examples/bluetooth/heartrate-game/devicefinder.cpp +++ b/examples/bluetooth/heartrate-game/devicefinder.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "devicefinder.h" diff --git a/examples/bluetooth/heartrate-game/devicefinder.h b/examples/bluetooth/heartrate-game/devicefinder.h index 6d091c58..f5844d6f 100644 --- a/examples/bluetooth/heartrate-game/devicefinder.h +++ b/examples/bluetooth/heartrate-game/devicefinder.h @@ -1,4 +1,4 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #ifndef DEVICEFINDER_H @@ -7,11 +7,11 @@ #include "heartrate-global.h" #include "bluetoothbaseclass.h" -#include <QTimer> -#include <QVariant> #include <QBluetoothDeviceDiscoveryAgent> #include <QBluetoothDeviceInfo> +#include <QTimer> +#include <QVariant> class DeviceInfo; class DeviceHandler; diff --git a/examples/bluetooth/heartrate-game/devicehandler.cpp b/examples/bluetooth/heartrate-game/devicehandler.cpp index 2ddb2310..bbf4e1df 100644 --- a/examples/bluetooth/heartrate-game/devicehandler.cpp +++ b/examples/bluetooth/heartrate-game/devicehandler.cpp @@ -1,18 +1,15 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "heartrate-global.h" #include "devicehandler.h" #include "deviceinfo.h" + #include <QtEndian> #include <QRandomGenerator> DeviceHandler::DeviceHandler(QObject *parent) : - BluetoothBaseClass(parent), - m_foundHeartRateService(false), - m_measuring(false), - m_currentValue(0), - m_min(0), m_max(0), m_sum(0), m_avg(0), m_calories(0) + BluetoothBaseClass(parent) { #ifdef SIMULATOR m_demoTimer.setSingleShot(false); diff --git a/examples/bluetooth/heartrate-game/devicehandler.h b/examples/bluetooth/heartrate-game/devicehandler.h index 5cc0f99e..1488010a 100644 --- a/examples/bluetooth/heartrate-game/devicehandler.h +++ b/examples/bluetooth/heartrate-game/devicehandler.h @@ -1,4 +1,4 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #ifndef DEVICEHANDLER_H @@ -6,13 +6,13 @@ #include "bluetoothbaseclass.h" +#include <QLowEnergyController> +#include <QLowEnergyService> + #include <QDateTime> #include <QList> #include <QTimer> -#include <QLowEnergyController> -#include <QLowEnergyService> - class DeviceInfo; class DeviceHandler : public BluetoothBaseClass @@ -86,10 +86,10 @@ private: QLowEnergyDescriptor m_notificationDesc; DeviceInfo *m_currentDevice = nullptr; - bool m_foundHeartRateService; - bool m_measuring; - int m_currentValue, m_min, m_max, m_sum; - float m_avg, m_calories; + bool m_foundHeartRateService = false; + bool m_measuring = false; + int m_currentValue = 0, m_min = 0, m_max = 0, m_sum = 0; + float m_avg = 0, m_calories = 0; // Statistics QDateTime m_start; diff --git a/examples/bluetooth/heartrate-game/deviceinfo.cpp b/examples/bluetooth/heartrate-game/deviceinfo.cpp index 15a426f8..79e5cbf8 100644 --- a/examples/bluetooth/heartrate-game/deviceinfo.cpp +++ b/examples/bluetooth/heartrate-game/deviceinfo.cpp @@ -1,8 +1,9 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "heartrate-global.h" #include "deviceinfo.h" + #include <QBluetoothAddress> #include <QBluetoothUuid> diff --git a/examples/bluetooth/heartrate-game/deviceinfo.h b/examples/bluetooth/heartrate-game/deviceinfo.h index ffb78e12..19dd7afb 100644 --- a/examples/bluetooth/heartrate-game/deviceinfo.h +++ b/examples/bluetooth/heartrate-game/deviceinfo.h @@ -1,16 +1,18 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #ifndef DEVICEINFO_H #define DEVICEINFO_H -#include <QString> -#include <QObject> #include <QBluetoothDeviceInfo> +#include <QObject> +#include <QString> + class DeviceInfo: public QObject { Q_OBJECT + Q_PROPERTY(QString deviceName READ getName NOTIFY deviceChanged) Q_PROPERTY(QString deviceAddress READ getAddress NOTIFY deviceChanged) diff --git a/examples/bluetooth/heartrate-game/heartrate-global.h b/examples/bluetooth/heartrate-game/heartrate-global.h index 0c5c12bc..9d48c1f7 100644 --- a/examples/bluetooth/heartrate-game/heartrate-global.h +++ b/examples/bluetooth/heartrate-game/heartrate-global.h @@ -1,4 +1,4 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #ifndef HEARTRATEGLOBAL_H diff --git a/examples/bluetooth/heartrate-game/main.cpp b/examples/bluetooth/heartrate-game/main.cpp index c2f64a66..990387ae 100644 --- a/examples/bluetooth/heartrate-game/main.cpp +++ b/examples/bluetooth/heartrate-game/main.cpp @@ -1,15 +1,17 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -#include <QGuiApplication> -#include <QLoggingCategory> -#include <QQmlApplicationEngine> -#include <QQmlContext> - #include "connectionhandler.h" #include "devicefinder.h" #include "devicehandler.h" +#include <QQmlApplicationEngine> +#include <QQmlContext> + +#include <QGuiApplication> + +#include <QLoggingCategory> + int main(int argc, char *argv[]) { // QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true")); diff --git a/examples/bluetooth/heartrate-game/qml/App.qml b/examples/bluetooth/heartrate-game/qml/App.qml index 0e4317a5..e1beff89 100644 --- a/examples/bluetooth/heartrate-game/qml/App.qml +++ b/examples/bluetooth/heartrate-game/qml/App.qml @@ -1,7 +1,7 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.5 +import QtQuick Item { id: app diff --git a/examples/bluetooth/heartrate-game/qml/BluetoothAlarmDialog.qml b/examples/bluetooth/heartrate-game/qml/BluetoothAlarmDialog.qml index 66cc00a3..93f4a3cd 100644 --- a/examples/bluetooth/heartrate-game/qml/BluetoothAlarmDialog.qml +++ b/examples/bluetooth/heartrate-game/qml/BluetoothAlarmDialog.qml @@ -1,7 +1,7 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.5 +import QtQuick Item { id: root diff --git a/examples/bluetooth/heartrate-game/qml/BottomLine.qml b/examples/bluetooth/heartrate-game/qml/BottomLine.qml index 0150425e..caebc307 100644 --- a/examples/bluetooth/heartrate-game/qml/BottomLine.qml +++ b/examples/bluetooth/heartrate-game/qml/BottomLine.qml @@ -1,7 +1,7 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.5 +import QtQuick Rectangle { anchors.horizontalCenter: parent.horizontalCenter diff --git a/examples/bluetooth/heartrate-game/qml/Connect.qml b/examples/bluetooth/heartrate-game/qml/Connect.qml index bad3a5b7..40f25310 100644 --- a/examples/bluetooth/heartrate-game/qml/Connect.qml +++ b/examples/bluetooth/heartrate-game/qml/Connect.qml @@ -1,8 +1,8 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.5 -import Shared 1.0 +import QtQuick +import Shared GamePage { diff --git a/examples/bluetooth/heartrate-game/qml/GameButton.qml b/examples/bluetooth/heartrate-game/qml/GameButton.qml index ccf71a9b..3ce9d66f 100644 --- a/examples/bluetooth/heartrate-game/qml/GameButton.qml +++ b/examples/bluetooth/heartrate-game/qml/GameButton.qml @@ -1,7 +1,7 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.5 +import QtQuick import "." Rectangle { diff --git a/examples/bluetooth/heartrate-game/qml/GamePage.qml b/examples/bluetooth/heartrate-game/qml/GamePage.qml index 474436d1..25a5bb3d 100644 --- a/examples/bluetooth/heartrate-game/qml/GamePage.qml +++ b/examples/bluetooth/heartrate-game/qml/GamePage.qml @@ -1,7 +1,7 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.5 +import QtQuick import "." Item { diff --git a/examples/bluetooth/heartrate-game/qml/GameSettings.qml b/examples/bluetooth/heartrate-game/qml/GameSettings.qml index ec40e2dc..f265b73c 100644 --- a/examples/bluetooth/heartrate-game/qml/GameSettings.qml +++ b/examples/bluetooth/heartrate-game/qml/GameSettings.qml @@ -1,8 +1,8 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause pragma Singleton -import QtQuick 2.5 +import QtQuick Item { property int wHeight diff --git a/examples/bluetooth/heartrate-game/qml/Measure.qml b/examples/bluetooth/heartrate-game/qml/Measure.qml index 5610aae6..c434d511 100644 --- a/examples/bluetooth/heartrate-game/qml/Measure.qml +++ b/examples/bluetooth/heartrate-game/qml/Measure.qml @@ -1,7 +1,7 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.5 +import QtQuick GamePage { id: measurePage diff --git a/examples/bluetooth/heartrate-game/qml/SplashScreen.qml b/examples/bluetooth/heartrate-game/qml/SplashScreen.qml index 7610bde4..23f71f08 100644 --- a/examples/bluetooth/heartrate-game/qml/SplashScreen.qml +++ b/examples/bluetooth/heartrate-game/qml/SplashScreen.qml @@ -1,7 +1,7 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.5 +import QtQuick import "." Item { diff --git a/examples/bluetooth/heartrate-game/qml/Stats.qml b/examples/bluetooth/heartrate-game/qml/Stats.qml index b3dc39cc..b818e85e 100644 --- a/examples/bluetooth/heartrate-game/qml/Stats.qml +++ b/examples/bluetooth/heartrate-game/qml/Stats.qml @@ -1,7 +1,7 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.5 +import QtQuick GamePage { diff --git a/examples/bluetooth/heartrate-game/qml/StatsLabel.qml b/examples/bluetooth/heartrate-game/qml/StatsLabel.qml index 5716b112..cd5cda5b 100644 --- a/examples/bluetooth/heartrate-game/qml/StatsLabel.qml +++ b/examples/bluetooth/heartrate-game/qml/StatsLabel.qml @@ -1,7 +1,7 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.5 +import QtQuick import "." Item { diff --git a/examples/bluetooth/heartrate-game/qml/TitleBar.qml b/examples/bluetooth/heartrate-game/qml/TitleBar.qml index 73b851f1..b7de77c4 100644 --- a/examples/bluetooth/heartrate-game/qml/TitleBar.qml +++ b/examples/bluetooth/heartrate-game/qml/TitleBar.qml @@ -1,7 +1,7 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.5 +import QtQuick Rectangle { id: titleBar diff --git a/examples/bluetooth/heartrate-game/qml/main.qml b/examples/bluetooth/heartrate-game/qml/main.qml index e3e1b2c7..8eb26247 100644 --- a/examples/bluetooth/heartrate-game/qml/main.qml +++ b/examples/bluetooth/heartrate-game/qml/main.qml @@ -1,8 +1,8 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.7 -import QtQuick.Window 2.2 +import QtQuick +import QtQuick.Window import "." Window { |