From fba7e3cf5c8ad287ceaaeb381989159d8baa96ec Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 13 Sep 2018 15:19:03 +0200 Subject: wearable: add demo mode This change adds a switch in the settings page that enables demo mode. In this mode, each screen and UI control will be visited and interacted with in a loop until the screen is tapped, at which point it returns to the launcher page. Change-Id: Icb306e23985d8c1f82725a95ed7f2e34b3d6c03f Reviewed-by: Mikhail Svetkin Reviewed-by: Richard Moe Gustavsen --- .../wearable/qml/Alarms/AlarmsPage.qml | 2 + examples/quickcontrols2/wearable/qml/DemoMode.qml | 258 +++++++++++++++++++++ .../wearable/qml/DemoModeIndicator.qml | 94 ++++++++ .../wearable/qml/Navigation/NavigationPage.qml | 2 + .../wearable/qml/Settings/SettingsPage.qml | 41 ++-- .../wearable/qml/Settings/images/contrast-dark.png | Bin 1386 -> 0 bytes .../qml/Settings/images/contrast-dark@2x.png | Bin 1395 -> 0 bytes .../qml/Settings/images/contrast-light.png | Bin 2347 -> 0 bytes .../qml/Settings/images/contrast-light@2x.png | Bin 1930 -> 0 bytes .../qml/Settings/images/demo-mode-dark.png | Bin 0 -> 1053 bytes .../qml/Settings/images/demo-mode-dark@2x.png | Bin 0 -> 1418 bytes .../qml/Settings/images/demo-mode-light.png | Bin 0 -> 1057 bytes .../qml/Settings/images/demo-mode-light@2x.png | Bin 0 -> 1737 bytes .../qml/Settings/images/demo-mode-white.png | Bin 0 -> 825 bytes .../qml/Settings/images/demo-mode-white@2x.png | Bin 0 -> 1318 bytes .../wearable/qml/Settings/images/demo-mode.svg | 93 ++++++++ .../quickcontrols2/wearable/qml/Style/Switch.qml | 2 +- .../quickcontrols2/wearable/qml/Style/UIStyle.qml | 3 + examples/quickcontrols2/wearable/wearable.qml | 24 +- examples/quickcontrols2/wearable/wearable.qrc | 12 +- 20 files changed, 507 insertions(+), 24 deletions(-) create mode 100644 examples/quickcontrols2/wearable/qml/DemoMode.qml create mode 100644 examples/quickcontrols2/wearable/qml/DemoModeIndicator.qml delete mode 100644 examples/quickcontrols2/wearable/qml/Settings/images/contrast-dark.png delete mode 100644 examples/quickcontrols2/wearable/qml/Settings/images/contrast-dark@2x.png delete mode 100644 examples/quickcontrols2/wearable/qml/Settings/images/contrast-light.png delete mode 100644 examples/quickcontrols2/wearable/qml/Settings/images/contrast-light@2x.png create mode 100644 examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark.png create mode 100644 examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark@2x.png create mode 100644 examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light.png create mode 100644 examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light@2x.png create mode 100644 examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white.png create mode 100644 examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white@2x.png create mode 100644 examples/quickcontrols2/wearable/qml/Settings/images/demo-mode.svg diff --git a/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml index dba8144a..99343d24 100644 --- a/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml +++ b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml @@ -66,6 +66,8 @@ Item { } SwipeViewPage { + property alias stateSwitch: stateSwitch + Column { spacing: 30 anchors.centerIn: parent diff --git a/examples/quickcontrols2/wearable/qml/DemoMode.qml b/examples/quickcontrols2/wearable/qml/DemoMode.qml new file mode 100644 index 00000000..c67a56e6 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/DemoMode.qml @@ -0,0 +1,258 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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$ +** +****************************************************************************/ + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import "Style" + +Item { + property StackView stackView + + SequentialAnimation { + id: demoModeAnimation + running: settings.demoMode + + // Set brightness back to normal. + ScriptAction { script: settings.brightness = 0 } + + // Go back to the launcher page. + PauseAnimation { duration: 1000 } + ScriptAction { script: stackView.pop(null) } + PauseAnimation { duration: 2000 } + + // Open the world clock page. + ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("WorldClock/WorldClockPage.qml")) } + PauseAnimation { duration: 2000 } + + // Swipe across a few times. + SequentialAnimation { + loops: 6 + + ScriptAction { script: stackView.currentItem.children[0].incrementCurrentIndex() } + PauseAnimation { duration: 2500 } + } + + + // Go back to the launcher page. + ScriptAction { script: stackView.pop(null) } + PauseAnimation { duration: 2000 } + + // Open the navigation page. + ScriptAction { script: stackView.currentItem.incrementCurrentIndex() } + PauseAnimation { duration: 1000 } + ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Navigation/NavigationPage.qml")) } + PauseAnimation { duration: 2000 } + + // Flick down a few times. + SequentialAnimation { + loops: 6 + + ScriptAction { script: stackView.currentItem.routeListView.incrementCurrentIndex() } + PauseAnimation { duration: 2000 } + } + + + // Go back to the launcher page. + ScriptAction { script: stackView.pop(null) } + PauseAnimation { duration: 2000 } + + // Open the weather page. + ScriptAction { script: stackView.currentItem.incrementCurrentIndex() } + PauseAnimation { duration: 1000 } + ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Weather/WeatherPage.qml")) } + PauseAnimation { duration: 2000 } + + // Swipe across a few times. + SequentialAnimation { + loops: 4 + + ScriptAction { script: stackView.currentItem.children[0].incrementCurrentIndex() } + PauseAnimation { duration: 2000 } + } + + + // Go back to the launcher page. + ScriptAction { script: stackView.pop(null) } + PauseAnimation { duration: 2000 } + + // Open the fitness page. + ScriptAction { script: stackView.currentItem.incrementCurrentIndex() } + PauseAnimation { duration: 1000 } + ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Fitness/FitnessPage.qml")) } + PauseAnimation { duration: 2000 } + + // Swipe across a few times. + SequentialAnimation { + loops: 2 + + ScriptAction { script: stackView.currentItem.children[0].incrementCurrentIndex() } + PauseAnimation { duration: 2000 } + } + + + // Go back to the launcher page. + ScriptAction { script: stackView.pop(null) } + PauseAnimation { duration: 2000 } + + // Open the notifications page. + ScriptAction { script: stackView.currentItem.incrementCurrentIndex() } + PauseAnimation { duration: 1000 } + ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Notifications/NotificationsPage.qml")) } + + // Flick down a few times. + SequentialAnimation { + loops: 3 + + PauseAnimation { duration: 2000 } + ScriptAction { script: stackView.currentItem.incrementCurrentIndex() } + } + + + // Go back to the launcher page. + ScriptAction { script: stackView.pop(null) } + PauseAnimation { duration: 2000 } + + // Open the alarms page. + ScriptAction { script: stackView.currentItem.incrementCurrentIndex() } + PauseAnimation { duration: 1000 } + ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Alarms/AlarmsPage.qml")) } + PauseAnimation { duration: 2000 } + + // Toggle the switch. + ScriptAction { script: stackView.currentItem.children[0].currentItem.stateSwitch.toggle() } + PauseAnimation { duration: 2000 } + + // Go to the next alarm. + ScriptAction { script: stackView.currentItem.children[0].incrementCurrentIndex() } + PauseAnimation { duration: 2000 } + + // Toggle the switch there too. + ScriptAction { script: stackView.currentItem.children[0].currentItem.stateSwitch.toggle() } + PauseAnimation { duration: 2000 } + + + // Go back to the launcher page. + ScriptAction { script: stackView.pop(null) } + PauseAnimation { duration: 2000 } + + // Open the settings page. + ScriptAction { script: stackView.currentItem.incrementCurrentIndex() } + PauseAnimation { duration: 1000 } + ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Settings/SettingsPage.qml")) } + PauseAnimation { duration: 3000 } + + // Toggle the switches. + ScriptAction { script: stackView.currentItem.children[0].currentItem.bluetoothSwitch.toggle() } + PauseAnimation { duration: 1000 } + ScriptAction { script: stackView.currentItem.children[0].currentItem.wirelessSwitch.toggle() } + PauseAnimation { duration: 3000 } + + // Go to the next page. + ScriptAction { script: stackView.currentItem.children[0].incrementCurrentIndex() } + + // Play with the brightness slider. + // First, set it to full brightness so we start in the correct state. + ScriptAction { + script: { + var brightnessSlider = stackView.currentItem.children[0].currentItem.brightnessSlider + brightnessSlider.value = 0 + // increase()/decrease() are not a result of user interaction and + // hence moved() will not be emitted, so we do it ourselves. + brightnessSlider.moved() + } + } + + // Decrease the brightness. + SequentialAnimation { + loops: 3 + + PauseAnimation { duration: 1000 } + ScriptAction { + script: { + var brightnessSlider = stackView.currentItem.children[0].currentItem.brightnessSlider + brightnessSlider.decrease() + brightnessSlider.moved() + } + } + } + + // Increase the brightness back to full. + PauseAnimation { duration: 3000 } + SequentialAnimation { + loops: 3 + + PauseAnimation { duration: 1000 } + ScriptAction { + script: { + var brightnessSlider = stackView.currentItem.children[0].currentItem.brightnessSlider + brightnessSlider.increase() + brightnessSlider.moved() + } + } + } + + // Toggle the dark theme switch. + PauseAnimation { duration: 2000 } + ScriptAction { + script: { + var darkThemeSwitch = stackView.currentItem.children[0].currentItem.darkThemeSwitch + darkThemeSwitch.toggle() + // As above, only proper user interaction results in toggled() being emitted, + // so we do it ourselves. + darkThemeSwitch.toggled() + } + } + PauseAnimation { duration: 4000 } + + // Go back to the launcher page. + ScriptAction { script: stackView.pop(null) } + } +} diff --git a/examples/quickcontrols2/wearable/qml/DemoModeIndicator.qml b/examples/quickcontrols2/wearable/qml/DemoModeIndicator.qml new file mode 100644 index 00000000..66ced325 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/DemoModeIndicator.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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$ +** +****************************************************************************/ + +import QtQuick 2.10 +import QtQuick.Controls 2.3 as QQC2 +import "Style" + +Item { + id: root + width: row.implicitWidth + margins * 2 + + readonly property int topMargin: 24 + readonly property int margins: 12 + + Behavior on y { + NumberAnimation {} + } + + Rectangle { + id: demoModeIndicatorBg + anchors.fill: parent + anchors.topMargin: -topMargin + radius: 20 + color: UIStyle.colorRed + } + + Row { + id: row + spacing: 8 + anchors.fill: parent + anchors.leftMargin: margins + anchors.rightMargin: margins + + Image { + source: "Settings/images/demo-mode-white.png" + width: height + height: instructionLabel.height * 2 + anchors.verticalCenter: parent.verticalCenter + } + QQC2.Label { + id: instructionLabel + text: "Tap screen to use" + color: UIStyle.colorQtGray10 + anchors.verticalCenter: parent.verticalCenter + } + } +} diff --git a/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml index 973ad528..8ab82bac 100644 --- a/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml +++ b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml @@ -53,6 +53,8 @@ import "../Style" import "navigation.js" as NavigationData Item { + property alias routeListView: routeView + Column { anchors.fill: parent anchors.margins: 2 diff --git a/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml b/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml index af6561f3..bb347e7d 100644 --- a/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml +++ b/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml @@ -63,6 +63,9 @@ Item { SwipeViewPage { id: settingsPage1 + property alias bluetoothSwitch: bluetoothSwitch + property alias wirelessSwitch: wirelessSwitch + Column { anchors.centerIn: parent spacing: 25 @@ -99,6 +102,9 @@ Item { SwipeViewPage { id: settingsPage2 + property alias brightnessSlider: brightnessSlider + property alias darkThemeSwitch: darkThemeSwitch + Column { anchors.centerIn: parent spacing: 2 @@ -119,19 +125,17 @@ Item { } } Column { - spacing: 2 + anchors.horizontalCenter: parent.horizontalCenter + Image { anchors.horizontalCenter: parent.horizontalCenter - source: UIStyle.themeImagePath("images/contrast") + source: UIStyle.themeImagePath("images/theme") } - QQC2.Slider { - id: contrastSlider + QQC2.Switch { + id: darkThemeSwitch anchors.horizontalCenter: parent.horizontalCenter - from: 0 - to: 10 - stepSize: 1 - value: settings.contrast - onMoved: settings.contrast = value + checked: settings.darkTheme + onToggled: settings.darkTheme = checked } } } @@ -142,19 +146,20 @@ Item { Column { anchors.centerIn: parent - spacing: 2 - Row { - spacing: 50 + Column { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 6 + Image { - anchors.verticalCenter: parent.verticalCenter - source: UIStyle.themeImagePath("images/theme") + anchors.horizontalCenter: parent.horizontalCenter + source: UIStyle.themeImagePath("images/demo-mode") } QQC2.Switch { - id: darkThemeSwitch - anchors.verticalCenter: parent.verticalCenter - checked: settings.darkTheme - onToggled: settings.darkTheme = checked + id: demoModeSwitch + anchors.horizontalCenter: parent.horizontalCenter + checked: settings.demoMode + onToggled: settings.demoMode = checked } } } diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/contrast-dark.png b/examples/quickcontrols2/wearable/qml/Settings/images/contrast-dark.png deleted file mode 100644 index 92e17192..00000000 Binary files a/examples/quickcontrols2/wearable/qml/Settings/images/contrast-dark.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/contrast-dark@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/contrast-dark@2x.png deleted file mode 100644 index d52633ab..00000000 Binary files a/examples/quickcontrols2/wearable/qml/Settings/images/contrast-dark@2x.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/contrast-light.png b/examples/quickcontrols2/wearable/qml/Settings/images/contrast-light.png deleted file mode 100644 index eb528eb8..00000000 Binary files a/examples/quickcontrols2/wearable/qml/Settings/images/contrast-light.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/contrast-light@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/contrast-light@2x.png deleted file mode 100644 index 92e112f9..00000000 Binary files a/examples/quickcontrols2/wearable/qml/Settings/images/contrast-light@2x.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark.png new file mode 100644 index 00000000..571a4645 Binary files /dev/null and b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark.png differ diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark@2x.png new file mode 100644 index 00000000..a8203b35 Binary files /dev/null and b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark@2x.png differ diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light.png new file mode 100644 index 00000000..0f8fcc75 Binary files /dev/null and b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light.png differ diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light@2x.png new file mode 100644 index 00000000..57282a5a Binary files /dev/null and b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light@2x.png differ diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white.png new file mode 100644 index 00000000..1f967488 Binary files /dev/null and b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white.png differ diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white@2x.png new file mode 100644 index 00000000..fd0611e6 Binary files /dev/null and b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white@2x.png differ diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode.svg b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode.svg new file mode 100644 index 00000000..ad1ce448 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/examples/quickcontrols2/wearable/qml/Style/Switch.qml b/examples/quickcontrols2/wearable/qml/Style/Switch.qml index 6f663920..b1597737 100644 --- a/examples/quickcontrols2/wearable/qml/Style/Switch.qml +++ b/examples/quickcontrols2/wearable/qml/Style/Switch.qml @@ -78,7 +78,7 @@ T.Switch { background: Rectangle { radius: 13 - color: control.checked ? UIStyle.colorQtAuxGreen2 : "#E6173D" + color: control.checked ? UIStyle.colorQtAuxGreen2 : UIStyle.colorRed border.color: control.checked ? UIStyle.colorQtAuxGreen2 : UIStyle.themeColorQtGray6 } diff --git a/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml b/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml index 98f2e5a2..f4a5df69 100644 --- a/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml +++ b/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml @@ -70,6 +70,9 @@ QtObject { readonly property color colorQtAuxGreen1: "#21be2b" readonly property color colorQtAuxGreen2: "#17a81a" + // Red + readonly property color colorRed: "#e6173d" + // Gray readonly property color colorQtGray1: "#09102b" readonly property color colorQtGray2: "#222840" diff --git a/examples/quickcontrols2/wearable/wearable.qml b/examples/quickcontrols2/wearable/wearable.qml index 62f138bb..ea84adca 100644 --- a/examples/quickcontrols2/wearable/wearable.qml +++ b/examples/quickcontrols2/wearable/wearable.qml @@ -65,9 +65,9 @@ QQC2.ApplicationWindow { id: settings property bool wireless property bool bluetooth - property int contrast property int brightness property bool darkTheme + property bool demoMode } Binding { @@ -115,4 +115,26 @@ QQC2.ApplicationWindow { onLaunched: stackView.push(page) } } + + DemoMode { + stackView: stackView + } + + DemoModeIndicator { + id: demoModeIndicator + y: settings.demoMode ? -height : -height * 2 + anchors.horizontalCenter: parent.horizontalCenter + height: header.height + z: window.header.z + 1 + } + + MouseArea { + enabled: settings.demoMode + anchors.fill: parent + onClicked: { + // Stop demo mode and return to the launcher page. + settings.demoMode = false + stackView.pop(null) + } + } } diff --git a/examples/quickcontrols2/wearable/wearable.qrc b/examples/quickcontrols2/wearable/wearable.qrc index 3559ffb8..db59d038 100644 --- a/examples/quickcontrols2/wearable/wearable.qrc +++ b/examples/quickcontrols2/wearable/wearable.qrc @@ -80,8 +80,12 @@ qml/Settings/images/bluetooth-light@2x.png qml/Settings/images/brightness-light.png qml/Settings/images/brightness-light@2x.png - qml/Settings/images/contrast-light.png - qml/Settings/images/contrast-light@2x.png + qml/Settings/images/demo-mode-light.png + qml/Settings/images/demo-mode-light@2x.png + qml/Settings/images/demo-mode-dark.png + qml/Settings/images/demo-mode-dark@2x.png + qml/Settings/images/demo-mode-white.png + qml/Settings/images/demo-mode-white@2x.png qml/Settings/images/theme-light.png qml/Settings/images/theme-light@2x.png qml/Settings/images/wifi-light.png @@ -90,8 +94,6 @@ qml/Settings/images/bluetooth-dark@2x.png qml/Settings/images/brightness-dark.png qml/Settings/images/brightness-dark@2x.png - qml/Settings/images/contrast-dark.png - qml/Settings/images/contrast-dark@2x.png qml/Settings/images/theme-dark.png qml/Settings/images/theme-dark@2x.png qml/Settings/images/wifi-dark.png @@ -147,5 +149,7 @@ qml/WorldClock/images/swissnightminute.png qml/WorldClock/images/swissnightminute@2x.png qml/SwipeViewPage.qml + qml/DemoMode.qml + qml/DemoModeIndicator.qml -- cgit v1.2.3