62 lines
1.5 KiB
QML
62 lines
1.5 KiB
QML
import QtQuick 2.15
|
|
import QtQuick.Window 2.15
|
|
import QtQuick.Layouts 2.15
|
|
import QtQuick.Controls 2.15
|
|
|
|
Window {
|
|
SystemPalette { id: activeColors; colorGroup: SystemPalette.Active }
|
|
SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Inactive }
|
|
SystemPalette { id: disabledColors; colorGroup: SystemPalette.Disabled }
|
|
|
|
function getColors() {
|
|
return root.active ? activeColors : inactiveColors;
|
|
}
|
|
|
|
id: root
|
|
width: 1000
|
|
height: 600
|
|
visible: true
|
|
color: getColors().window
|
|
|
|
title: qsTr("Alisa - License Management")
|
|
|
|
property string authToken: ""
|
|
|
|
StackView {
|
|
id: stackView
|
|
anchors.fill: parent
|
|
initialItem: loginPageComponent
|
|
}
|
|
|
|
Component {
|
|
id: loginPageComponent
|
|
LoginScreen {
|
|
onLoginSuccess: function(token) {
|
|
root.authToken = token;
|
|
stackView.push(mainPageComponent);
|
|
}
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: mainPageComponent
|
|
MainPage {
|
|
id: mainPage
|
|
authToken: root.authToken
|
|
onLogout: {
|
|
stackView.push(loginPageComponent)
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
// Update authToken when MainPage is created
|
|
authToken = root.authToken;
|
|
}
|
|
}
|
|
}
|
|
|
|
onAuthTokenChanged: {
|
|
if (stackView.currentItem && stackView.currentItem.authToken !== undefined) {
|
|
stackView.currentItem.authToken = authToken;
|
|
}
|
|
}
|
|
}
|