2024-07-11 10:49:13 +02:00
|
|
|
import QtQuick 2.15
|
2024-07-11 10:39:35 +02:00
|
|
|
import QtQuick.Window 2.15
|
|
|
|
import QtQuick.Layouts 2.15
|
2024-07-10 15:00:00 +02:00
|
|
|
import QtQuick.Controls 2.15
|
2024-07-08 16:08:21 +02:00
|
|
|
|
|
|
|
Window {
|
2024-07-09 17:50:34 +02:00
|
|
|
SystemPalette { id: activeColors; colorGroup: SystemPalette.Active }
|
|
|
|
SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Inactive }
|
|
|
|
SystemPalette { id: disabledColors; colorGroup: SystemPalette.Disabled }
|
2024-07-09 12:36:14 +02:00
|
|
|
|
2024-07-09 18:04:57 +02:00
|
|
|
function getColors() {
|
|
|
|
return root.active ? activeColors : inactiveColors;
|
|
|
|
}
|
|
|
|
|
2024-07-08 16:08:21 +02:00
|
|
|
id: root
|
2024-07-12 10:28:08 +02:00
|
|
|
width: 1000
|
|
|
|
height: 600
|
2024-07-08 16:08:21 +02:00
|
|
|
visible: true
|
2024-07-09 18:04:57 +02:00
|
|
|
color: getColors().window
|
2024-07-08 16:08:21 +02:00
|
|
|
|
2024-07-11 11:05:07 +02:00
|
|
|
title: qsTr("Alisa - License Management")
|
2024-07-08 16:08:21 +02:00
|
|
|
|
2024-07-11 10:49:13 +02:00
|
|
|
property string authToken: ""
|
2024-07-10 22:24:28 +02:00
|
|
|
|
2024-07-11 10:49:13 +02:00
|
|
|
StackView {
|
|
|
|
id: stackView
|
|
|
|
anchors.fill: parent
|
|
|
|
initialItem: loginPageComponent
|
2024-07-10 12:40:38 +02:00
|
|
|
}
|
2024-07-09 18:37:01 +02:00
|
|
|
|
2024-07-11 10:49:13 +02:00
|
|
|
Component {
|
|
|
|
id: loginPageComponent
|
|
|
|
LoginScreen {
|
2024-07-11 11:41:24 +02:00
|
|
|
onLoginSuccess: function(token) {
|
2024-07-11 15:14:23 +02:00
|
|
|
root.authToken = token;
|
2024-07-11 11:41:24 +02:00
|
|
|
stackView.push(mainPageComponent);
|
2024-07-10 12:40:38 +02:00
|
|
|
}
|
2024-07-09 18:37:01 +02:00
|
|
|
}
|
2024-07-08 16:08:21 +02:00
|
|
|
}
|
2024-07-11 10:02:24 +02:00
|
|
|
|
2024-07-11 10:49:13 +02:00
|
|
|
Component {
|
|
|
|
id: mainPageComponent
|
|
|
|
MainPage {
|
2024-07-11 15:14:23 +02:00
|
|
|
id: mainPage
|
|
|
|
authToken: root.authToken
|
2024-07-11 11:25:08 +02:00
|
|
|
onLogout: {
|
|
|
|
stackView.push(loginPageComponent)
|
|
|
|
}
|
2024-07-11 15:14:23 +02:00
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
// Update authToken when MainPage is created
|
|
|
|
authToken = root.authToken;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onAuthTokenChanged: {
|
|
|
|
if (stackView.currentItem && stackView.currentItem.authToken !== undefined) {
|
|
|
|
stackView.currentItem.authToken = authToken;
|
2024-07-10 16:21:26 +02:00
|
|
|
}
|
|
|
|
}
|
2024-07-08 16:08:21 +02:00
|
|
|
}
|