151 lines
3.7 KiB
QML
Raw Normal View History

2026-02-17 11:29:04 +04:00
import QtQuick
import QtQuick.Layouts
2026-02-19 08:51:01 +04:00
import QtQuick.Controls
2026-02-17 11:29:04 +04:00
import Logos.Controls
import Logos.Theme
2026-02-19 14:15:16 +04:00
LogosStorageLayout {
2026-02-17 11:29:04 +04:00
id: root
2026-02-19 08:51:01 +04:00
property var backend: mockBackend
2026-02-17 11:29:04 +04:00
property string status: ""
property string title: "Starting your node"
property string resolution: ""
2026-02-17 11:29:04 +04:00
property bool starting: true
property bool success: false
signal back
signal next
2026-02-19 08:51:01 +04:00
function onNodeStarted() {
root.starting = false
root.status = "Your node is up and reachable."
root.title = "Node is ready"
2026-02-19 08:51:01 +04:00
root.success = true
}
2026-02-20 13:41:07 +04:00
Component.onCompleted: root.backend.start()
2026-02-19 08:51:01 +04:00
Timer {
2026-02-20 13:41:07 +04:00
id: nodeCheckTimer
interval: 500
repeat: false
onTriggered: root.backend.checkNodeIsUp()
2026-02-19 08:51:01 +04:00
}
2026-02-17 11:29:04 +04:00
Connections {
target: root.backend
function onStartCompleted() {
root.title = "Checking connectivity"
root.status = "Node started, verifying reachability..."
2026-02-20 13:41:07 +04:00
nodeCheckTimer.start()
2026-02-17 11:29:04 +04:00
}
function onStartFailed(error) {
root.starting = false
2026-02-20 13:41:07 +04:00
root.title = "Failed to start"
root.status = "Your node failed to start: " + error
}
function onNodeIsUp() {
root.onNodeStarted()
2026-02-17 11:29:04 +04:00
}
2026-02-20 13:41:07 +04:00
function onNodeIsntUp(reason) {
root.starting = false
root.title = "Node unreachable"
2026-02-20 13:41:07 +04:00
root.status = ""
root.resolution = reason
}
2026-02-17 11:29:04 +04:00
}
ColumnLayout {
2026-02-19 14:15:16 +04:00
anchors.centerIn: parent
2026-02-20 13:41:07 +04:00
width: 400
2026-02-17 11:29:04 +04:00
spacing: Theme.spacing.medium
LogosText {
font.pixelSize: Theme.typography.titleText
2026-02-19 08:51:01 +04:00
text: root.title
2026-02-17 11:29:04 +04:00
Layout.alignment: Qt.AlignHCenter
}
NodeStatusIcon {
starting: root.starting
success: root.success
Layout.alignment: Qt.AlignHCenter
}
2026-02-17 11:29:04 +04:00
LogosText {
font.pixelSize: Theme.typography.primaryText
text: root.status
visible: root.status !== ""
2026-02-17 11:29:04 +04:00
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
2026-02-20 13:41:07 +04:00
wrapMode: Text.WordWrap
Layout.fillWidth: true
2026-02-17 11:29:04 +04:00
}
LogosText {
font.pixelSize: Theme.typography.primaryText
2026-02-20 13:41:07 +04:00
text: root.resolution
visible: root.resolution !== ""
color: Theme.palette.error
wrapMode: Text.WordWrap
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
Layout.alignment: Qt.AlignHCenter
}
2026-02-17 11:29:04 +04:00
}
LogosStorageButton {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.bottomMargin: 10
anchors.leftMargin: 10
text: "Back"
enabled: !root.starting
onClicked: {
2026-02-20 13:41:07 +04:00
root.backend.stop()
root.back()
}
2026-02-17 11:29:04 +04:00
}
LogosStorageButton {
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.bottomMargin: 10
anchors.rightMargin: 10
text: "Next"
enabled: root.success
onClicked: {
2026-02-20 13:41:07 +04:00
root.backend.saveCurrentConfig()
root.next()
}
2026-02-17 11:29:04 +04:00
}
2026-02-20 13:41:07 +04:00
Timer {
interval: 2000
running: root.backend && root.backend.isMock === true
repeat: false
onTriggered: root.onNodeStarted()
2026-02-20 13:41:07 +04:00
}
2026-02-20 13:41:07 +04:00
QtObject {
id: mockBackend
readonly property bool isMock: true
signal startCompleted
signal startFailed(string error)
signal nodeIsUp
signal nodeIsntUp(string reason)
function checkNodeIsUp() {}
function stop() {}
function saveCurrentConfig() {}
function start() {}
}
2026-02-17 11:29:04 +04:00
}