diff options
Diffstat (limited to 'examples/quickcontrols2')
72 files changed, 2683 insertions, 1 deletions
diff --git a/examples/quickcontrols2/quickcontrols2.pro b/examples/quickcontrols2/quickcontrols2.pro index 3e145a41..858759fb 100644 --- a/examples/quickcontrols2/quickcontrols2.pro +++ b/examples/quickcontrols2/quickcontrols2.pro @@ -6,4 +6,5 @@ SUBDIRS += \ contactlist \ sidepanel \ swipetoremove \ - flatstyle + flatstyle \ + wearable diff --git a/examples/quickcontrols2/wearable/doc/images/qtquickcontrols2-wearable.png b/examples/quickcontrols2/wearable/doc/images/qtquickcontrols2-wearable.png Binary files differnew file mode 100644 index 00000000..e01b3687 --- /dev/null +++ b/examples/quickcontrols2/wearable/doc/images/qtquickcontrols2-wearable.png diff --git a/examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc b/examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc new file mode 100644 index 00000000..4ae3233c --- /dev/null +++ b/examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example wearable + \title Qt Quick Controls 2 - Wearable Demo + \ingroup qtquickcontrols2-examples + \brief A QML app using Qt Quick Controls 2 and demonstrating how to create a + collection of wearable sub-apps using custom QML screens. + + \image qtquickcontrols2-wearable.png + + The \e {Wearable} demo is a collection of sub-apps. Each sub-app is + contained within its own .qml file, and integrated into \c LauncherMain.qml. + The app demonstrates following \l {Qt Quick} features: + + \list + \li Using custom types to create screens and screen controls. + \li Using Qt Quick Controls 2 with namespace. + \li Using layout components such as \l [QML] Column and \l [QML] Row + \li Using XMLHttpRequest to load data from local files. + \li Using PathView, \l [QML] Path, PathAttribute, and PathLine types to + lay out UI elements. + \endlist + + \section1 Creating the Main Window + + In \c wearable.qml, we use an ApplicationWindow to create the main application + window: + + \quotefromfile wearable/wearable.qml + \skipto import "qml/Common" + \printuntil visible + + This ApplicationWindow embeds a container that uses StackView for holding + the launch screen for sub-apps. \c LauncherMain is an initial item on + the stack view that represents Launcher sub-app. This \c MainContainer also + has functionality to navigate back to home screen which is enabled when + additional app screens are loaded in the StackView + + \quotefromfile wearable/qml/MainContainer.qml + \skipto QQC2.StackView { + \printuntil initialItem: LauncherMain { + + In LauncherMain, we use a ListModel type with \l ListElement types defined + explicitly to hold information about the sub-apps: + List elements are defined like other QML types except that they contain a + collection of \e role definitions instead of properties. Roles define both + how the data is accessed and include the data itself. For each list element, + we use the \c icon role to specify the launch icon for the feature. + + \quotefromfile wearable/qml/LauncherMain.qml + \skipto ListModel + \printuntil page: "Settings/SettingsMain.qml" + \printuntil } + + \section1 Using Custom Types + + In the app, we use the following custom types that are each defined in a + separate .qml file: + + \list + \li \c WSlider.qml + \li \c WSwitch.qml + \endlist + + In each \c .qml file that uses the custom types, we add an import statement + to include a directory called \e Common where the types are located: + + \quotefromfile wearable/qml/Settings/SettingsMain.qml + \skipto Common + \printuntil " + + \section1 Main Screens for Sub-apps + + In the demo, we use the following custom screen types that are each + defined in a separate .qml file: + + \list + \li \c AlarmsMain.qml + \li \c FitnessMain.qml + \li \c NavigationMain.qml + \li \c NotificationsMain.qml + \li \c SettingsMain.qml + \li \c WatchFaceMain.qml + \li \c WeatherMain.qml + \li \c LauncherMain.qml + \endlist + + Each sub-app also has its own JavaScript functions file that contains + routines to help acquire data to be displayed on the screen. It also + contains functions to help manipulate or convert the data. In some sub-apps + data acquisition is implemented using XMLHttpRequest to read from local + files. These files were generated by storing responses from remote servers + in JSON format. This code can be easily modified to acquire data from remote + servers. + Sub-apps are implemented with an assumption of lack of any input capabilities + of the device and they can be further enhanced based on what input methods + or communication means are offered by the wearable device under consideration. + Sub-apps use SwipeView as a container to display a set of pages within the + app. + + \section1 Navigation App + + This sub-app displays a walking route from source to destination. This route + is obtained as a response by invoking an API provided by + \l {http://www.openstreetmap.org/}. The response is in JSON format and the + corresponding JavaScript file associated with the app helps interpret the + response. Currently, it is not possible to specify the source and destination + from within the app but it can be easily added based on the device's + capabilities. For example, user input could be implemented as screens with + input fields, or can be communicated over Bluetooth/Wifi from a paired app + running on another device such as a smart phone or PC. + + \section1 Weather App + + This sub-app displays weather information for a day including temperature, + sunrise-sunset info, air pressure, and so on. This information is obtained + as a response to invoking \l {https://openweathermap.org/}. The response is + in JSON format and the corresponding JavaScript file associated + with the app helps interpret the response. As with the Navigation sub-app + this app can be modified by adding screens to accept location information to + obtain weather data for a given location. + + \section1 WatchFace App + + This sub-app displays a world clock for different cities. As of now, the list + of cities is hard-coded in the app but that can be changed based on the + input capabilities of the device. + + \section1 Other Sub-apps + + Remaining sub-apps are implemented to return static data for now but they + can be easily modified to process response data obtained from respective + services. + + \include examples-run.qdocinc +*/ diff --git a/examples/quickcontrols2/wearable/images/back.png b/examples/quickcontrols2/wearable/images/back.png Binary files differnew file mode 100644 index 00000000..153162e7 --- /dev/null +++ b/examples/quickcontrols2/wearable/images/back.png diff --git a/examples/quickcontrols2/wearable/images/background.png b/examples/quickcontrols2/wearable/images/background.png Binary files differnew file mode 100644 index 00000000..1c6920e6 --- /dev/null +++ b/examples/quickcontrols2/wearable/images/background.png diff --git a/examples/quickcontrols2/wearable/images/home.png b/examples/quickcontrols2/wearable/images/home.png Binary files differnew file mode 100644 index 00000000..0d02f696 --- /dev/null +++ b/examples/quickcontrols2/wearable/images/home.png diff --git a/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml new file mode 100644 index 00000000..e07908ee --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** 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: svAlarmsContainer + + anchors.fill: parent + + Repeater { + model: ListModel { + ListElement { name: qsTr("Week Days"); state: true; time: "06:00 AM" } + ListElement { name: qsTr("Week Ends"); state: false; time: "07:30 AM" } + } + + Item { + Column { + spacing: 30 + anchors.centerIn: parent + + QQC2.Switch { + id: stateSwitch + checked: model.state + anchors.left: nameLabel.right + } + + Text { + text: model.time + anchors.horizontalCenter: parent.horizontalCenter + verticalAlignment: Text.AlignVCenter + height: UIStyle.fontSizeXL + font.bold: stateSwitch.checked + font.pixelSize: stateSwitch.checked ? UIStyle.fontSizeXL : UIStyle.fontSizeL + font.letterSpacing: 4 + color: UIStyle.colorQtGray1 + } + + Text { + id: nameLabel + text: model.name + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: UIStyle.fontSizeS + font.italic: true + font.bold: true + font.letterSpacing: 1 + color: UIStyle.colorQtGray2 + } + } + } + } + } + + QQC2.PageIndicator { + count: svAlarmsContainer.count + currentIndex: svAlarmsContainer.currentIndex + + anchors.bottom: svAlarmsContainer.bottom + anchors.horizontalCenter: parent.horizontalCenter + } +} diff --git a/examples/quickcontrols2/wearable/qml/Alarms/images/alarms.png b/examples/quickcontrols2/wearable/qml/Alarms/images/alarms.png Binary files differnew file mode 100644 index 00000000..00ec663e --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Alarms/images/alarms.png diff --git a/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml b/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml new file mode 100644 index 00000000..b3b0a0c5 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** 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 QQ2 +import "../Style" +import "fitness.js" as FitnessData + +Item { + QQ2.SwipeView { + id: svFitnessContainer + + anchors.fill: parent + + Item { + id: fitnessPage1 + + Column { + anchors.centerIn: parent + spacing: 15 + + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Steps: ") + FitnessData.getSteps() + font.italic: true + font.pixelSize: UIStyle.fontSizeM + color: UIStyle.colorQtGray1 + } + Image { + anchors.horizontalCenter: parent.horizontalCenter + source: "images/man-walking.png" + } + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Calories: ") + FitnessData.getCalories() + font.pixelSize: UIStyle.fontSizeS + font.italic: true + color: UIStyle.colorQtGray3 + } + } + } + + Item { + id: fitnessPage2 + + Column { + anchors.centerIn: parent + spacing: 15 + + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Distance: ") + + FitnessData.getDistance() + + qsTr(" miles") + font.italic: true + font.pixelSize: UIStyle.fontSizeM + color: UIStyle.colorQtGray1 + } + Image { + anchors.horizontalCenter: parent.horizontalCenter + source: "images/man-running.png" + } + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Time: ") + + FitnessData.getTime() + + qsTr(" mins") + font.pixelSize: UIStyle.fontSizeS + font.italic: true + color: UIStyle.colorQtGray3 + } + } + } + } + + QQ2.PageIndicator { + count: svFitnessContainer.count + currentIndex: svFitnessContainer.currentIndex + + anchors.bottom: svFitnessContainer.bottom + anchors.horizontalCenter: parent.horizontalCenter + } +} diff --git a/examples/quickcontrols2/wearable/qml/Fitness/fitness.js b/examples/quickcontrols2/wearable/qml/Fitness/fitness.js new file mode 100644 index 00000000..7e159e2a --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Fitness/fitness.js @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +function getSteps() { + return 105; +} + +function getCalories() { + return 150; +} + +function getDistance() { + return 10; +} + +function getTime() { + return "00:30"; +} diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/fitness.png b/examples/quickcontrols2/wearable/qml/Fitness/images/fitness.png Binary files differnew file mode 100644 index 00000000..a8789a61 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Fitness/images/fitness.png diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-running.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running.png Binary files differnew file mode 100644 index 00000000..5efab6e2 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running.png diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking.png Binary files differnew file mode 100644 index 00000000..01add534 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking.png diff --git a/examples/quickcontrols2/wearable/qml/LauncherPage.qml b/examples/quickcontrols2/wearable/qml/LauncherPage.qml new file mode 100644 index 00000000..6ff118df --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/LauncherPage.qml @@ -0,0 +1,192 @@ +/**************************************************************************** +** +** 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" + +PathView { + id: circularView + + signal launched(string page) + + readonly property int cX: width / 2 + readonly property int cY: height / 2 + readonly property int itemSize: size / 4 + readonly property int size: Math.min(width - 80, height) + readonly property int radius: size / 2 - itemSize / 3 + + snapMode: PathView.SnapToItem + + model: ListModel { + ListElement { + title: qsTr("World Clock") + icon: "WorldClock/images/watch.png" + page: "WorldClock/WorldClockPage.qml" + } + ListElement { + title: qsTr("Navigation") + icon: "Navigation/images/route.png" + page: "Navigation/NavigationPage.qml" + } + ListElement { + title: qsTr("Weather") + icon: "Weather/images/weather.png" + page: "Weather/WeatherPage.qml" + } + ListElement { + title: qsTr("Fitness") + icon: "Fitness/images/fitness.png" + page: "Fitness/FitnessPage.qml" + } + ListElement { + title: qsTr("Notifications") + icon: "Notifications/images/notifications.png" + page: "Notifications/NotificationsPage.qml" + } + ListElement { + title: qsTr("Alarm") + icon: "Alarms/images/alarms.png" + page: "Alarms/AlarmsPage.qml" + } + ListElement { + title: qsTr("Settings") + icon: "Settings/images/settings.png" + page: "Settings/SettingsPage.qml" + } + } + + delegate: QQC2.AbstractButton { + text: model.title + opacity: PathView.itemOpacity + + contentItem: Image { + source: model.icon + fillMode: Image.Pad + sourceSize.width: circularView.itemSize + sourceSize.height: circularView.itemSize + } + + background: Rectangle { + radius: width / 2 + color: "transparent" + + border.width: 3 + border.color: parent.PathView.isCurrentItem ? + "transparent" + : UIStyle.colorQtGray4 + } + + onClicked: { + if (PathView.isCurrentItem) + circularView.launched(Qt.resolvedUrl(page)) + else + circularView.currentIndex = index + } + } + + path: Path { + startX: circularView.cX + startY: circularView.cY + PathAttribute { + name: "itemOpacity" + value: 1.0 + } + PathLine { + x: circularView.cX + circularView.radius + y: circularView.cY + } + PathAttribute { + name: "itemOpacity" + value: 0.7 + } + PathArc { + x: circularView.cX - circularView.radius + y: circularView.cY + radiusX: circularView.radius + radiusY: circularView.radius + useLargeArc: true + direction: PathArc.Clockwise + } + PathAttribute { + name: "itemOpacity" + value: 0.5 + } + PathArc { + x: circularView.cX + circularView.radius + y: circularView.cY + radiusX: circularView.radius + radiusY: circularView.radius + useLargeArc: true + direction: PathArc.Clockwise + } + PathAttribute { + name: "itemOpacity" + value: 0.3 + } + } + + Text { + id: appTitle + + property Item currentItem: circularView.currentItem + + visible: currentItem ? currentItem.PathView.itemOpacity === 1.0 : 0 + + text: currentItem ? currentItem.text : "" + anchors.centerIn: parent + anchors.verticalCenterOffset: (circularView.itemSize + height) / 2 + + font.bold: true + font.pixelSize: circularView.itemSize / 3 + font.letterSpacing: 1 + color: UIStyle.colorQtGray1 + } +} diff --git a/examples/quickcontrols2/wearable/qml/NaviButton.qml b/examples/quickcontrols2/wearable/qml/NaviButton.qml new file mode 100644 index 00000000..7a8f7c14 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/NaviButton.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** 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" + +QQC2.AbstractButton { + id: button + + property int edge: Qt.TopEdge + property alias imageSource: image.source + + contentItem: Image { + id: image + fillMode: Image.Pad + sourceSize { width: 40; height: 40 } // ### TODO: resize the image + } + + background: Rectangle { + height: button.height * 4 + width: height + radius: width / 2 + + anchors.horizontalCenter: button.horizontalCenter + anchors.top: edge === Qt.BottomEdge ? button.top : undefined + anchors.bottom: edge === Qt.TopEdge ? button.bottom : undefined + + color: UIStyle.colorQtGray2 + } + + transform: Translate { + Behavior on y { NumberAnimation { } } + y: enabled ? 0 : edge === Qt.TopEdge ? -button.height : button.height + } +} diff --git a/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml new file mode 100644 index 00000000..bdc3e494 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** 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" +import "navigation.js" as NavigationData + +Item { + Column { + anchors.fill: parent + anchors.margins: 2 + spacing: 2 + + Rectangle { + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width + height: titleRow.height + + color: UIStyle.colorQtGray9 + + Row { + id: titleRow + spacing: 10 + anchors.centerIn: parent + + Image { + anchors.verticalCenter: parent.verticalCenter + source: "images/route.png" + fillMode: Image.PreserveAspectCrop + } + Text { + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Walking") + font.pixelSize: UIStyle.fontSizeM + font.letterSpacing: 2 + color: UIStyle.colorQtGray2 + } + } + } + + ListModel { + id: routeModel + } + + ListView { + id: routeView + + width: parent.width + height: parent.height - titleRow.height - parent.spacing + property var imageList: ["straight.png", + "leftturn.png", + "rightturn.png", + "uturn.png", + "start.png", + "end.png"] + + clip: true + focus: true + boundsBehavior: Flickable.StopAtBounds + snapMode: ListView.SnapToItem + model: routeModel + delegate: RouteElement { + width: routeView.width + height: routeView.height + } + } + } + Component.onCompleted: { + NavigationData.requestNavigationRoute(routeModel) + } +} diff --git a/examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml b/examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml new file mode 100644 index 00000000..79928012 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** 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" + +Rectangle { + color: UIStyle.colorQtGray8 + + Row { + spacing: 5 + width: parent.width - 80 + anchors.centerIn: parent + + Image { + id: img + anchors.verticalCenter: parent.verticalCenter + source: "images/" + navImage + fillMode: Image.PreserveAspectFit + } + + Column { + spacing: 5 + width: parent.width - img.width + anchors.verticalCenter: parent.verticalCenter + + Text { + width: parent.width + wrapMode: Text.WordWrap + text: navInstruction + font.pixelSize: UIStyle.fontSizeS + verticalAlignment: Text.AlignVCenter + padding: 1 + color: UIStyle.colorQtGray1 + } + + Text { + width: parent.width + wrapMode: Text.WordWrap + text: navAuxInfo + font.pixelSize: UIStyle.fontSizeXS + verticalAlignment: Text.AlignVCenter + padding: 1 + color: UIStyle.colorQtGray2 + } + } + } +} diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/end.png b/examples/quickcontrols2/wearable/qml/Navigation/images/end.png Binary files differnew file mode 100644 index 00000000..3006c0f3 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/images/end.png diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn.png b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn.png Binary files differnew file mode 100644 index 00000000..3c416304 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn.png diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/marker.png b/examples/quickcontrols2/wearable/qml/Navigation/images/marker.png Binary files differnew file mode 100644 index 00000000..3006c0f3 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/images/marker.png diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn.png b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn.png Binary files differnew file mode 100644 index 00000000..a29ec694 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn.png diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/route.png b/examples/quickcontrols2/wearable/qml/Navigation/images/route.png Binary files differnew file mode 100644 index 00000000..b8ac9d7e --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/images/route.png diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/start.png b/examples/quickcontrols2/wearable/qml/Navigation/images/start.png Binary files differnew file mode 100644 index 00000000..1adf0ac8 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/images/start.png diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/straight.png b/examples/quickcontrols2/wearable/qml/Navigation/images/straight.png Binary files differnew file mode 100644 index 00000000..e3c5bb5c --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/images/straight.png diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/uturn.png b/examples/quickcontrols2/wearable/qml/Navigation/images/uturn.png Binary files differnew file mode 100644 index 00000000..b6917f67 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/images/uturn.png diff --git a/examples/quickcontrols2/wearable/qml/Navigation/navigation.js b/examples/quickcontrols2/wearable/qml/Navigation/navigation.js new file mode 100644 index 00000000..0414731d --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/navigation.js @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +function requestNavigationRoute(rModel) { + var xhr = new XMLHttpRequest; + xhr.open("GET", "walk_route.json"); + xhr.onreadystatechange = function () { + if (xhr.readyState === XMLHttpRequest.DONE) { + var a = JSON.parse(xhr.responseText); + var steps = a.routes[0].legs[0].steps; + + for (var step in steps) { + var maneuver = steps[step].maneuver; + var duration = steps[step].duration; + var distance = steps[step].distance; + + rModel.append({ + navInstruction: maneuver.instruction, + navImage: getNavigationImage( + maneuver.type, + maneuver.modifier, + routeView.imageList), + navAuxInfo: getAuxInfo(distance, + duration) + }); + } + } + } + xhr.send(); +} + +function getNavigationImage(maneuverType, maneuverModifier, imageList) { + var imageToReturn; + if (maneuverType === "depart") { + imageToReturn = imageList[4]; + } else if (maneuverType === "arrive") { + imageToReturn = imageList[5]; + } else if (maneuverType === "turn") { + if (maneuverModifier.search("left") >= 0) + imageToReturn = imageList[1]; + else if (maneuverModifier.search("right") >= 0) + imageToReturn = imageList[2]; + else + imageToReturn = imageList[0]; + } else { + if (maneuverModifier === "uturn") { + imageToReturn = imageList[3]; + } else { + imageToReturn = imageList[0]; + } + } + + return imageToReturn; +} + +function getAuxInfo(distInMeters, timeInSecs) { + var distance = convertDistance(distInMeters); + if (distance.length > 0) + return "Distance: " + distance + "\nTime: " + formatSeconds( + timeInSecs); + else + return ""; +} + +function convertDistance(meter) { + var dist = ""; + var feet = (meter * 0.3048).toPrecision(6); + var miles = (meter * 0.000621371).toPrecision(6); + + if (Math.floor(miles) > 1) { + dist += Math.floor(miles) + " mi"; + feet = ((miles - Math.floor(miles)) * 0.3048).toPrecision(6); + } + if (Math.floor(feet) > 1) + dist += Math.floor(feet) + " ft"; + + return dist +} + +function formatSeconds(seconds) { + var date = new Date(1970, 0, 1); + date.setSeconds(seconds); + return date.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); +} diff --git a/examples/quickcontrols2/wearable/qml/Navigation/walk_route.json b/examples/quickcontrols2/wearable/qml/Navigation/walk_route.json new file mode 100644 index 00000000..e69b5cc1 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Navigation/walk_route.json @@ -0,0 +1 @@ +{"routes":[{"legs":[{"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[144],"location":[-122.394553,37.795984]},{"out":1,"location":[-122.393896,37.795268],"bearings":[60,150,225,330],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.393179,37.79453],"bearings":[60,135,180,225,315],"entry":[true,true,true,true,false],"in":4},{"out":1,"location":[-122.393072,37.79443],"bearings":[45,135,225,315],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.392787,37.79415],"bearings":[60,135,315],"entry":[true,true,false],"in":2},{"out":1,"location":[-122.392537,37.793915],"bearings":[45,135,225,315],"entry":[true,true,true,false],"in":3},{"out":0,"location":[-122.392448,37.793831],"bearings":[135,225,315],"entry":[true,true,false],"in":2}],"geometry":"{_ueF|d`jVRQdB}ARQh@g@XUVWVW^a@RUv@w@l@q@PQNQ","maneuver":{"bearing_after":144,"location":[-122.394553,37.795984],"bearing_before":0,"type":"depart","instruction":"Head southeast on The Embarcadero"},"duration":230.8,"distance":314.8,"name":"The Embarcadero","mode":"walking"},{"intersections":[{"out":2,"location":[-122.392361,37.793748],"bearings":[45,135,225,315],"entry":[true,true,true,false],"in":3}],"geometry":"}qteFfw_jVHJBDHJ","maneuver":{"bearing_after":225,"type":"turn","modifier":"right","bearing_before":140,"location":[-122.392361,37.793748],"instruction":"Turn right"},"duration":13.2,"distance":18.5,"name":"","mode":"walking"},{"intersections":[{"out":1,"location":[-122.39251,37.793631],"bearings":[45,135,225,315],"entry":[false,true,true,true],"in":0},{"out":1,"location":[-122.391284,37.792459],"bearings":[45,150,225,330],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.391217,37.792342],"bearings":[45,165,225,330],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.391165,37.792231],"bearings":[45,165,225,345],"entry":[true,true,true,false],"in":3},{"out":0,"location":[-122.390884,37.791536],"bearings":[150,285,345],"entry":[true,true,false],"in":2},{"out":1,"location":[-122.390254,37.790827],"bearings":[45,135,210,315],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.390144,37.790745],"bearings":[45,135,225,315],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.390038,37.790665],"bearings":[45,135,240,315],"entry":[true,true,true,false],"in":3},{"out":0,"location":[-122.389245,37.790036],"bearings":[135,225,315],"entry":[true,true,false],"in":2},{"out":1,"location":[-122.38871,37.789596],"bearings":[45,150,210,315],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.388618,37.789494],"bearings":[45,150,225,330],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.388527,37.789394],"bearings":[45,150,225,330],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.388005,37.787907],"bearings":[0,180,270],"entry":[false,true,true],"in":0},{"out":1,"location":[-122.387985,37.787622],"bearings":[0,180,240],"entry":[false,true,true],"in":0},{"out":2,"location":[-122.388005,37.787197],"bearings":[0,90,180,270],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.388015,37.787093],"bearings":[0,90,180,270],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.388022,37.786994],"bearings":[0,90,180,285],"entry":[false,true,true,true],"in":0},{"out":1,"location":[-122.388163,37.785186],"bearings":[0,180,315],"entry":[false,true,true],"in":0},{"out":1,"location":[-122.388184,37.784944],"bearings":[0,180,315],"entry":[false,true,true],"in":0},{"out":2,"location":[-122.388191,37.784855],"bearings":[0,90,180,270],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.388198,37.784748],"bearings":[0,90,180,270],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.388207,37.784633],"bearings":[0,90,180,270],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.388309,37.783373],"bearings":[0,60,180,270],"entry":[false,true,true,true],"in":0},{"out":1,"location":[-122.388376,37.782545],"bearings":[0,180,315],"entry":[false,true,true],"in":0},{"out":1,"location":[-122.388394,37.782316],"bearings":[0,180,315],"entry":[false,true,true],"in":0}],"geometry":"eqteFdx_jVf@k@\\a@|@iAV[FGJMPOTOPKDAPITItAa@r@WXOXQXSTUTWRYNUNS|B}CdAwAPSTQRQ\\W^Q\\KZIrB]^EPCH?\\CZ?Z?\\?XBT@R?~IZF?H@f@@N@T@V@zFRbDLl@@pADV@","maneuver":{"bearing_after":139,"type":"turn","modifier":"left","bearing_before":226,"location":[-122.39251,37.793631],"instruction":"Turn left onto The Embarcadero"},"duration":1055.9,"distance":1450.3,"name":"The Embarcadero","mode":"walking"},{"intersections":[{"out":2,"location":[-122.388431,37.781791],"bearings":[0,90,180,285],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.389672,37.779922],"bearings":[45,135,225,315],"entry":[false,true,true,true],"in":0},{"out":1,"location":[-122.390803,37.77905],"bearings":[45,225,315],"entry":[false,true,true],"in":0},{"out":2,"location":[-122.391916,37.778155],"bearings":[45,135,225,315],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.393073,37.777251],"bearings":[45,75,225,315],"entry":[false,true,true,true],"in":0}],"geometry":"egreFt~~iVR@bABXDVDXHVNXNXVVZp@|@z@hAnCvDLRNTHLFJbArAzApBdB`CTZZb@\\b@@@pCvD","maneuver":{"bearing_after":183,"type":"new name","modifier":"straight","bearing_before":183,"location":[-122.388431,37.781791],"instruction":"Continue straight onto King Street"},"duration":567.4,"distance":782.5,"name":"King Street","mode":"walking"},{"intersections":[{"out":3,"location":[-122.394003,37.776513],"bearings":[45,135,225,300],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.394218,37.776486],"bearings":[45,135,225,315],"entry":[false,true,true,true],"in":0}],"geometry":"efqeFna`jVGJ?NJNNR","maneuver":{"bearing_after":313,"type":"turn","modifier":"straight","bearing_before":225,"location":[-122.394003,37.776513],"instruction":"Go straight"},"duration":26.1,"distance":36.2,"name":"","mode":"walking"},{"intersections":[{"out":2,"location":[-122.394321,37.776405],"bearings":[45,180,315],"entry":[false,true,true],"in":0},{"out":1,"location":[-122.394729,37.776487],"bearings":[45,180],"entry":[false,true],"in":0}],"geometry":"qeqeFnc`jVe@p@A@V\\DF","maneuver":{"bearing_after":315,"type":"turn","modifier":"right","bearing_before":225,"location":[-122.394321,37.776405],"instruction":"Turn right"},"duration":39.9,"distance":55.6,"name":"","mode":"walking"},{"intersections":[{"in":0,"entry":[true],"bearings":[45],"location":[-122.394768,37.776455]}],"geometry":"{eqeFhf`jV","maneuver":{"bearing_after":0,"type":"arrive","modifier":"straight","bearing_before":225,"location":[-122.394729,37.776487],"instruction":"You have arrived at your destination, straight ahead"},"duration":0,"distance":0,"name":"","mode":"walking"}],"summary":"The Embarcadero, King Street","duration":1933.3,"distance":2657.8}],"geometry":"{_ueF|d`jV|LuLV\\`EyElHaD~I_LvB_AdGk@he@|AbBd@bZl`@R~@g@r@\\d@","duration":1933.3,"distance":2657.8}],"waypoints":[{"name":"The Embarcadero","location":[-122.394553,37.795984]},{"name":"","location":[-122.394768,37.776455]}],"code":"Ok"} diff --git a/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml b/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml new file mode 100644 index 00000000..d5bec2f8 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** 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" +import "notifications.js" as NotificationData + +ListView { + id: missedCallsView + + clip: true + focus: true + boundsBehavior: Flickable.StopAtBounds + snapMode: ListView.SnapToItem + + model: ListModel { + id: missedCallsList + } + + Image { + id: missedCallIcon + width: parent.width / 2 + anchors.right: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + source: "images/missedcall.png" + fillMode: Image.Pad + } + + delegate: Item { + height: missedCallsView.height + width: missedCallsView.width / 2 + anchors.left: parent.horizontalCenter + + Column { + spacing: 15 + anchors.verticalCenter: parent.verticalCenter + + Image { + anchors.horizontalCenter: parent.horizontalCenter + source: qsTr("images/avatar%1.png").arg(model.gender) + } + + Text { + text: model.name + anchors.horizontalCenter: parent.horizontalCenter + font.bold: true + font.pixelSize: UIStyle.fontSizeS + color: UIStyle.colorQtGray1 + } + + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: date + " " + time + font.pixelSize: UIStyle.fontSizeXS + font.italic: true + color: UIStyle.colorQtGray2 + } + } + } + + Component.onCompleted: { + NotificationData.populateData(missedCallsList) + } +} diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf.png Binary files differnew file mode 100644 index 00000000..c88edc60 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf.png diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm.png Binary files differnew file mode 100644 index 00000000..f7abb4c9 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm.png diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall.png b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall.png Binary files differnew file mode 100644 index 00000000..d05f17b3 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall.png diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/notifications.png b/examples/quickcontrols2/wearable/qml/Notifications/images/notifications.png Binary files differnew file mode 100644 index 00000000..c5c3ffb2 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Notifications/images/notifications.png diff --git a/examples/quickcontrols2/wearable/qml/Notifications/notifications.js b/examples/quickcontrols2/wearable/qml/Notifications/notifications.js new file mode 100644 index 00000000..8716c56f --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Notifications/notifications.js @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +function populateData(listData) { + listData.append({ + name: "John Doe", + gender: "m", + date: "02/15/2017", + time: "09:20 am" + }); + + listData.append({ + name: "Jane Worldege", + gender: "f", + date: "02/06/2017", + time: "10:15 am" + }); + + listData.append({ + name: "Jennifer Wang", + gender: "f", + date: "02/03/2017", + time: "05:16 pm" + }); +} diff --git a/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml b/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml new file mode 100644 index 00000000..48f3a3d6 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** 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 Qt.labs.settings 1.0 +import "../Style" + +Item { + + Settings { + id: settings + property alias wireless: wirelessSwitch.checked + property alias bluetooth: bluetoothSwitch.checked + property alias contrast: contrastSlider.value + property alias brightness: brightnessSlider.value + } + + QQC2.SwipeView { + id: svSettingsContainer + + anchors.fill: parent + + Item { + id: settingsPage1 + + Column { + anchors.centerIn: parent + spacing: 25 + + Row { + spacing: 50 + Image { + anchors.verticalCenter: parent.verticalCenter + source: "images/bluetooth.png" + } + QQC2.Switch { + id: bluetoothSwitch + anchors.verticalCenter: parent.verticalCenter + checked: settings.bluetooth + } + } + Row { + spacing: 50 + Image { + anchors.verticalCenter: parent.verticalCenter + source: "images/wifi.png" + } + QQC2.Switch { + id: wirelessSwitch + anchors.verticalCenter: parent.verticalCenter + checked: settings.wireless + } + } + } + } + + Item { + id: settingsPage2 + + Column { + anchors.centerIn: parent + spacing: 2 + + Column { + Image { + anchors.horizontalCenter: parent.horizontalCenter + source: "images/brightness.png" + } + QQC2.Slider { + id: brightnessSlider + anchors.horizontalCenter: parent.horizontalCenter + from: 0 + to: 5 + stepSize: 1 + value: settings.brightness + } + } + Column { + spacing: 2 + Image { + anchors.horizontalCenter: parent.horizontalCenter + source: "images/contrast.png" + } + QQC2.Slider { + id: contrastSlider + anchors.horizontalCenter: parent.horizontalCenter + from: 0 + to: 10 + stepSize: 1 + value: settings.contrast + } + } + } + } + } + + QQC2.PageIndicator { + count: svSettingsContainer.count + currentIndex: svSettingsContainer.currentIndex + + anchors.bottom: svSettingsContainer.bottom + anchors.horizontalCenter: parent.horizontalCenter + } +} diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth.png b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth.png Binary files differnew file mode 100644 index 00000000..2b2d0e7e --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth.png diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/brightness.png b/examples/quickcontrols2/wearable/qml/Settings/images/brightness.png Binary files differnew file mode 100644 index 00000000..846a896c --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Settings/images/brightness.png diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/contrast.png b/examples/quickcontrols2/wearable/qml/Settings/images/contrast.png Binary files differnew file mode 100644 index 00000000..eb528eb8 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Settings/images/contrast.png diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/settings.png b/examples/quickcontrols2/wearable/qml/Settings/images/settings.png Binary files differnew file mode 100644 index 00000000..c42f7dc6 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Settings/images/settings.png diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/wifi.png b/examples/quickcontrols2/wearable/qml/Settings/images/wifi.png Binary files differnew file mode 100644 index 00000000..42c92516 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Settings/images/wifi.png diff --git a/examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml b/examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml new file mode 100644 index 00000000..6a92c42f --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** 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.Templates 2.0 as T +import "." + +T.PageIndicator { + id: control + + implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding + implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding + + spacing: 6 + padding: 6 + bottomPadding: 7 + + delegate: Rectangle { + implicitWidth: 8 + implicitHeight: 8 + + radius: width / 2 + color: UIStyle.colorQtGray3 + + opacity: index === control.currentIndex ? 1.0 : 0.35 + + Behavior on opacity { + OpacityAnimator { + duration: 100 + } + } + } + + contentItem: Row { + spacing: control.spacing + + Repeater { + model: control.count + delegate: control.delegate + } + } +} diff --git a/examples/quickcontrols2/wearable/qml/Style/Slider.qml b/examples/quickcontrols2/wearable/qml/Style/Slider.qml new file mode 100644 index 00000000..86f28abe --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Style/Slider.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** 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.Templates 2.0 as T +import "." + +T.Slider { + id: control + + implicitWidth: 200 + implicitHeight: 26 + + handle: Rectangle { + x: control.visualPosition * (control.width - width) + y: (control.height - height) / 2 + width: 20 + height: 15 + + radius: 5 + color: control.pressed ? "#f0f0f0" : "#f6f6f6" + border.color: UIStyle.colorQtGray7 + } + + background: Rectangle { + y: (control.height - height) / 2 + height: 4 + radius: 2 + color: UIStyle.colorQtGray3 + + Rectangle { + width: control.visualPosition * parent.width + height: parent.height + color: UIStyle.colorQtAuxGreen2 + radius: 2 + } + } +} + diff --git a/examples/quickcontrols2/wearable/qml/Style/Switch.qml b/examples/quickcontrols2/wearable/qml/Style/Switch.qml new file mode 100644 index 00000000..a1dad07a --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Style/Switch.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** 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.Templates 2.0 as T +import "." + +T.Switch { + id: control + + implicitWidth: 48 + implicitHeight: 26 + + indicator: Rectangle { + x: control.visualPosition * (control.width - width) + y: (control.height - height) / 2 + width: 26 + height: 26 + + radius: 13 + color: control.down ? UIStyle.colorQtGray6 : UIStyle.colorQtGray10 + border.color: !control.checked ? "#999999" + : (control.down ? UIStyle.colorQtAuxGreen2 + : UIStyle.colorQtAuxGreen1) + + Behavior on x { + enabled: !control.pressed + SmoothedAnimation { velocity: 200 } + } + } + + background: Rectangle { + radius: 13 + color: control.checked ? UIStyle.colorQtAuxGreen2 : "#E6173D" + border.color: control.checked ? UIStyle.colorQtAuxGreen2 + : UIStyle.colorQtGray6 + } +} + diff --git a/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml b/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml new file mode 100644 index 00000000..98971233 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** 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 + +pragma Singleton + +QtObject { + id: uiStyle + + // Font Sizes + readonly property int fontSizeXXS: 10 + readonly property int fontSizeXS: 15 + readonly property int fontSizeS: 20 + readonly property int fontSizeM: 25 + readonly property int fontSizeL: 30 + readonly property int fontSizeXL: 35 + readonly property int fontSizeXXL: 40 + + // Color Scheme + // Green + readonly property color colorQtPrimGreen: "#41cd52" + readonly property color colorQtAuxGreen1: "#21be2b" + readonly property color colorQtAuxGreen2: "#17a81a" + + // Gray + readonly property color colorQtGray1: "#09102b" + readonly property color colorQtGray2: "#222840" + readonly property color colorQtGray3: "#3a4055" + readonly property color colorQtGray4: "#53586b" + readonly property color colorQtGray5: "#53586b" + readonly property color colorQtGray6: "#848895" + readonly property color colorQtGray7: "#9d9faa" + readonly property color colorQtGray8: "#b5b7bf" + readonly property color colorQtGray9: "#cecfd5" + readonly property color colorQtGray10: "#f3f3f4" +} diff --git a/examples/quickcontrols2/wearable/qml/Style/qmldir b/examples/quickcontrols2/wearable/qml/Style/qmldir new file mode 100644 index 00000000..a04072be --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Style/qmldir @@ -0,0 +1 @@ +singleton UIStyle 1.0 UIStyle.qml diff --git a/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml b/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml new file mode 100644 index 00000000..2ef0133c --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml @@ -0,0 +1,296 @@ +/**************************************************************************** +** +** 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" +import "weather.js" as WeatherData + +Item { + QQC2.SwipeView { + id: svWeatherContainer + + anchors.fill: parent + + Item { + id: weatherPage1 + + Row { + anchors.centerIn: parent + spacing: 2 + + Image { + anchors.verticalCenter: parent.verticalCenter + source: "images/temperature.png" + } + + Column { + anchors.verticalCenter: parent.verticalCenter + spacing: 40 + + Text { + text: (wDataCntr.weatherData + && wDataCntr.weatherData.main + && wDataCntr.weatherData.main.temp) ? + qsTr("Avg: ") + + String(wDataCntr.weatherData.main.temp) + + " °F" : "N/A" + font.pixelSize: UIStyle.fontSizeM + font.letterSpacing: 1 + color: UIStyle.colorQtGray1 + } + + Text { + text: (wDataCntr.weatherData + && wDataCntr.weatherData.main + && wDataCntr.weatherData.main.temp_min) ? + qsTr("Min: ") + + String(wDataCntr.weatherData.main.temp_min) + + " °F" : "N/A" + font.pixelSize: UIStyle.fontSizeM + font.letterSpacing: 1 + color: UIStyle.colorQtGray1 + } + + Text { + text: (wDataCntr.weatherData + && wDataCntr.weatherData.main + && wDataCntr.weatherData.main.temp_max) ? + qsTr("Max: ") + + String(wDataCntr.weatherData.main.temp_max) + + " °F " : "N/A" + font.pixelSize: UIStyle.fontSizeM + font.letterSpacing: 1 + color: UIStyle.colorQtGray1 + } + } + } + } + + Item { + id: weatherPage2 + + Column { + spacing: 40 + anchors.centerIn: parent + + Row { + spacing: 20 + anchors.horizontalCenter: parent.horizontalCenter + + Image { + id: wImg + anchors.verticalCenter: parent.verticalCenter + source: "images/wind.png" + } + + Text { + anchors.verticalCenter: parent.verticalCenter + text: (wDataCntr.weatherData + && wDataCntr.weatherData.wind + && wDataCntr.weatherData.wind.speed) ? + String(wDataCntr.weatherData.wind.speed) + + " mph" : "N/A" + font.pixelSize: UIStyle.fontSizeM + font.letterSpacing: 1 + color: UIStyle.colorQtGray1 + } + } + + Row { + spacing: 20 + anchors.horizontalCenter: parent.horizontalCenter + + Image { + id: hImg + anchors.verticalCenter: parent.verticalCenter + source: "images/humidity.png" + } + + Text { + anchors.verticalCenter: parent.verticalCenter + text: (wDataCntr.weatherData + && wDataCntr.weatherData.main + && wDataCntr.weatherData.main.humidity) ? + String(wDataCntr.weatherData.main.humidity) + + " %" : "N/A" + font.pixelSize: UIStyle.fontSizeM + font.letterSpacing: 1 + color: UIStyle.colorQtGray1 + } + } + } + } + + Item { + id: weatherPage3 + + Row { + anchors.centerIn: parent + spacing: 10 + + Image { + anchors.verticalCenter: parent.verticalCenter + source: "images/pressure.png" + } + + Column { + anchors.verticalCenter: parent.verticalCenter + spacing: 40 + + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: (wDataCntr.weatherData + && wDataCntr.weatherData.main + && wDataCntr.weatherData.main.pressure) ? + String(wDataCntr.weatherData.main.pressure) + + " hPa" : "N/A" + font.pixelSize: UIStyle.fontSizeM + font.letterSpacing: 1 + color: UIStyle.colorQtGray1 + } + + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: (wDataCntr.weatherData + && wDataCntr.weatherData.main + && wDataCntr.weatherData.main.sea_level) ? + String(wDataCntr.weatherData.main.sea_level) + + " hPa" : "N/A" + font.pixelSize: UIStyle.fontSizeM + font.letterSpacing: 1 + color: UIStyle.colorQtGray1 + } + + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: (wDataCntr.weatherData + && wDataCntr.weatherData.main + && wDataCntr.weatherData.main.grnd_level) ? + String(wDataCntr.weatherData.main.grnd_level) + + " hPa" : "N/A" + font.pixelSize: UIStyle.fontSizeM + font.letterSpacing: 1 + color: UIStyle.colorQtGray1 + } + } + } + } + + Item { + id: weatherPage4 + + Column { + spacing: 40 + anchors.centerIn: parent + + Row { + spacing: 30 + anchors.horizontalCenter: parent.horizontalCenter + + Image { + anchors.verticalCenter: parent.verticalCenter + source: "images/sunrise.png" + } + + Text { + anchors.verticalCenter: parent.verticalCenter + text: (wDataCntr.weatherData + && wDataCntr.weatherData.sys + && wDataCntr.weatherData.sys.sunrise) ? + WeatherData.getTimeHMS(wDataCntr.weatherData.sys.sunrise) + : "N/A" + font.pixelSize: UIStyle.fontSizeM + font.letterSpacing: 1 + color: UIStyle.colorQtGray1 + } + } + + Row { + spacing: 30 + anchors.horizontalCenter: parent.horizontalCenter + + Image { + anchors.verticalCenter: parent.verticalCenter + source: "images/sunset.png" + } + + Text { + anchors.verticalCenter: parent.verticalCenter + text: (wDataCntr.weatherData + && wDataCntr.weatherData.sys + && wDataCntr.weatherData.sys.sunset) ? + WeatherData.getTimeHMS(wDataCntr.weatherData.sys.sunset) + : "N/A" + font.pixelSize: UIStyle.fontSizeM + font.letterSpacing: 1 + color: UIStyle.colorQtGray1 + } + } + } + } + } + + QtObject { + id: wDataCntr + property var weatherData + } + + QQC2.PageIndicator { + count: svWeatherContainer.count + currentIndex: svWeatherContainer.currentIndex + + anchors.bottom: svWeatherContainer.bottom + anchors.horizontalCenter: parent.horizontalCenter + } + Component.onCompleted: { + WeatherData.requestWeatherData(wDataCntr) + } +} diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/humidity.png b/examples/quickcontrols2/wearable/qml/Weather/images/humidity.png Binary files differnew file mode 100644 index 00000000..ef9ed9de --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Weather/images/humidity.png diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/pressure.png b/examples/quickcontrols2/wearable/qml/Weather/images/pressure.png Binary files differnew file mode 100644 index 00000000..7850609e --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Weather/images/pressure.png diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunrise.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise.png Binary files differnew file mode 100644 index 00000000..70a9a969 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise.png diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunset.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunset.png Binary files differnew file mode 100644 index 00000000..01bb9ec8 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunset.png diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/temperature.png b/examples/quickcontrols2/wearable/qml/Weather/images/temperature.png Binary files differnew file mode 100644 index 00000000..5d7faa99 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Weather/images/temperature.png diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/weather.png b/examples/quickcontrols2/wearable/qml/Weather/images/weather.png Binary files differnew file mode 100644 index 00000000..0530d47b --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Weather/images/weather.png diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/wind.png b/examples/quickcontrols2/wearable/qml/Weather/images/wind.png Binary files differnew file mode 100644 index 00000000..c728fcc0 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Weather/images/wind.png diff --git a/examples/quickcontrols2/wearable/qml/Weather/weather.js b/examples/quickcontrols2/wearable/qml/Weather/weather.js new file mode 100644 index 00000000..b3bf4465 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Weather/weather.js @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +function requestWeatherData(cntr) { + var xhr = new XMLHttpRequest; + xhr.open("GET", "weather.json"); + xhr.onreadystatechange = function () { + if (xhr.readyState === XMLHttpRequest.DONE) { + cntr.weatherData = JSON.parse(xhr.responseText) + } + } + xhr.send(); +} + +function getTimeHMS(utcTime) { + var date = new Date(utcTime * 1000); + // Hours part from the timestamp + var hours = date.getHours(); + var ampm = Math.floor((hours / 12)) ? " PM" : " AM"; + hours = (hours % 12); + + // Minutes part from the timestamp + var minutes = "0" + date.getMinutes(); + // Seconds part from the timestamp + var seconds = "0" + date.getSeconds(); + + // Will display time in 10:30:23 format + return hours % 12 + ':' + minutes.substr(-2) + ':' + seconds.substr(-2) + + ampm; +} diff --git a/examples/quickcontrols2/wearable/qml/Weather/weather.json b/examples/quickcontrols2/wearable/qml/Weather/weather.json new file mode 100644 index 00000000..2cce95c6 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/Weather/weather.json @@ -0,0 +1 @@ +{"coord":{"lon":-122.42,"lat":37.77},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"base":"stations","main":{"temp":45.22,"pressure":1020.17,"humidity":88,"temp_min":36.92,"temp_max":58.92,"sea_level":1028.19,"grnd_level":1020.17},"wind":{"speed":6.73,"deg":201.002},"clouds":{"all":68},"dt":1476412232,"sys":{"message":0.012,"country":"US","sunrise":1476454666,"sunset":1476495156},"id":5391959,"name":"San Francisco","cod":200} diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml b/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml new file mode 100644 index 00000000..a6e67e8c --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** 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 + + 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/" + 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.centerIn: parent + + 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..cdf96bf2 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** 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 + + 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 { + count: svWatchContainer.count + currentIndex: svWatchContainer.currentIndex + + anchors.bottom: svWatchContainer.bottom + anchors.horizontalCenter: parent.horizontalCenter + } +} diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/center.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/center.png Binary files differnew file mode 100644 index 00000000..7fbd802a --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/center.png diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/clock-night.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/clock-night.png Binary files differnew file mode 100644 index 00000000..698f57a5 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/clock-night.png diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/clock.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/clock.png Binary files differnew file mode 100644 index 00000000..6e1c6eed --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/clock.png diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/second.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/second.png Binary files differnew file mode 100644 index 00000000..eee07efb --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/second.png diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdaydial.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdaydial.png Binary files differnew file mode 100644 index 00000000..64136618 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdaydial.png diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayhour.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayhour.png Binary files differnew file mode 100644 index 00000000..255985d2 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayhour.png diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayminute.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayminute.png Binary files differnew file mode 100644 index 00000000..bc6992f8 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayminute.png diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightdial.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightdial.png Binary files differnew file mode 100644 index 00000000..e2590af4 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightdial.png diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnighthour.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnighthour.png Binary files differnew file mode 100644 index 00000000..1c6a6131 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnighthour.png diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightminute.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightminute.png Binary files differnew file mode 100644 index 00000000..3353ba2c --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightminute.png diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissseconds.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissseconds.png Binary files differnew file mode 100644 index 00000000..66b4f3fa --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissseconds.png diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/watch.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/watch.png Binary files differnew file mode 100644 index 00000000..299858b7 --- /dev/null +++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/watch.png diff --git a/examples/quickcontrols2/wearable/wearable.cpp b/examples/quickcontrols2/wearable/wearable.cpp new file mode 100644 index 00000000..5f96caf4 --- /dev/null +++ b/examples/quickcontrols2/wearable/wearable.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QQuickStyle> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQuickStyle::setStyle(QStringLiteral("qrc:/qml/Style")); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/wearable.qml"))); + + return app.exec(); +} diff --git a/examples/quickcontrols2/wearable/wearable.pro b/examples/quickcontrols2/wearable/wearable.pro new file mode 100644 index 00000000..8d55e44e --- /dev/null +++ b/examples/quickcontrols2/wearable/wearable.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +TARGET = wearable +QT += quick quickcontrols2 + +SOURCES += \ + wearable.cpp + +RESOURCES += \ + wearable.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/wearable +INSTALLS += target diff --git a/examples/quickcontrols2/wearable/wearable.qml b/examples/quickcontrols2/wearable/wearable.qml new file mode 100644 index 00000000..01d52b12 --- /dev/null +++ b/examples/quickcontrols2/wearable/wearable.qml @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** 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 "qml" +import "qml/Style" + +QQC2.ApplicationWindow { + id: window + + visible: true + + width: 320 + height: 320 + + title: qsTr("Wearable") + + background: Image { + source: "images/background.png" + } + + header: NaviButton { + id: homeButton + + edge: Qt.TopEdge + enabled: stackView.depth > 1 + imageSource: "images/home.png" + + onClicked: stackView.pop(null) + } + + footer: NaviButton { + id: backButton + + edge: Qt.BottomEdge + enabled: stackView.depth > 1 + imageSource: "images/back.png" + + onClicked: stackView.pop() + } + + QQC2.StackView { + id: stackView + + focus: true + anchors.fill: parent + + initialItem: LauncherPage { + onLaunched: stackView.push(page) + } + } +} diff --git a/examples/quickcontrols2/wearable/wearable.qrc b/examples/quickcontrols2/wearable/wearable.qrc new file mode 100644 index 00000000..a596fb63 --- /dev/null +++ b/examples/quickcontrols2/wearable/wearable.qrc @@ -0,0 +1,67 @@ +<RCC> + <qresource prefix="/"> + <file>wearable.qml</file> + <file>qml/LauncherPage.qml</file> + <file>qml/NaviButton.qml</file> + <file>images/background.png</file> + <file>images/back.png</file> + <file>images/home.png</file> + <file>qml/Alarms/AlarmsPage.qml</file> + <file>qml/Alarms/images/alarms.png</file> + <file>qml/Fitness/fitness.js</file> + <file>qml/Fitness/FitnessPage.qml</file> + <file>qml/Fitness/images/fitness.png</file> + <file>qml/Fitness/images/man-running.png</file> + <file>qml/Fitness/images/man-walking.png</file> + <file>qml/Navigation/navigation.js</file> + <file>qml/Navigation/NavigationPage.qml</file> + <file>qml/Navigation/RouteElement.qml</file> + <file>qml/Navigation/walk_route.json</file> + <file>qml/Navigation/images/end.png</file> + <file>qml/Navigation/images/leftturn.png</file> + <file>qml/Navigation/images/marker.png</file> + <file>qml/Navigation/images/rightturn.png</file> + <file>qml/Navigation/images/route.png</file> + <file>qml/Navigation/images/start.png</file> + <file>qml/Navigation/images/straight.png</file> + <file>qml/Navigation/images/uturn.png</file> + <file>qml/Notifications/notifications.js</file> + <file>qml/Notifications/NotificationsPage.qml</file> + <file>qml/Notifications/images/avatarf.png</file> + <file>qml/Notifications/images/avatarm.png</file> + <file>qml/Notifications/images/missedcall.png</file> + <file>qml/Notifications/images/notifications.png</file> + <file>qml/Settings/SettingsPage.qml</file> + <file>qml/Settings/images/bluetooth.png</file> + <file>qml/Settings/images/brightness.png</file> + <file>qml/Settings/images/contrast.png</file> + <file>qml/Settings/images/settings.png</file> + <file>qml/Settings/images/wifi.png</file> + <file>qml/Style/qmldir</file> + <file>qml/Style/PageIndicator.qml</file> + <file>qml/Style/Slider.qml</file> + <file>qml/Style/Switch.qml</file> + <file>qml/Style/UIStyle.qml</file> + <file>qml/Weather/weather.js</file> + <file>qml/Weather/weather.json</file> + <file>qml/Weather/WeatherPage.qml</file> + <file>qml/Weather/images/humidity.png</file> + <file>qml/Weather/images/pressure.png</file> + <file>qml/Weather/images/sunrise.png</file> + <file>qml/Weather/images/sunset.png</file> + <file>qml/Weather/images/temperature.png</file> + <file>qml/Weather/images/weather.png</file> + <file>qml/Weather/images/wind.png</file> + <file>qml/WorldClock/Clock.qml</file> + <file>qml/WorldClock/WorldClockPage.qml</file> + <file>qml/WorldClock/images/center.png</file> + <file>qml/WorldClock/images/second.png</file> + <file>qml/WorldClock/images/swissdaydial.png</file> + <file>qml/WorldClock/images/swissdayhour.png</file> + <file>qml/WorldClock/images/swissdayminute.png</file> + <file>qml/WorldClock/images/swissnightdial.png</file> + <file>qml/WorldClock/images/swissnighthour.png</file> + <file>qml/WorldClock/images/swissnightminute.png</file> + <file>qml/WorldClock/images/watch.png</file> + </qresource> +</RCC> |