From 9c6410ebe71c10c5ff5fc00ac30420de71035b60 Mon Sep 17 00:00:00 2001 From: Juny Date: Tue, 13 Feb 2024 19:28:43 -0300 Subject: [PATCH] Splash: lazy load login screen --- src/Gui/Splash.qml | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/src/Gui/Splash.qml b/src/Gui/Splash.qml index cdf9880..53766ff 100644 --- a/src/Gui/Splash.qml +++ b/src/Gui/Splash.qml @@ -5,6 +5,7 @@ import QtQuick.Controls import "PStyle" import "Login" +import "." Window { visible: true @@ -12,11 +13,46 @@ Window { height: 480 title: Qt.application.displayName - PBackground { - anchors.fill: parent + Component.onCompleted: { + App.setup() + loadingTimer.running = true + } - Login { - anchors.centerIn: parent + Timer { + id: loadingTimer + + running: false + repeat: false + interval: 500 + + onTriggered: loader.source = "qrc:/Login/Login.qml" + } + + Loader { + id: loader + anchors.fill: parent + sourceComponent: loadingComponent + } + + Component { + id: loadingComponent + + PBackground { + ColumnLayout { + anchors.centerIn: parent + spacing: 24 + + PBusyIndicator { + Layout.alignment: Qt.AlignHCenter + Layout.preferredHeight: 48 + running: true + } + + PText { + Layout.alignment: Qt.AlignHCenter + text: qsTr("Loading application...") + } + } } } } \ No newline at end of file