diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2021-08-27 19:45:41 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-11-23 21:50:58 +0100 |
commit | cd1d46a26b923260b6c87cc93a0723b8166c609e (patch) | |
tree | 81d0fafeaeda6f5d72ec03f589cf8560cea32ed8 /gui/components/Splash.qml | |
parent | 76585f828a36c08614df84f43d64e20fb0e7a425 (diff) |
[ui] refactor ui
Diffstat (limited to 'gui/components/Splash.qml')
-rw-r--r-- | gui/components/Splash.qml | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/gui/components/Splash.qml b/gui/components/Splash.qml new file mode 100644 index 0000000..b494494 --- /dev/null +++ b/gui/components/Splash.qml @@ -0,0 +1,64 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 +import QtGraphicalEffects 1.0 + +Page { + id: splash + property int timeoutInterval: 1600 + + Column { + width: parent.width * 0.8 + anchors.horizontalCenter: parent.horizontalCenter + anchors.topMargin: 24 + + VerticalSpacer { + visible: true + height: root.height * 0.10 + } + + Image { + id: connectionImage + height: 200 + anchors.horizontalCenter: parent.horizontalCenter + source: "../resources/icon-noshield.svg" + fillMode: Image.PreserveAspectFit + } + + Spinner {} + } + + Timer { + id: splashTimer + } + + function delay(delayTime, cb) { + splashTimer.interval = delayTime + splashTimer.repeat = false + splashTimer.triggered.connect(cb) + splashTimer.start() + } + + function loadMainViewWhenReady() { + console.debug("ready?") + if (ctx && ctx.isReady) { + console.debug("ready?", ctx.isReady) + // FIXME check errors == None + loader.source = "MainView.qml" + } else { + delay(100, loadMainViewWhenReady) + } + } + + Timer { + interval: timeoutInterval + running: true + repeat: false + onTriggered: { + loadMainViewWhenReady() + } + } + + Component.onCompleted: { + + } +} |