From 1acdb32d00291e5a9b5b4928e0896a162f101bbc Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Mon, 12 Oct 2020 14:16:29 +0300 Subject: Add initial mock up for Boot to Qt Startup Screen Initial implementation by Antti Aaltonen (QTBUG-86126). Changes done: - converted into cmake/qmake project - need to keep pro file for Design Studio - updated to work with Qt6 - removed Qt Design Studio (GPL) components - added BSD license headers Task-number: QTBUG-87026 Change-Id: I6dea6a2815e5fbd17a5e8ce259f3dc98a58116fe Reviewed-by: Assam Boudjelthia --- .gitattributes | 3 + startupscreen/AnalogClock.qml | 183 +++++++ startupscreen/CMakeLists.txt | 29 ++ startupscreen/MainView.qml | 606 ++++++++++++++++++++++ startupscreen/SDcardButton.qml | 214 ++++++++ startupscreen/SplashView.ui.qml | 109 ++++ startupscreen/StartupScreen.qml | 127 +++++ startupscreen/TextButton.qml | 76 +++ startupscreen/UsbButton.qml | 215 ++++++++ startupscreen/WifiButton.qml | 295 +++++++++++ startupscreen/assets/background.png | Bin 0 -> 41074 bytes startupscreen/assets/builtwithQt.png | Bin 0 -> 3051 bytes startupscreen/assets/clockFace.png | Bin 0 -> 12669 bytes startupscreen/assets/headerBackgroundLeft.png | Bin 0 -> 799 bytes startupscreen/assets/headerBackgroundRight.png | Bin 0 -> 1015 bytes startupscreen/assets/icon_SDcard.png | Bin 0 -> 2897 bytes startupscreen/assets/icon_error.png | Bin 0 -> 135 bytes startupscreen/assets/icon_markerBackground.png | Bin 0 -> 1982 bytes startupscreen/assets/icon_ok.png | Bin 0 -> 1224 bytes startupscreen/assets/icon_usb.png | Bin 0 -> 2160 bytes startupscreen/assets/icon_wifi_0.png | Bin 0 -> 6355 bytes startupscreen/assets/icon_wifi_1.png | Bin 0 -> 5985 bytes startupscreen/assets/icon_wifi_2.png | Bin 0 -> 5370 bytes startupscreen/assets/icon_wifi_3.png | Bin 0 -> 4466 bytes startupscreen/assets/icon_working.png | Bin 0 -> 9394 bytes startupscreen/fonts/TitilliumWeb-Bold.ttf | 3 + startupscreen/fonts/TitilliumWeb-Light.ttf | 3 + startupscreen/fonts/TitilliumWeb-Regular.ttf | 3 + startupscreen/imports/StartupScreen/Constants.qml | 98 ++++ startupscreen/imports/StartupScreen/qmldir | 1 + startupscreen/main.cpp | 74 +++ startupscreen/qml.qrc | 33 ++ startupscreen/qtquickcontrols2.conf | 2 + startupscreen/startupscreen.pro | 18 + 34 files changed, 2092 insertions(+) create mode 100644 startupscreen/AnalogClock.qml create mode 100644 startupscreen/CMakeLists.txt create mode 100644 startupscreen/MainView.qml create mode 100644 startupscreen/SDcardButton.qml create mode 100644 startupscreen/SplashView.ui.qml create mode 100644 startupscreen/StartupScreen.qml create mode 100644 startupscreen/TextButton.qml create mode 100644 startupscreen/UsbButton.qml create mode 100644 startupscreen/WifiButton.qml create mode 100644 startupscreen/assets/background.png create mode 100644 startupscreen/assets/builtwithQt.png create mode 100644 startupscreen/assets/clockFace.png create mode 100644 startupscreen/assets/headerBackgroundLeft.png create mode 100644 startupscreen/assets/headerBackgroundRight.png create mode 100644 startupscreen/assets/icon_SDcard.png create mode 100644 startupscreen/assets/icon_error.png create mode 100644 startupscreen/assets/icon_markerBackground.png create mode 100644 startupscreen/assets/icon_ok.png create mode 100644 startupscreen/assets/icon_usb.png create mode 100644 startupscreen/assets/icon_wifi_0.png create mode 100644 startupscreen/assets/icon_wifi_1.png create mode 100644 startupscreen/assets/icon_wifi_2.png create mode 100644 startupscreen/assets/icon_wifi_3.png create mode 100644 startupscreen/assets/icon_working.png create mode 100644 startupscreen/fonts/TitilliumWeb-Bold.ttf create mode 100644 startupscreen/fonts/TitilliumWeb-Light.ttf create mode 100644 startupscreen/fonts/TitilliumWeb-Regular.ttf create mode 100644 startupscreen/imports/StartupScreen/Constants.qml create mode 100644 startupscreen/imports/StartupScreen/qmldir create mode 100644 startupscreen/main.cpp create mode 100644 startupscreen/qml.qrc create mode 100644 startupscreen/qtquickcontrols2.conf create mode 100644 startupscreen/startupscreen.pro diff --git a/.gitattributes b/.gitattributes index 07361bc..efd6c19 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,6 @@ tradeshow/knx-demo/3d-Alexa-knx-demo/**/*.mesh filter=lfs diff=lfs merge=lfs -te tradeshow/knx-demo/3d-Alexa-knx-demo/**/*.ico filter=lfs diff=lfs merge=lfs -text tradeshow/knx-demo/3d-Alexa-knx-demo/**/*.hdr filter=lfs diff=lfs merge=lfs -text tradeshow/knx-demo/3d-Alexa-knx-demo/**/*.uip filter=lfs diff=lfs merge=lfs -text +startupscreen/fonts/TitilliumWeb-Bold.ttf filter=lfs diff=lfs merge=lfs -text +startupscreen/fonts/TitilliumWeb-Light.ttf filter=lfs diff=lfs merge=lfs -text +startupscreen/fonts/TitilliumWeb-Regular.ttf filter=lfs diff=lfs merge=lfs -text diff --git a/startupscreen/AnalogClock.qml b/startupscreen/AnalogClock.qml new file mode 100644 index 0000000..a430227 --- /dev/null +++ b/startupscreen/AnalogClock.qml @@ -0,0 +1,183 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $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.12 +import StartupScreen 1.0 + +Item { + id: clock + + property int hours + property int minutes + property int seconds + + // for clock scaling + property int clockRadius + property int wideDial: 3 + property int narrowDial: 1 + + function timeChanged() { + var date = new Date; + hours = date.getHours() + minutes = date.getMinutes() + seconds = date.getUTCSeconds(); + } + + clockRadius: width/2 + + Timer { + interval: 100 + running: true + repeat: true; + onTriggered: clock.timeChanged() + } + + Item { + id: analogClock + + width: clock.width + height: clock.height + anchors.centerIn: parent + + Image { + id: background + source: "assets/clockFace.png" + width: clock.width + height: clock.height + anchors.centerIn: parent + } + + Rectangle { + id: hourDial + x: clockRadius - (wideDial/2) + y: clockRadius/2 + width: wideDial + height: clockRadius/2 + color: "#53586b" + radius: width/2 + + transform: Rotation { + id: hourRotation + origin.x: 2 + origin.y: clockRadius/2 + angle: (clock.hours * 30) + (clock.minutes * 0.5) + Behavior on angle { + SpringAnimation { + spring: 2 + damping: 0.2 + modulus: 360 + } + } + } + } + Rectangle { + id: minuteDial + x: clockRadius - (wideDial/2) + y: 32 + width: wideDial + height: clockRadius - 32 + color: "#53586b" + radius: width/2 + + transform: Rotation { + id: minuteRotation + origin.x: 2 + origin.y: clockRadius - 32 + angle: clock.minutes * 6 + Behavior on angle { + SpringAnimation { + spring: 2 + damping: 0.2 + modulus: 360 + } + } + } + } + + Rectangle { + id: secondHand + x: clockRadius - (narrowDial/2) + y: 24 + width: narrowDial + height: clockRadius - 24 + color: "red" + radius: width/2 + + transform: Rotation { + id: secondRotation + origin.x: 1 + origin.y: clockRadius - 24 + angle: clock.seconds * 6 + Behavior on angle { + SpringAnimation { + spring: 2 + damping: 0.2 + modulus: 360 + } + } + } + } + + Rectangle { + id: center + width: narrowDial + wideDial + height: width + color: "black" + radius: width / 2 + anchors.centerIn: parent + } + } +} + +/*##^## +Designer { + D{i:0;autoSize:true;height:100;width:100} +} +##^##*/ diff --git a/startupscreen/CMakeLists.txt b/startupscreen/CMakeLists.txt new file mode 100644 index 0000000..3b9bdf9 --- /dev/null +++ b/startupscreen/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.14) + +project(startupscreen LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick REQUIRED) + +add_executable(startupscreen + main.cpp + qml.qrc +) + +target_compile_definitions(startupscreen + PRIVATE $<$,$>:QT_QML_DEBUG>) +target_link_libraries(startupscreen + PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick) + +install(TARGETS startupscreen + DESTINATION "/usr/bin" +) diff --git a/startupscreen/MainView.qml b/startupscreen/MainView.qml new file mode 100644 index 0000000..6b3d1b0 --- /dev/null +++ b/startupscreen/MainView.qml @@ -0,0 +1,606 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $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.12 +import StartupScreen 1.0 +import QtGraphicalEffects 1.15 + +Item { + id: root + width: Constants.smallWidth + height: Constants.smallHeight + + Image { + id: backgroundImage + source: "assets/background.png" + anchors.fill: parent + } + + Item { + id: panel + anchors.top: root.top + anchors.topMargin: 20 + + anchors.left: root.left + height: headerBackground.height + bodyBackground.height + width: Constants.smallPanelWidth + + + Item { + id: headerBackground + + width: parent.width + height: Constants.smallHeaderHeight + + anchors.top: panel.top + anchors.left: panel.left + + Image { + id: headerBackgroundRight + source: "assets/headerBackgroundRight.png" + fillMode: Image.PreserveAspectFit + height: parent.height + anchors.right: parent.right + anchors.top: parent.top + } + Image { + id: headerBackgroundLeft + source: "assets/headerBackgroundLeft.png" + height: parent.height + width: parent.width-headerBackgroundRight.width + anchors.left: parent.left + anchors.top: parent.top + } + Text { + id: headerText_1 + color: "#ffffff" + text: "Get started with" + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + font.pixelSize: 20 + font.family: "Titillium Web" + anchors.topMargin: 8 + } + Text { + id: headerText_2 + color: "#ffffff" + text: "Boot to Qt " + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + font.bold: true + font.pixelSize: 48 + font.family: "Titillium Web" + anchors.bottomMargin: 0 + } + } + + // body of the text panel + Rectangle { + id: bodyBackground + height: Constants.smallBodyHeight + color: "#000000" + width: headerBackground.width + anchors.top: headerBackground.bottom + anchors.left: headerBackground.left + + Text { + id: bodyText + color: "#ffffff" + width: parent.width - 40 + text: "How to install demo\napplication from Qt Creator?" + font.pixelSize: 24 + font.family: "Titillium Web" + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + horizontalAlignment: Text.AlignHCenter + lineHeight: 0.8 + wrapMode: Text.WordWrap + anchors.topMargin: 8 + } + + TextButton { + id: textButton + width: parent.width - 40 + height: Constants.smallTextButton + fontSize: 24 + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: 20 + } + } + } + DropShadow { + id: panelDropShadow + anchors.fill: panel + horizontalOffset: 8 + verticalOffset: 8 + radius: 8.0 + color: "#80000000" + source: panel + } + + // Button row + UsbButton { + id: usbButton + height: Constants.smallButton + width: height + iconHeight: height-24 + + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.top: panel.bottom + anchors.topMargin: 48 + } + SDcardButton { + id: sdCardButton + height: Constants.smallButton + width: height + iconHeight: height-24 + + + anchors.bottom: usbButton.bottom + anchors.left: usbButton.right + anchors.leftMargin: 50 + } + WifiButton { + id: wifiButton + height: Constants.smallButton + width: height + iconHeight: height-24 + + anchors.bottom: usbButton.bottom + anchors.right: panel.right + } + + // Analog clock showing the current time + AnalogClock { + id: clock + width: Constants.smallClock + height: Constants.smallClock + anchors.top: root.top + anchors.topMargin: panel.anchors.topMargin + panel.height / 2 - clock.height / 2 + anchors.right: root.right + anchors.rightMargin: 20 + } + DropShadow { + id: clockDropShadow + anchors.fill: clock + horizontalOffset: 8 + verticalOffset: 8 + radius: 8.0 + color: "#80000000" + source: clock + } + + // label and IP address + Item { + id: ipPanel + height: usbButton.height + anchors.horizontalCenter: clock.horizontalCenter + anchors.bottom: usbButton.bottom + + Text { + id: ipLabel + color: "#ffffff" + text: "IP address" + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 24 + font.pixelSize: 20 + font.family: "Titillium Web" + } + Text { + id: ipAddress + color: "#ffffff" + text: "255.255.255.255" + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: 24 + font.pixelSize: 20 + font.bold: true + font.family: "Titillium Web" + } + } + + // states for different resolutions + // base state = small landscape + states: [ + State { + name: "smallPortrait" + + PropertyChanges { + target: clock + width: Constants.smallClock + height: Constants.smallClock + + anchors.topMargin: 12 + anchors.rightMargin: root.width / 2 - clockRadius + } + PropertyChanges { + target: panel + anchors.topMargin: 204 + } + PropertyChanges { + target: usbButton + anchors.topMargin: 12 + } + PropertyChanges { + target: ipPanel + anchors.bottomMargin: -80 + } + }, + State { + name: "mediumLandscape" + + PropertyChanges { + target: clock + width: Constants.mediumClock + height: Constants.mediumClock + + anchors.topMargin: panel.anchors.topMargin + panel.height / 2 - clock.height / 2 + anchors.rightMargin: 152 + + wideDial: 8 + narrowDial: 4 + } + PropertyChanges { + target: panel + anchors.topMargin: 48 + width: Constants.mediumPanelWidth + } + PropertyChanges { + target: headerBackground + height: Constants.mediumHeaderHeight + } + PropertyChanges { + target: bodyBackground + height: Constants.mediumBodyHeight + } + PropertyChanges { + target: headerText_1 + font.pixelSize: 40 + anchors.topMargin: 0 + } + PropertyChanges { + target: headerText_2 + font.pixelSize: 88 + anchors.bottomMargin: -8 + } + PropertyChanges { + target: bodyText + font.pixelSize: 40 + } + PropertyChanges { + target: textButton + height: Constants.mediumTextButton + width: panel.width - 64 + fontSize: 40 + anchors.bottomMargin: 32 + } + PropertyChanges { + target: usbButton + height: Constants.mediumButton + width: height + anchors.topMargin: 54 + anchors.leftMargin: 32 + } + PropertyChanges { + target: sdCardButton + height: Constants.mediumButton + width: height + anchors.leftMargin: 90 + } + PropertyChanges { + target: wifiButton + height: Constants.mediumButton + width: height + } + PropertyChanges { + target: ipPanel + } + PropertyChanges { + target: ipLabel + font.pixelSize: 36 + } + PropertyChanges { + target: ipAddress + font.pixelSize: 36 + } + }, + State { + name: "mediumPortrait" + PropertyChanges { + target: clock + width: Constants.mediumClock + height: Constants.mediumClock + + anchors.topMargin: 60 + anchors.rightMargin: root.width / 2 - clockRadius + + wideDial: 8 + narrowDial: 4 + } + PropertyChanges { + target: panel + anchors.topMargin: 440 + width: Constants.mediumPanelWidth + } + PropertyChanges { + target: headerBackground + height: Constants.mediumHeaderHeight + } + PropertyChanges { + target: bodyBackground + height: Constants.mediumBodyHeight + } + PropertyChanges { + target: headerText_1 + font.pixelSize: 40 + anchors.topMargin: 0 + } + PropertyChanges { + target: headerText_2 + font.pixelSize: 88 + anchors.bottomMargin: -8 + } + PropertyChanges { + target: bodyText + font.pixelSize: 40 + } + PropertyChanges { + target: textButton + height: Constants.mediumTextButton + width: panel.width - 64 + fontSize: 40 + anchors.bottomMargin: 32 + } + PropertyChanges { + target: usbButton + height: Constants.mediumButton + width: height + anchors.topMargin: 60 + anchors.leftMargin: 32 + } + PropertyChanges { + target: sdCardButton + height: Constants.mediumButton + width: height + anchors.leftMargin: 90 + } + PropertyChanges { + target: wifiButton + height: Constants.mediumButton + width: height + } + PropertyChanges { + target: ipPanel + anchors.bottomMargin: -200 + } + PropertyChanges { + target: ipLabel + font.pixelSize: 36 + } + PropertyChanges { + target: ipAddress + font.pixelSize: 36 + } + }, + State { + name: "largeLandscape" + + PropertyChanges { + target: clock + width: Constants.largeClock + height: Constants.largeClock + + anchors.topMargin: panel.anchors.topMargin + panel.height / 2 - clock.height / 2 + anchors.rightMargin: 152 + + wideDial: 12 + narrowDial: 6 + } + PropertyChanges { + target: panel + anchors.topMargin: 48 + width: Constants.largePanelWidth + } + PropertyChanges { + target: headerBackground + height: Constants.largeHeaderHeight + } + PropertyChanges { + target: bodyBackground + height: Constants.largeBodyHeight + } + PropertyChanges { + target: headerText_1 + font.pixelSize: 72 + anchors.topMargin: 0 + } + PropertyChanges { + target: headerText_2 + font.pixelSize: 132 + anchors.bottomMargin: -8 + } + PropertyChanges { + target: bodyText + font.pixelSize: 72 + } + PropertyChanges { + target: textButton + height: Constants.largeTextButton + width: panel.width - 80 + fontSize: 72 + anchors.bottomMargin: 40 + } + PropertyChanges { + target: usbButton + height: Constants.largeButton + width: height + anchors.topMargin: 32 + anchors.leftMargin: 40 + + } + PropertyChanges { + target: sdCardButton + height: Constants.largeButton + width: height + anchors.leftMargin: 188 + } + PropertyChanges { + target: wifiButton + height: Constants.largeButton + width: height + } + PropertyChanges { + target: ipPanel + anchors.bottom: usbButton.bottom + } + PropertyChanges { + target: ipLabel + font.pixelSize: 72 + anchors.topMargin: 0 + } + PropertyChanges { + target: ipAddress + font.pixelSize: 72 + anchors.bottomMargin: 0 + } + }, + State { + name: "largePortrait" + PropertyChanges { + target: clock + width: Constants.largeClock + height: Constants.largeClock + + anchors.topMargin: 48 + anchors.rightMargin: root.width / 2 - clockRadius + + wideDial: 12 + narrowDial: 6 + } + PropertyChanges { + target: panel + anchors.topMargin: 640 + width: Constants.largePanelWidth + } + + PropertyChanges { + target: headerBackground + height: Constants.largeHeaderHeight + } + PropertyChanges { + target: bodyBackground + height: Constants.largeBodyHeight + } + PropertyChanges { + target: headerText_1 + font.pixelSize: 72 + anchors.topMargin: 0 + } + PropertyChanges { + target: headerText_2 + font.pixelSize: 132 + anchors.bottomMargin: -8 + } + PropertyChanges { + target: bodyText + font.pixelSize: 72 + } + PropertyChanges { + target: textButton + height: Constants.largeTextButton + width: panel.width - 80 + fontSize: 72 + anchors.bottomMargin: 40 + } + PropertyChanges { + target: usbButton + height: Constants.largeButton + width: height + anchors.topMargin: 60 + anchors.leftMargin: 40 + } + PropertyChanges { + target: sdCardButton + height: Constants.largeButton + width: height + anchors.leftMargin: 188 + } + PropertyChanges { + target: wifiButton + height: Constants.largeButton + width: height + } + PropertyChanges { + target: ipPanel + anchors.bottomMargin: -240 + } + PropertyChanges { + target: ipLabel + font.pixelSize: 72 + anchors.topMargin: 0 + } + PropertyChanges { + target: ipAddress + font.pixelSize: 72 + anchors.bottomMargin: 0 + } + } + ] +} + +/*##^## +Designer { + D{i:0;autoSize:true;height:640;width:480} +} +##^##*/ + diff --git a/startupscreen/SDcardButton.qml b/startupscreen/SDcardButton.qml new file mode 100644 index 0000000..3c11264 --- /dev/null +++ b/startupscreen/SDcardButton.qml @@ -0,0 +1,214 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $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.12 +import StartupScreen 1.0 +import QtGraphicalEffects 1.12 + +Item { + id: root + + property alias iconHeight: icon.height + + Rectangle { + id: buttonBackground + anchors.fill: parent + color: "#3a4055" + radius: 0 + } + + DropShadow { + id: buttonDropShadow + anchors.fill: buttonBackground + horizontalOffset: 8 + verticalOffset: 8 + radius: 8.0 + color: "#80000000" + source: buttonBackground + } + + // changing button state + MouseArea { + anchors.fill: parent + + onPressed: { + root.scale = 0.9 + } + onReleased: { + root.scale = 1.0 + if (root.state == "") + root.state = "working" + else if (root.state == "working") + root.state = "ok" + else + root.state = "" + } + } + + // icon + Image { + id: icon + source: "assets/icon_SDcard.png" + fillMode: Image.PreserveAspectFit + anchors.centerIn: parent + } + + // marker for the error, working and OK states + Image { + id: markerBackground + height: icon.height/2 + + anchors.right: parent.right + anchors.bottom: parent.bottom + source: "assets/icon_markerBackground.png" + anchors.rightMargin: 0 + anchors.bottomMargin: 0 + fillMode: Image.PreserveAspectFit + + Image { + id: errorIcon + height: parent.height*0.5 + anchors.centerIn: parent + source: "assets/icon_error.png" + fillMode: Image.PreserveAspectFit + opacity: 1 + } + Image { + id: workingIcon + height: parent.height*0.75 + anchors.centerIn: parent + source: "assets/icon_working.png" + fillMode: Image.PreserveAspectFit + opacity: 0 + + RotationAnimation on rotation { + from: 0 + to: 360 + loops: Animation.Infinite + duration: 1000 + running: true + } + } + Image { + id: okIcon + height: parent.height *0.5 + anchors.centerIn: parent + source: "assets/icon_ok.png" + fillMode: Image.PreserveAspectFit + opacity: 0 + } + } + states: [ + State { + name: "working" + PropertyChanges { + target: errorIcon + opacity: 0 + } + PropertyChanges { + target: workingIcon + opacity: 1 + } + PropertyChanges { + target: okIcon + opacity: 0 + } + }, + State { + name: "ok" + PropertyChanges { + target: errorIcon + opacity: 0 + } + PropertyChanges { + target: workingIcon + opacity: 0 + } + PropertyChanges { + target: okIcon + opacity: 1 + } + } + ] + transitions: [ + Transition { + from: "" + to: "working" + PropertyAnimation { + duration: 200 + properties: "opacity" + + } + }, + Transition { + from: "working" + to: "ok" + PropertyAnimation { + duration: 200 + properties: "opacity" + } + }, + Transition { + from: "" + to: "working" + PropertyAnimation { + duration: 200 + properties: "opacity" + + } + } + ] +} + +/*##^## +Designer { + D{i:0;autoSize:true;height:480;width:640} +} +##^##*/ diff --git a/startupscreen/SplashView.ui.qml b/startupscreen/SplashView.ui.qml new file mode 100644 index 0000000..5310422 --- /dev/null +++ b/startupscreen/SplashView.ui.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $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.12 +import StartupScreen 1.0 +import QtQuick.Controls 2.15 +import QtGraphicalEffects 1.15 + +Rectangle { + id: root + + Image { + id: backgroundImage + source: "assets/background.png" + anchors.fill: root + } + + Image { + id: builtwithQtImage + source: "assets/builtwithQt.png" + anchors.centerIn: root + } + + DropShadow { + id: dropShadow + anchors.fill: builtwithQtImage + horizontalOffset: 8 + verticalOffset: 8 + radius: 8.0 + color: "#80000000" + source: builtwithQtImage + } + + ProgressBar { + id: progressBar + width: parent.width + height: 8 + value: 0.5 + anchors.bottom: parent.bottom + anchors.left: parent.left + background: Item { + implicitWidth: parent.width + implicitHeight: 6 + } + contentItem: Item { + implicitWidth: parent.width + implicitHeight: 6 + Rectangle { + width: progressBar.visualPosition * parent.width + height: parent.height + color: "#41CD52" + border.width: 0 + } + } + } +} + +/*##^## +Designer { + D{i:0;autoSize:true;formeditorZoom:1.25;height:480;width:640} +} +##^##*/ + diff --git a/startupscreen/StartupScreen.qml b/startupscreen/StartupScreen.qml new file mode 100644 index 0000000..b4098b7 --- /dev/null +++ b/startupscreen/StartupScreen.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $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.12 +import QtQuick.Controls 2.15 +import StartupScreen 1.0 + +ApplicationWindow { + id: bootUI + visible: true + + property bool isPortrait: false // true // + property int resolution: 1 + + width: Constants.smallWidth + height: Constants.smallHeight + + // for testing + Item { + anchors.fill: parent + focus: true + Keys.onPressed: { + // rotate: toggle portrait/landscape + if (event.key === Qt.Key_R) { + isPortrait? isPortrait = false: isPortrait = true + } + + // navigate from splash to main + else if (event.key === Qt.Key_Space){ + splash.opacity= 0 + main.opacity=1 + } + + // change window size + else if (event.key === Qt.Key_1) { + resolution = 1 + } + else if (event.key === Qt.Key_2) { + resolution = 2 + } + else if (event.key === Qt.Key_3) { + resolution = 3 + } + + // set width + if (resolution == 1){ + bootUI.width = isPortrait? Constants.smallHeight: Constants.smallWidth + bootUI.height= isPortrait? Constants.smallWidth: Constants.smallHeight + isPortrait? main.state = "smallPortrait": main.state = "" + } + else if (resolution == 2){ + bootUI.width = isPortrait? Constants.mediumHeight: Constants.mediumWidth + bootUI.height = isPortrait? Constants.mediumWidth: Constants.mediumHeight + isPortrait? main.state = "mediumPortrait": main.state = "mediumLandscape" + + } + else{ + bootUI.width = isPortrait? Constants.largeHeight: Constants.largeWidth + bootUI.height = isPortrait? Constants.largeWidth: Constants.largeHeight + isPortrait? main.state = "largePortrait": main.state = "largeLandscape" + } + } + } + + SplashView { + id: splash + width: bootUI.width + height: bootUI.height + } + + MainView { + id: main + width: bootUI.width + height: bootUI.height + + opacity: 0 + } +} + + diff --git a/startupscreen/TextButton.qml b/startupscreen/TextButton.qml new file mode 100644 index 0000000..b96982e --- /dev/null +++ b/startupscreen/TextButton.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $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.12 +import StartupScreen 1.0 + +Rectangle { + property alias fontSize: buttonLabel.font.pixelSize + + color: "#3a4055" + radius: 0 + + Text { + id: buttonLabel + color: "white" + text: "Learn more..." + horizontalAlignment: Text.AlignHCenter + font.bold: true + anchors.centerIn: parent + font.pixelSize: 32 + font.family: "Titillium Web" + } +} + +/*##^## +Designer { + D{i:0;autoSize:true;height:480;width:640} +} +##^##*/ diff --git a/startupscreen/UsbButton.qml b/startupscreen/UsbButton.qml new file mode 100644 index 0000000..0110821 --- /dev/null +++ b/startupscreen/UsbButton.qml @@ -0,0 +1,215 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $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.12 +import StartupScreen 1.0 +import QtGraphicalEffects 1.12 + +Item { + id: root + + property alias iconHeight: icon.height + + Rectangle { + id: buttonBackground + anchors.fill: parent + color: "#3a4055" + radius: 0 + } + + DropShadow { + id: buttonDropShadow + anchors.fill: buttonBackground + horizontalOffset: 8 + verticalOffset: 8 + radius: 8.0 + color: "#80000000" + source: buttonBackground + } + + // changing button state + MouseArea { + anchors.fill: parent + + onPressed: { + root.scale = 0.9 + } + onReleased: { + root.scale = 1.0 + + if (root.state == "") + root.state = "working" + else if (root.state == "working") + root.state = "ok" + else + root.state = "" + } + } + + // button icon + Image { + id: icon + source: "assets/icon_usb.png" + fillMode: Image.PreserveAspectFit + anchors.centerIn: parent + } + + // marker for the error, working and OK states + Image { + id: markerBackground + height: icon.height/2 + + anchors.right: parent.right + anchors.bottom: parent.bottom + source: "assets/icon_markerBackground.png" + anchors.rightMargin: 0 + anchors.bottomMargin: 0 + fillMode: Image.PreserveAspectFit + + Image { + id: errorIcon + height: parent.height*0.5 + anchors.centerIn: parent + source: "assets/icon_error.png" + fillMode: Image.PreserveAspectFit + opacity: 1 + } + Image { + id: workingIcon + height: parent.height *0.75 + anchors.centerIn: parent + source: "assets/icon_working.png" + fillMode: Image.PreserveAspectFit + opacity: 0 + + RotationAnimation on rotation { + from: 0 + to: 360 + loops: Animation.Infinite + duration: 1000 + running: true + } + } + Image { + id: okIcon + height: parent.height * 0.5 + anchors.centerIn: parent + source: "assets/icon_ok.png" + fillMode: Image.PreserveAspectFit + opacity: 0 + } + } + states: [ + State { + name: "working" + PropertyChanges { + target: errorIcon + opacity: 0 + } + PropertyChanges { + target: workingIcon + opacity: 1 + } + PropertyChanges { + target: okIcon + opacity: 0 + } + }, + State { + name: "ok" + PropertyChanges { + target: errorIcon + opacity: 0 + } + PropertyChanges { + target: workingIcon + opacity: 0 + } + PropertyChanges { + target: okIcon + opacity: 1 + } + } + ] + transitions: [ + Transition { + from: "" + to: "working" + PropertyAnimation { + duration: 200 + properties: "opacity" + + } + }, + Transition { + from: "working" + to: "ok" + PropertyAnimation { + duration: 200 + properties: "opacity" + } + }, + Transition { + from: "" + to: "working" + PropertyAnimation { + duration: 200 + properties: "opacity" + + } + } + ] +} + +/*##^## +Designer { + D{i:0;height:100;width:100} +} +##^##*/ diff --git a/startupscreen/WifiButton.qml b/startupscreen/WifiButton.qml new file mode 100644 index 0000000..61be53e --- /dev/null +++ b/startupscreen/WifiButton.qml @@ -0,0 +1,295 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $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.12 +import StartupScreen 1.0 +import QtGraphicalEffects 1.12 + +Item { + id: root + + property int iconHeight + + Rectangle { + id: buttonBackground + anchors.fill: parent + color: "#3a4055" + radius: 0 + } + + DropShadow { + id: buttonDropShadow + anchors.fill: buttonBackground + horizontalOffset: 8 + verticalOffset: 8 + radius: 8.0 + color: "#80000000" + source: buttonBackground + } + + // changing button state + MouseArea { + anchors.fill: parent + + onPressed: { + root.scale = 0.9 + } + onReleased: { + root.scale = 1.0 + + if (root.state == "") + root.state = "working" + else if (root.state == "working") + root.state = "ok" + else + root.state = "" + } + } + + // icons for signal strengths (from 0 to 3) + Image { + id: icon_signal_0 + height: iconHeight-12 + source: "assets/icon_wifi_0.png" + fillMode: Image.PreserveAspectFit + anchors.centerIn: parent + } + Image { + id: icon_signal_1 + height: iconHeight-12 + source: "assets/icon_wifi_1.png" + fillMode: Image.PreserveAspectFit + anchors.centerIn: parent + opacity: 0 + } + Image { + id: icon_signal_2 + height: iconHeight-12 + source: "assets/icon_wifi_2.png" + fillMode: Image.PreserveAspectFit + anchors.centerIn: parent + opacity: 0 + } + Image { + id: icon_signal_3 + height: iconHeight-12 + source: "assets/icon_wifi_3.png" + fillMode: Image.PreserveAspectFit + anchors.centerIn: parent + opacity: 0 + } + + // marker for the error, working and OK states + Image { + id: markerBackground + height: iconHeight/2 + + anchors.right: parent.right + anchors.bottom: parent.bottom + source: "assets/icon_markerBackground.png" + anchors.rightMargin: 0 + anchors.bottomMargin: 0 + fillMode: Image.PreserveAspectFit + + Image { + id: errorIcon + height: parent.height *0.5 + anchors.centerIn: parent + source: "assets/icon_error.png" + fillMode: Image.PreserveAspectFit + opacity: 1 + } + Image { + id: workingIcon + height: parent.height *0.75 + anchors.centerIn: parent + source: "assets/icon_working.png" + fillMode: Image.PreserveAspectFit + opacity: 0 + + RotationAnimation on rotation { + from: 0 + to: 360 + loops: Animation.Infinite + duration: 1000 + running: true + } + } + Image { + id: okIcon + height: parent.height *0.5 + anchors.centerIn: parent + source: "assets/icon_ok.png" + fillMode: Image.PreserveAspectFit + opacity: 0 + } + } + states: [ + State { + name: "working" + PropertyChanges { + target: errorIcon + opacity: 0 + } + PropertyChanges { + target: workingIcon + opacity: 1 + } + PropertyChanges { + target: okIcon + opacity: 0 + } + }, + State { + name: "ok" + PropertyChanges { + target: errorIcon + opacity: 0 + } + PropertyChanges { + target: workingIcon + opacity: 0 + } + PropertyChanges { + target: okIcon + opacity: 1 + } + PropertyChanges { + target: markerBackground + opacity: 0 + } + PropertyChanges { + target: icon_signal_0 + opacity: 0 + } + PropertyChanges { + target: icon_signal_1 + opacity: 1 + } + PropertyChanges { + target: icon_signal_2 + opacity: 1 + } + PropertyChanges { + target: icon_signal_3 + opacity: 1 + } + } + ] + transitions: [ + Transition { + from: "" + to: "working" + PropertyAnimation { + duration: 200 + properties: "opacity" + + } + }, + Transition { + from: "working" + to: "ok" + SequentialAnimation { + PropertyAnimation { + target: workingIcon + duration: 200 + properties: "opacity" + } + PropertyAnimation { + target: okIcon + duration: 100 + properties: "opacity" + } + ParallelAnimation { + PropertyAnimation { + target: icon_signal_0 + duration: 300 + properties: "opacity" + } + PropertyAnimation { + target: icon_signal_1 + duration: 300 + properties: "opacity" + } + } + PropertyAnimation { + target: icon_signal_2 + duration: 300 + properties: "opacity" + } + PropertyAnimation { + target: icon_signal_3 + duration: 200 + properties: "opacity" + } + PropertyAnimation { + target: markerBackground + duration: 1000 + properties: "opacity" + } + } + }, + Transition { + from: "" + to: "working" + PropertyAnimation { + duration: 200 + properties: "opacity" + + } + } + ] +} + +/*##^## +Designer { + D{i:0;autoSize:true;height:480;width:640} +} +##^##*/ diff --git a/startupscreen/assets/background.png b/startupscreen/assets/background.png new file mode 100644 index 0000000..e15fc1b Binary files /dev/null and b/startupscreen/assets/background.png differ diff --git a/startupscreen/assets/builtwithQt.png b/startupscreen/assets/builtwithQt.png new file mode 100644 index 0000000..cbec44b Binary files /dev/null and b/startupscreen/assets/builtwithQt.png differ diff --git a/startupscreen/assets/clockFace.png b/startupscreen/assets/clockFace.png new file mode 100644 index 0000000..2bf4b53 Binary files /dev/null and b/startupscreen/assets/clockFace.png differ diff --git a/startupscreen/assets/headerBackgroundLeft.png b/startupscreen/assets/headerBackgroundLeft.png new file mode 100644 index 0000000..f6981a9 Binary files /dev/null and b/startupscreen/assets/headerBackgroundLeft.png differ diff --git a/startupscreen/assets/headerBackgroundRight.png b/startupscreen/assets/headerBackgroundRight.png new file mode 100644 index 0000000..5d409f5 Binary files /dev/null and b/startupscreen/assets/headerBackgroundRight.png differ diff --git a/startupscreen/assets/icon_SDcard.png b/startupscreen/assets/icon_SDcard.png new file mode 100644 index 0000000..88facb3 Binary files /dev/null and b/startupscreen/assets/icon_SDcard.png differ diff --git a/startupscreen/assets/icon_error.png b/startupscreen/assets/icon_error.png new file mode 100644 index 0000000..ecca25a Binary files /dev/null and b/startupscreen/assets/icon_error.png differ diff --git a/startupscreen/assets/icon_markerBackground.png b/startupscreen/assets/icon_markerBackground.png new file mode 100644 index 0000000..51b14b1 Binary files /dev/null and b/startupscreen/assets/icon_markerBackground.png differ diff --git a/startupscreen/assets/icon_ok.png b/startupscreen/assets/icon_ok.png new file mode 100644 index 0000000..14b1eae Binary files /dev/null and b/startupscreen/assets/icon_ok.png differ diff --git a/startupscreen/assets/icon_usb.png b/startupscreen/assets/icon_usb.png new file mode 100644 index 0000000..89735c0 Binary files /dev/null and b/startupscreen/assets/icon_usb.png differ diff --git a/startupscreen/assets/icon_wifi_0.png b/startupscreen/assets/icon_wifi_0.png new file mode 100644 index 0000000..3cb0b9e Binary files /dev/null and b/startupscreen/assets/icon_wifi_0.png differ diff --git a/startupscreen/assets/icon_wifi_1.png b/startupscreen/assets/icon_wifi_1.png new file mode 100644 index 0000000..58dd3e7 Binary files /dev/null and b/startupscreen/assets/icon_wifi_1.png differ diff --git a/startupscreen/assets/icon_wifi_2.png b/startupscreen/assets/icon_wifi_2.png new file mode 100644 index 0000000..0e9a51b Binary files /dev/null and b/startupscreen/assets/icon_wifi_2.png differ diff --git a/startupscreen/assets/icon_wifi_3.png b/startupscreen/assets/icon_wifi_3.png new file mode 100644 index 0000000..2d5add3 Binary files /dev/null and b/startupscreen/assets/icon_wifi_3.png differ diff --git a/startupscreen/assets/icon_working.png b/startupscreen/assets/icon_working.png new file mode 100644 index 0000000..7d04681 Binary files /dev/null and b/startupscreen/assets/icon_working.png differ diff --git a/startupscreen/fonts/TitilliumWeb-Bold.ttf b/startupscreen/fonts/TitilliumWeb-Bold.ttf new file mode 100644 index 0000000..d854ea0 --- /dev/null +++ b/startupscreen/fonts/TitilliumWeb-Bold.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:794cb1239d5d6a1da0cbced1fe93aeb0fc78a68f51e9f1b5811241205e708380 +size 59908 diff --git a/startupscreen/fonts/TitilliumWeb-Light.ttf b/startupscreen/fonts/TitilliumWeb-Light.ttf new file mode 100644 index 0000000..907afb5 --- /dev/null +++ b/startupscreen/fonts/TitilliumWeb-Light.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a42074ecc8fa9be8cda36bed16a4a0ae5bd3451abfc9e1aa3bd957809c1b9cb6 +size 64032 diff --git a/startupscreen/fonts/TitilliumWeb-Regular.ttf b/startupscreen/fonts/TitilliumWeb-Regular.ttf new file mode 100644 index 0000000..d235334 --- /dev/null +++ b/startupscreen/fonts/TitilliumWeb-Regular.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89535fa5e2d707abc3a5becff17810789d73c827916ca8be714cfe6504ef9974 +size 63752 diff --git a/startupscreen/imports/StartupScreen/Constants.qml b/startupscreen/imports/StartupScreen/Constants.qml new file mode 100644 index 0000000..d9e091f --- /dev/null +++ b/startupscreen/imports/StartupScreen/Constants.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $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$ +** +****************************************************************************/ + +pragma Singleton +import QtQuick 2.10 +import StartupScreen 1.0 + +QtObject { + // readonly property int width: 640 + // readonly property int height: 480 + + // resolutions + readonly property int smallWidth: 640 + readonly property int smallHeight: 480 + readonly property int mediumWidth: 1280 + readonly property int mediumHeight: 720 + readonly property int largeWidth: 1920 + readonly property int largeHeight: 1080 + + // clock sizes + readonly property int smallClock: 180 + readonly property int mediumClock: 320 + readonly property int largeClock: 540 + + // panel width + readonly property int smallPanelWidth: 420 + readonly property int mediumPanelWidth: 660 + readonly property int largePanelWidth: 1000 + + // header height + readonly property int smallHeaderHeight: 92 + readonly property int mediumHeaderHeight: 160 + readonly property int largeHeaderHeight: 260 + + // body height + readonly property int smallBodyHeight: 172 + readonly property int mediumBodyHeight: 260 + readonly property int largeBodyHeight: 480 + + // icon button sizes + readonly property int smallButton: 100 + readonly property int mediumButton: 148 + readonly property int largeButton: 200 + + // text button sizes + readonly property int smallTextButton: 60 + readonly property int mediumTextButton: 92 + readonly property int largeTextButton: 140 + + readonly property color backgroundColor: "#c2c2c2" +} diff --git a/startupscreen/imports/StartupScreen/qmldir b/startupscreen/imports/StartupScreen/qmldir new file mode 100644 index 0000000..616ac20 --- /dev/null +++ b/startupscreen/imports/StartupScreen/qmldir @@ -0,0 +1 @@ +singleton Constants 1.0 Constants.qml diff --git a/startupscreen/main.cpp b/startupscreen/main.cpp new file mode 100644 index 0000000..a2c6160 --- /dev/null +++ b/startupscreen/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $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 +#include +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QFontDatabase::addApplicationFont(":/fonts/TitilliumWeb-Bold.ttf"); + QFontDatabase::addApplicationFont(":/fonts/TitilliumWeb-Light.ttf"); + QFontDatabase::addApplicationFont(":/fonts/TitilliumWeb-Regular.ttf"); + + QQmlApplicationEngine engine; + engine.addImportPath("qrc:/imports"); + const QUrl url(QStringLiteral("qrc:/StartupScreen.qml")); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, + &app, [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} diff --git a/startupscreen/qml.qrc b/startupscreen/qml.qrc new file mode 100644 index 0000000..11c09fc --- /dev/null +++ b/startupscreen/qml.qrc @@ -0,0 +1,33 @@ + + + assets/background.png + assets/builtwithQt.png + assets/clockFace.png + assets/headerBackgroundLeft.png + assets/headerBackgroundRight.png + assets/icon_error.png + assets/icon_markerBackground.png + assets/icon_ok.png + assets/icon_SDcard.png + assets/icon_usb.png + assets/icon_wifi_0.png + assets/icon_wifi_1.png + assets/icon_wifi_2.png + assets/icon_wifi_3.png + assets/icon_working.png + AnalogClock.qml + StartupScreen.qml + MainView.qml + qtquickcontrols2.conf + SDcardButton.qml + SplashView.ui.qml + UsbButton.qml + WifiButton.qml + TextButton.qml + imports/StartupScreen/qmldir + imports/StartupScreen/Constants.qml + fonts/TitilliumWeb-Bold.ttf + fonts/TitilliumWeb-Light.ttf + fonts/TitilliumWeb-Regular.ttf + + diff --git a/startupscreen/qtquickcontrols2.conf b/startupscreen/qtquickcontrols2.conf new file mode 100644 index 0000000..db94867 --- /dev/null +++ b/startupscreen/qtquickcontrols2.conf @@ -0,0 +1,2 @@ +[Controls] +Style=Basic diff --git a/startupscreen/startupscreen.pro b/startupscreen/startupscreen.pro new file mode 100644 index 0000000..663b433 --- /dev/null +++ b/startupscreen/startupscreen.pro @@ -0,0 +1,18 @@ +QT += quick + +SOURCES += \ + main.cpp + +RESOURCES += qml.qrc + +OTHER_FILES += \ + *.qml \ + imports/StartupScreen/* \ + imports/StartupScreen/designer/* \ + assets/* \ + fonts/* + +QML_IMPORT_PATH = imports + +target.path = /usr/bin +INSTALLS += target -- cgit v1.2.3