From 2f8e91e37d327c8dacd5c137e4198f274898f72a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 13 Mar 2017 10:03:37 +0100 Subject: Wearable: rename WatchFace to WorldClock To be consistent how the pages/apps are called in the UI vs. code. Change-Id: I721d3ebb8631aa97a1ab43e6924cd0e4d0f39d24 Reviewed-by: J-P Nurmi --- .../wearable/images/watchface/center.png | Bin 765 -> 0 bytes .../wearable/images/watchface/clock-night.png | Bin 25619 -> 0 bytes .../wearable/images/watchface/clock.png | Bin 15616 -> 0 bytes .../wearable/images/watchface/second.png | Bin 1015 -> 0 bytes .../wearable/images/watchface/swissdaydial.png | Bin 7999 -> 0 bytes .../wearable/images/watchface/swissdayhour.png | Bin 1088 -> 0 bytes .../wearable/images/watchface/swissdayminute.png | Bin 1109 -> 0 bytes .../wearable/images/watchface/swissnightdial.png | Bin 8899 -> 0 bytes .../wearable/images/watchface/swissnighthour.png | Bin 1117 -> 0 bytes .../wearable/images/watchface/swissnightminute.png | Bin 1063 -> 0 bytes .../wearable/images/watchface/swissseconds.png | Bin 2752 -> 0 bytes .../wearable/images/watchface/watch.png | Bin 19015 -> 0 bytes .../wearable/images/worldclock/center.png | Bin 0 -> 765 bytes .../wearable/images/worldclock/clock-night.png | Bin 0 -> 25619 bytes .../wearable/images/worldclock/clock.png | Bin 0 -> 15616 bytes .../wearable/images/worldclock/second.png | Bin 0 -> 1015 bytes .../wearable/images/worldclock/swissdaydial.png | Bin 0 -> 7999 bytes .../wearable/images/worldclock/swissdayhour.png | Bin 0 -> 1088 bytes .../wearable/images/worldclock/swissdayminute.png | Bin 0 -> 1109 bytes .../wearable/images/worldclock/swissnightdial.png | Bin 0 -> 8899 bytes .../wearable/images/worldclock/swissnighthour.png | Bin 0 -> 1117 bytes .../images/worldclock/swissnightminute.png | Bin 0 -> 1063 bytes .../wearable/images/worldclock/swissseconds.png | Bin 0 -> 2752 bytes .../wearable/images/worldclock/watch.png | Bin 0 -> 19015 bytes .../quickcontrols2/wearable/qml/LauncherPage.qml | 4 +- .../wearable/qml/WatchFace/Clock.qml | 191 --------------------- .../wearable/qml/WatchFace/WatchFacePage.qml | 127 -------------- .../wearable/qml/WorldClock/Clock.qml | 191 +++++++++++++++++++++ .../wearable/qml/WorldClock/WorldClockPage.qml | 127 ++++++++++++++ examples/quickcontrols2/wearable/wearable.qrc | 22 +-- 30 files changed, 331 insertions(+), 331 deletions(-) delete mode 100644 examples/quickcontrols2/wearable/images/watchface/center.png delete mode 100644 examples/quickcontrols2/wearable/images/watchface/clock-night.png delete mode 100644 examples/quickcontrols2/wearable/images/watchface/clock.png delete mode 100644 examples/quickcontrols2/wearable/images/watchface/second.png delete mode 100644 examples/quickcontrols2/wearable/images/watchface/swissdaydial.png delete mode 100644 examples/quickcontrols2/wearable/images/watchface/swissdayhour.png delete mode 100644 examples/quickcontrols2/wearable/images/watchface/swissdayminute.png delete mode 100644 examples/quickcontrols2/wearable/images/watchface/swissnightdial.png delete mode 100644 examples/quickcontrols2/wearable/images/watchface/swissnighthour.png delete mode 100644 examples/quickcontrols2/wearable/images/watchface/swissnightminute.png delete mode 100644 examples/quickcontrols2/wearable/images/watchface/swissseconds.png delete mode 100644 examples/quickcontrols2/wearable/images/watchface/watch.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/center.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/clock-night.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/clock.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/second.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/swissdaydial.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/swissdayhour.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/swissdayminute.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/swissnightdial.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/swissnighthour.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/swissnightminute.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/swissseconds.png create mode 100644 examples/quickcontrols2/wearable/images/worldclock/watch.png delete mode 100644 examples/quickcontrols2/wearable/qml/WatchFace/Clock.qml delete mode 100644 examples/quickcontrols2/wearable/qml/WatchFace/WatchFacePage.qml create mode 100644 examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml create mode 100644 examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml diff --git a/examples/quickcontrols2/wearable/images/watchface/center.png b/examples/quickcontrols2/wearable/images/watchface/center.png deleted file mode 100644 index 7fbd802a..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/center.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/watchface/clock-night.png b/examples/quickcontrols2/wearable/images/watchface/clock-night.png deleted file mode 100644 index 698f57a5..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/clock-night.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/watchface/clock.png b/examples/quickcontrols2/wearable/images/watchface/clock.png deleted file mode 100644 index 6e1c6eed..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/clock.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/watchface/second.png b/examples/quickcontrols2/wearable/images/watchface/second.png deleted file mode 100644 index eee07efb..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/second.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/watchface/swissdaydial.png b/examples/quickcontrols2/wearable/images/watchface/swissdaydial.png deleted file mode 100644 index 64136618..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/swissdaydial.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/watchface/swissdayhour.png b/examples/quickcontrols2/wearable/images/watchface/swissdayhour.png deleted file mode 100644 index 255985d2..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/swissdayhour.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/watchface/swissdayminute.png b/examples/quickcontrols2/wearable/images/watchface/swissdayminute.png deleted file mode 100644 index bc6992f8..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/swissdayminute.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/watchface/swissnightdial.png b/examples/quickcontrols2/wearable/images/watchface/swissnightdial.png deleted file mode 100644 index e2590af4..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/swissnightdial.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/watchface/swissnighthour.png b/examples/quickcontrols2/wearable/images/watchface/swissnighthour.png deleted file mode 100644 index 1c6a6131..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/swissnighthour.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/watchface/swissnightminute.png b/examples/quickcontrols2/wearable/images/watchface/swissnightminute.png deleted file mode 100644 index 3353ba2c..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/swissnightminute.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/watchface/swissseconds.png b/examples/quickcontrols2/wearable/images/watchface/swissseconds.png deleted file mode 100644 index 66b4f3fa..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/swissseconds.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/watchface/watch.png b/examples/quickcontrols2/wearable/images/watchface/watch.png deleted file mode 100644 index 299858b7..00000000 Binary files a/examples/quickcontrols2/wearable/images/watchface/watch.png and /dev/null differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/center.png b/examples/quickcontrols2/wearable/images/worldclock/center.png new file mode 100644 index 00000000..7fbd802a Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/center.png differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/clock-night.png b/examples/quickcontrols2/wearable/images/worldclock/clock-night.png new file mode 100644 index 00000000..698f57a5 Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/clock-night.png differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/clock.png b/examples/quickcontrols2/wearable/images/worldclock/clock.png new file mode 100644 index 00000000..6e1c6eed Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/clock.png differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/second.png b/examples/quickcontrols2/wearable/images/worldclock/second.png new file mode 100644 index 00000000..eee07efb Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/second.png differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/swissdaydial.png b/examples/quickcontrols2/wearable/images/worldclock/swissdaydial.png new file mode 100644 index 00000000..64136618 Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/swissdaydial.png differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/swissdayhour.png b/examples/quickcontrols2/wearable/images/worldclock/swissdayhour.png new file mode 100644 index 00000000..255985d2 Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/swissdayhour.png differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/swissdayminute.png b/examples/quickcontrols2/wearable/images/worldclock/swissdayminute.png new file mode 100644 index 00000000..bc6992f8 Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/swissdayminute.png differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/swissnightdial.png b/examples/quickcontrols2/wearable/images/worldclock/swissnightdial.png new file mode 100644 index 00000000..e2590af4 Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/swissnightdial.png differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/swissnighthour.png b/examples/quickcontrols2/wearable/images/worldclock/swissnighthour.png new file mode 100644 index 00000000..1c6a6131 Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/swissnighthour.png differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/swissnightminute.png b/examples/quickcontrols2/wearable/images/worldclock/swissnightminute.png new file mode 100644 index 00000000..3353ba2c Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/swissnightminute.png differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/swissseconds.png b/examples/quickcontrols2/wearable/images/worldclock/swissseconds.png new file mode 100644 index 00000000..66b4f3fa Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/swissseconds.png differ diff --git a/examples/quickcontrols2/wearable/images/worldclock/watch.png b/examples/quickcontrols2/wearable/images/worldclock/watch.png new file mode 100644 index 00000000..299858b7 Binary files /dev/null and b/examples/quickcontrols2/wearable/images/worldclock/watch.png differ diff --git a/examples/quickcontrols2/wearable/qml/LauncherPage.qml b/examples/quickcontrols2/wearable/qml/LauncherPage.qml index b1f642ee..9c82393f 100644 --- a/examples/quickcontrols2/wearable/qml/LauncherPage.qml +++ b/examples/quickcontrols2/wearable/qml/LauncherPage.qml @@ -69,8 +69,8 @@ PathView { model: ListModel { ListElement { title: qsTr("World Clock") - icon: "../images/watchface/watch.png" - page: "WatchFace/WatchFacePage.qml" + icon: "../images/worldclock/watch.png" + page: "WorldClock/WorldClockPage.qml" } ListElement { title: qsTr("Navigation") diff --git a/examples/quickcontrols2/wearable/qml/WatchFace/Clock.qml b/examples/quickcontrols2/wearable/qml/WatchFace/Clock.qml deleted file mode 100644 index 545c1b6e..00000000 --- a/examples/quickcontrols2/wearable/qml/WatchFace/Clock.qml +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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.7 -import "../Style" - -Item { - id: clock - - width: UIStyle.visibleDiameter - height: UIStyle.visibleDiameter - - property int hours - property int minutes - property int seconds - property real shift: timeShift - property bool night: false - property bool internationalTime: true //Unset for local time - - function getWatchFaceImage(imageName) { - return "../../images/watchface/" + imageName - } - - function timeChanged() { - var date = new Date - hours = internationalTime ? date.getUTCHours() + Math.floor( - clock.shift) : date.getHours() - night = (hours < 7 || hours > 19) - minutes = internationalTime ? - date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes() - seconds = date.getUTCSeconds() - } - - Timer { - interval: 100 - running: true - repeat: true - onTriggered: clock.timeChanged() - } - - Item { - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: 2 - - width: 200 - height: 220 - - Rectangle { - color: clock.night ? UIStyle.colorQtGray1 : UIStyle.colorQtGray10 - radius: width / 2 - width: parent.width - height: parent.width - } - - Image { - id: background - source: getWatchFaceImage("swissdaydial.png") - visible: clock.night == false - } - Image { - source: getWatchFaceImage("swissnightdial.png") - visible: clock.night == true - } - - Image { - x: 92.5 - y: 27 - source: getWatchFaceImage(clock.night ? - "swissnighthour.png" - : "swissdayhour.png") - transform: Rotation { - id: hourRotation - origin.x: 7.5 - origin.y: 73 - angle: (clock.hours * 30) + (clock.minutes * 0.5) - Behavior on angle { - SpringAnimation { - spring: 2 - damping: 0.2 - modulus: 360 - } - } - } - } - - Image { - x: 93.5 - y: 17 - source: getWatchFaceImage(clock.night ? - "swissnightminute.png" - : "swissdayminute.png") - transform: Rotation { - id: minuteRotation - origin.x: 6.5 - origin.y: 83 - angle: clock.minutes * 6 - Behavior on angle { - SpringAnimation { - spring: 2 - damping: 0.2 - modulus: 360 - } - } - } - } - - Image { - x: 97.5 - y: 20 - source: getWatchFaceImage("second.png") - transform: Rotation { - id: secondRotation - origin.x: 2.5 - origin.y: 80 - angle: clock.seconds * 6 - Behavior on angle { - SpringAnimation { - spring: 2 - damping: 0.2 - modulus: 360 - } - } - } - } - - Image { - anchors.centerIn: background - source: getWatchFaceImage("center.png") - } - - Text { - id: cityLabel - anchors.bottom: parent.bottom - anchors.bottomMargin: 2 - anchors.horizontalCenter: parent.horizontalCenter - - text: cityName - color: UIStyle.colorQtGray1 - font.pixelSize: UIStyle.fontSizeXS - font.letterSpacing: 2 - } - } -} diff --git a/examples/quickcontrols2/wearable/qml/WatchFace/WatchFacePage.qml b/examples/quickcontrols2/wearable/qml/WatchFace/WatchFacePage.qml deleted file mode 100644 index 33e6dcfb..00000000 --- a/examples/quickcontrols2/wearable/qml/WatchFace/WatchFacePage.qml +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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.7 -import QtQuick.Controls 2.0 as QQC2 -import "../Style" - -Item { - QQC2.SwipeView { - id: svWatchContainer - - anchors.fill: parent - currentIndex: 0 - - ListModel { - id: placesList - ListElement { - cityName: "New York" - timeShift: -4 - } - ListElement { - cityName: "London" - timeShift: 0 - } - ListElement { - cityName: "Oslo" - timeShift: 1 - } - ListElement { - cityName: "Mumbai" - timeShift: 5.5 - } - ListElement { - cityName: "Tokyo" - timeShift: 9 - } - ListElement { - cityName: "Brisbane" - timeShift: 10 - } - ListElement { - cityName: "Los Angeles" - timeShift: -8 - } - } - - Repeater { - model: placesList - delegate: Clock { - } - } - } - - QQC2.PageIndicator { - id: pgWatchIndicator - - anchors.bottom: svWatchContainer.bottom - anchors.bottomMargin: 1 - anchors.horizontalCenter: parent.horizontalCenter - - count: svWatchContainer.count - currentIndex: svWatchContainer.currentIndex - - delegate: Rectangle { - implicitWidth: 8 - implicitHeight: 8 - - radius: width / 2 - color: UIStyle.colorQtGray3 - - opacity: index === pgWatchIndicator.currentIndex ? 1.0 : 0.35 - - Behavior on opacity { - OpacityAnimator { - duration: 100 - } - } - } - } -} diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml b/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml new file mode 100644 index 00000000..7e30a371 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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.7 +import "../Style" + +Item { + id: clock + + width: UIStyle.visibleDiameter + height: UIStyle.visibleDiameter + + property int hours + property int minutes + property int seconds + property real shift: timeShift + property bool night: false + property bool internationalTime: true //Unset for local time + + function getWatchFaceImage(imageName) { + return "../../images/worldclock/" + imageName + } + + function timeChanged() { + var date = new Date + hours = internationalTime ? date.getUTCHours() + Math.floor( + clock.shift) : date.getHours() + night = (hours < 7 || hours > 19) + minutes = internationalTime ? + date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes() + seconds = date.getUTCSeconds() + } + + Timer { + interval: 100 + running: true + repeat: true + onTriggered: clock.timeChanged() + } + + Item { + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 2 + + width: 200 + height: 220 + + Rectangle { + color: clock.night ? UIStyle.colorQtGray1 : UIStyle.colorQtGray10 + radius: width / 2 + width: parent.width + height: parent.width + } + + Image { + id: background + source: getWatchFaceImage("swissdaydial.png") + visible: clock.night == false + } + Image { + source: getWatchFaceImage("swissnightdial.png") + visible: clock.night == true + } + + Image { + x: 92.5 + y: 27 + source: getWatchFaceImage(clock.night ? + "swissnighthour.png" + : "swissdayhour.png") + transform: Rotation { + id: hourRotation + origin.x: 7.5 + origin.y: 73 + angle: (clock.hours * 30) + (clock.minutes * 0.5) + Behavior on angle { + SpringAnimation { + spring: 2 + damping: 0.2 + modulus: 360 + } + } + } + } + + Image { + x: 93.5 + y: 17 + source: getWatchFaceImage(clock.night ? + "swissnightminute.png" + : "swissdayminute.png") + transform: Rotation { + id: minuteRotation + origin.x: 6.5 + origin.y: 83 + angle: clock.minutes * 6 + Behavior on angle { + SpringAnimation { + spring: 2 + damping: 0.2 + modulus: 360 + } + } + } + } + + Image { + x: 97.5 + y: 20 + source: getWatchFaceImage("second.png") + transform: Rotation { + id: secondRotation + origin.x: 2.5 + origin.y: 80 + angle: clock.seconds * 6 + Behavior on angle { + SpringAnimation { + spring: 2 + damping: 0.2 + modulus: 360 + } + } + } + } + + Image { + anchors.centerIn: background + source: getWatchFaceImage("center.png") + } + + Text { + id: cityLabel + anchors.bottom: parent.bottom + anchors.bottomMargin: 2 + anchors.horizontalCenter: parent.horizontalCenter + + text: cityName + color: UIStyle.colorQtGray1 + font.pixelSize: UIStyle.fontSizeXS + font.letterSpacing: 2 + } + } +} diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml b/examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml new file mode 100644 index 00000000..33e6dcfb --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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.7 +import QtQuick.Controls 2.0 as QQC2 +import "../Style" + +Item { + QQC2.SwipeView { + id: svWatchContainer + + anchors.fill: parent + currentIndex: 0 + + ListModel { + id: placesList + ListElement { + cityName: "New York" + timeShift: -4 + } + ListElement { + cityName: "London" + timeShift: 0 + } + ListElement { + cityName: "Oslo" + timeShift: 1 + } + ListElement { + cityName: "Mumbai" + timeShift: 5.5 + } + ListElement { + cityName: "Tokyo" + timeShift: 9 + } + ListElement { + cityName: "Brisbane" + timeShift: 10 + } + ListElement { + cityName: "Los Angeles" + timeShift: -8 + } + } + + Repeater { + model: placesList + delegate: Clock { + } + } + } + + QQC2.PageIndicator { + id: pgWatchIndicator + + anchors.bottom: svWatchContainer.bottom + anchors.bottomMargin: 1 + anchors.horizontalCenter: parent.horizontalCenter + + count: svWatchContainer.count + currentIndex: svWatchContainer.currentIndex + + delegate: Rectangle { + implicitWidth: 8 + implicitHeight: 8 + + radius: width / 2 + color: UIStyle.colorQtGray3 + + opacity: index === pgWatchIndicator.currentIndex ? 1.0 : 0.35 + + Behavior on opacity { + OpacityAnimator { + duration: 100 + } + } + } + } +} diff --git a/examples/quickcontrols2/wearable/wearable.qrc b/examples/quickcontrols2/wearable/wearable.qrc index a1099673..4469aea2 100644 --- a/examples/quickcontrols2/wearable/wearable.qrc +++ b/examples/quickcontrols2/wearable/wearable.qrc @@ -19,11 +19,11 @@ qml/Style/UIStyle.qml qml/Style/Slider.qml qml/Style/Switch.qml - qml/WatchFace/Clock.qml - qml/WatchFace/WatchFacePage.qml qml/Weather/weather.js qml/Weather/weather.json qml/Weather/WeatherPage.qml + qml/WorldClock/Clock.qml + qml/WorldClock/WorldClockPage.qml images/alarms/alarms.png images/background/HomeBackground.png images/back.png @@ -48,15 +48,6 @@ images/settings/contrast.png images/settings/settings.png images/settings/wifi.png - images/watchface/center.png - images/watchface/second.png - images/watchface/swissdaydial.png - images/watchface/swissdayhour.png - images/watchface/swissdayminute.png - images/watchface/swissnightdial.png - images/watchface/swissnighthour.png - images/watchface/swissnightminute.png - images/watchface/watch.png images/weather/humidity.png images/weather/pressure.png images/weather/sunrise.png @@ -64,5 +55,14 @@ images/weather/temperature.png images/weather/weather.png images/weather/wind.png + images/worldclock/center.png + images/worldclock/second.png + images/worldclock/swissdaydial.png + images/worldclock/swissdayhour.png + images/worldclock/swissdayminute.png + images/worldclock/swissnightdial.png + images/worldclock/swissnighthour.png + images/worldclock/swissnightminute.png + images/worldclock/watch.png -- cgit v1.2.3