2023-11-22 23:13:33 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Window
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
2023-12-05 22:17:27 +00:00
|
|
|
import QtCore
|
2023-11-24 23:48:01 +00:00
|
|
|
|
2023-12-17 00:06:04 +00:00
|
|
|
import magpie.API
|
2023-11-24 23:48:01 +00:00
|
|
|
|
|
|
|
ApplicationWindow {
|
2023-11-22 23:13:33 +00:00
|
|
|
property int counter: 0
|
2023-12-17 00:06:04 +00:00
|
|
|
property bool pickingServer: false
|
2023-11-22 23:13:33 +00:00
|
|
|
|
|
|
|
width: 640
|
|
|
|
height: 480
|
|
|
|
visible: true
|
2023-12-03 21:34:16 +00:00
|
|
|
title: "Magpie"
|
2023-11-24 23:48:01 +00:00
|
|
|
|
|
|
|
header: Label {
|
|
|
|
text: stack.currentItem.title
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
}
|
2023-11-22 23:13:33 +00:00
|
|
|
|
2023-11-24 23:48:01 +00:00
|
|
|
StackView {
|
|
|
|
id: stack
|
|
|
|
initialItem: welcome
|
2023-11-22 23:13:33 +00:00
|
|
|
anchors.fill: parent
|
2023-12-17 20:10:27 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: welcome
|
|
|
|
Welcome {
|
|
|
|
onPickServer: stack.push(serverPick)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: serverPick
|
|
|
|
ServerPick {
|
|
|
|
address: API.address
|
|
|
|
onBack: stack.pop()
|
|
|
|
StackView.onActivating: pickingServer = true;
|
|
|
|
StackView.onDeactivating: pickingServer = false;
|
|
|
|
}
|
|
|
|
}
|
2023-12-17 00:06:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: API
|
|
|
|
function onAddressChanged (url) {
|
|
|
|
if (pickingServer && url.toString().length > 0)
|
|
|
|
stack.pop()
|
|
|
|
}
|
2023-11-24 23:48:01 +00:00
|
|
|
}
|
2023-11-22 23:13:33 +00:00
|
|
|
}
|