Fix up Menu

This commit is contained in:
Yuri Becker
2025-03-25 12:28:30 +01:00
parent 445c183e71
commit 309f1f58d7
8 changed files with 217 additions and 296 deletions

View File

@@ -4,173 +4,148 @@ import QtQuick.Controls
import QtQuick.Dialogs
import QtCore
ApplicationWindow
{
ApplicationWindow {
id: appWindow
width: Screen.width * .75
height: Screen.height * .85
visible: true
title: "TERO Personal"
font: Typography.body
color: Colors.mantle
property string confile: ""
property alias settingsFileDialog: settingsFiledialog
function goToLogin() {
appLoader.source = "LoginScreen.qml";
navigation.visible = true;
}
function showWindow(why) {
if (why === 3) {
systray.setVisible(false);
appWindow.show();
}
}
color: Colors.mantle
font: Typography.body
height: Screen.height * .85
palette.text: Colors.foreground
title: "TERO Personal"
visible: true
width: Screen.width * .75
Component.onCompleted: {
config.configurationReady.connect(goToLogin);
systray.activated.connect(showWindow);
TopBar
{
id:topBar
visible: bad_config || !db_con ? false: true
if (bad_config) {
importDialog.open();
} else {
if (db_con)
appLoader.source = "LoginScreen.qml";
else
appLoader.source = "NoDbConnection.qml";
}
}
onClosing: close => {
if (false) {
console.log("Main window closed!! Was soll ich tun? kann ich mich beenden?!");
}
}
onVisibilityChanged: {
if (appWindow.visibility === Window.Minimized && config.systray()) {
systray.setVisible(true);
appWindow.hide();
}
}
onWindowStateChanged: windowState => {
if (windowState !== Qt.WindowMinimized) {
systray.setVisible(false);
appWindow.show();
}
}
PrinterDialog
{
Navigation {
id: navigation
visible: bad_config || !db_con ? false : true
}
PrinterDialog {
id: printerDialog
}
ReadMe
{
}
ReadMe {
id: readMeWin
}
Item
{
}
Item {
id: mainView
}
Loader
{
id: appLoader
anchors
{
left: topBar.right
Rectangle {
id: contentBackground
anchors {
bottom: parent.bottom
left: navigation.right
right: parent.right
top: parent.top
bottom: parent.bottom
topMargin: Dimensions.l
bottomMargin: Dimensions.l
rightMargin: Dimensions.l
leftMargin: Dimensions.l
}
color: Colors.background
}
Loader {
id: appLoader
property alias window: appWindow
anchors {
fill: contentBackground
margins: Dimensions.l
}
}
Dialog
{
Dialog {
id: importDialog
modal: true
anchors.centerIn: parent
modal: true
standardButtons: Dialog.Yes | Dialog.No
onAccepted: settingsFiledialog.open()
onRejected: appLoader.source= "Firststart.qml"
title: qsTr("Einstellungen importieren")
onAccepted: settingsFiledialog.open()
onRejected: appLoader.source = "Firststart.qml"
}
FileDialog
{
FileDialog {
id: settingsFiledialog
title: qsTr("PYQCRM Einstellungen")
currentFolder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]
modality: "ApplicationModal"
nameFilters: [qsTr("PYQCRM Einstellungen (*.pyqrec)")]
onAccepted:
{
exportFilePassword.open()
confile = selectedFile
title: qsTr("PYQCRM Einstellungen")
onAccepted: {
exportFilePassword.open();
confile = selectedFile;
}
}
Dialog
{
Dialog {
id: exportFilePassword
modal: true
title: qsTr("PYQCRM Einstellungen")
anchors.centerIn: parent
modal: true
standardButtons: Dialog.Ok | Dialog.Cancel
title: qsTr("PYQCRM Einstellungen")
onAccepted: config.importConfig(confile, exportPasswordInput.text)
ColumnLayout
{
RowLayout
{
Label
{
ColumnLayout {
RowLayout {
Label {
text: qsTr("Passwort eingeben:")
}
TextField
{
TextField {
id: exportPasswordInput
echoMode: TextInput.Password
implicitWidth: 300
}
}
}
}
Component.onCompleted:
{
config.configurationReady.connect(goToLogin)
systray.activated.connect(showWindow)
if(bad_config)
{
importDialog.open()
}
else
{
if (db_con) appLoader.source= "LoginScreen.qml"
else appLoader.source= "NoDbConnection.qml"
}
}
function showWindow(why)
{
if (why === 3)
{
systray.setVisible(false)
appWindow.show()
}
}
onVisibilityChanged:
{
if (appWindow.visibility === Window.Minimized && config.systray())
{
systray.setVisible(true)
appWindow.hide()
}
}
onWindowStateChanged: (windowState) =>
{
if (windowState !== Qt.WindowMinimized)
{
systray.setVisible(false)
appWindow.show()
}
}
onClosing: (close) =>
{
if (false)
{
console.log("Main window closed!! Was soll ich tun? kann ich mich beenden?!")
}
}
function goToLogin()
{
appLoader.source= "LoginScreen.qml"
topBar.visible = true
}
}