From 25842566eee73aa8f2b07dcd334d47d6f6853579 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Tue, 20 Oct 2020 12:06:53 +0300 Subject: startupscreen: make UI dynamic Dynamically adjust the UI element based on the screen size to better handle the various screen sizes available in embedded devices. Make states handle only the landscape - portrait changes. Remove progress bar from splash screen and make it hide automoatically. Remove SD card button and hide wifi button. Change-Id: I308ad696cf4c2ee3b97adfc231cd76899152f357 Reviewed-by: Assam Boudjelthia Reviewed-by: Rami Potinkara --- startupscreen/StartupScreen.qml | 80 ++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 49 deletions(-) (limited to 'startupscreen/StartupScreen.qml') diff --git a/startupscreen/StartupScreen.qml b/startupscreen/StartupScreen.qml index b4098b7..254dba2 100644 --- a/startupscreen/StartupScreen.qml +++ b/startupscreen/StartupScreen.qml @@ -48,19 +48,26 @@ ** ****************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.15 -import StartupScreen 1.0 +import QtQuick +import QtQuick.Controls +import StartupScreen ApplicationWindow { id: bootUI visible: true - property bool isPortrait: false // true // - property int resolution: 1 + property bool isPortrait: height > width ? true : false - width: Constants.smallWidth - height: Constants.smallHeight + width: 640 + height: 480 + + Timer { + interval: 1000 + running: true + onTriggered: { + splashAnimator.running = true + } + } // for testing Item { @@ -69,59 +76,34 @@ ApplicationWindow { 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" + var height = bootUI.height + bootUI.height = bootUI.width + bootUI.width = height } } } - SplashView { - id: splash + MainView { + id: main width: bootUI.width height: bootUI.height + state: isPortrait ? "portrait" : "" } - MainView { - id: main + SplashView { + id: splash width: bootUI.width height: bootUI.height - - opacity: 0 + opacity: 1 + OpacityAnimator { + id: splashAnimator + target: splash + from: 1 + to: 0 + duration: 2000 + } } + } -- cgit v1.2.3