/* AdvoTracker - Hotline tracking tool for Advocats * * Copyright 2020 Ralf Zerres * SPDX-License-Identifier: (0BSD or MIT) */ import QtQuick 2.9 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.3 import QtQuick.Controls.Material 2.1 import QtQuick.Controls.Universal 2.1 import Qt.labs.settings 1.0 import RustCode 1.0 // AdvoTracker Module //import de.networkx.AdvoTracker 1.0 as Nwx ApplicationWindow { id: windowMain visible: true property int margin: 5 property bool authenticated: false title: "AdvoTracker" width: minimumWidth height: minimumHeight //minimumWidth: Math.max(toolBarMain.implicitWidth, (advotrackerLabel.implicitWidth + 2 * paneMain.padding)) minimumWidth: Math.max(toolBarMain.implicitWidth, (customerLogo.implicitWidth + 2 * paneMain.padding)) //minimumHeight: columnMain.implicitHeight //minimumWidth: 50 minimumHeight: 680 Settings { id: settings property string style: "Default" } Action { id: actionStackPrevious shortcut: ["Esc", "Back", "Ctrl+Left", "p"] enabled: stackViewMain.depth > 1 onTriggered: { stackViewMain.pop() listViewDrawerMain.currentIndex = -1 } } Action { id: actionStackNext shortcut: ["Ctrl+Right"] enabled: stackViewMain.depth > 1 onTriggered: { listViewDrawerMain.currentIndex = +1 stackViewMain.push(listViewMain.source) } } Action { id: actionStackTest shortcut: ["Ctrl+Alt+t"] enabled: stackViewMain.depth > 1 onTriggered: { listViewDrawerMain.currentIndex = +1 stackView.push("qrc:/TestPage.qml", {user_info: user_data}) } } Action { id: actionAbout text: Nwx.MdiFont.Icon.helpCircleOutline + " " + qsTr("&About") shortcut: "Ctrl+A" onTriggered: dialogAbout.open() } Action { id: actionCopy text: Nwx.MdiFont.Icon.contentCopy + " " + qsTr("&Copy") //iconName: "copy" enabled: (!!activeFocusItem && !!activeFocusItem["copy"]) shortcut: StandardKey.Copy onTriggered: window.activeFocusItem.copy() } Action { id: actionCut text: Nwx.MdiFont.Icon.contentCut + " " + qsTr("Cu&t") //icon.name: "cut" shortcut: StandardKey.Cut //tooltip: "Cut marked text" //shortcut: "Ctrl+X" //onTriggered: window.activeFocusItem.cut() } Action { id: actionExport text: Nwx.MdiFont.Icon.export + " " + qsTr("E&xport") shortcut: "Alt+X" } Action { id: actionMenu shortcut: "Ctrl+M" onTriggered: menuOptions.open() } Action { id: actionQuit text: Nwx.MdiFont.Icon.closeCircleOutline + " " + qsTr("&Quit") icon.name: "eject" shortcut: "Ctrl+Q" onTriggered: quitDialog.open() } Action { id: actionPaste text: Nwx.MdiFont.Icon.contentPaste + " " + qsTr("P&aste") shortcut: StandardKey.Paste //shortcut: "Ctrl+V" onTriggered: window.activeFocusItem.paste() } Action { id: actionSettings text: Nwx.MdiFont.Icon.settings + " " + qsTr("Settings") //shortcut: "Ctrl+S" //onTriggered: window.activeFocusItem.paste() } Action { id: actionUserChange text: Nwx.MdiFont.Icon.accountSettings + " " + qsTr("&User Settings") shortcut: "Ctrl+C" onTriggered: { stackViewMain.push("qrc:/pages/UserPage.qml"); //changeUserDrawer.open() } } Action { id: actionUserNew text: Nwx.MdiFont.Icon.accountPlus + " " + qsTr("&New User") shortcut: "Ctrl+N" onTriggered: { stackViewMain.push("qrc:/pages/NewUserPage.qml"); //newUserDrawer.open() } } Action { id: actionUserRemove text: Nwx.MdiFont.Icon.accountRemove + " " + qsTr("&Remove User") shortcut: "Ctrl+R" onTriggered: { //source: "qrc:/pages/NewUserPage.qml"; stackViewMain.push("qrc:/pages/NewUserPage.qml"); //newUserDrawer.open() } } header: ToolBar { id: toolBarMain Material.foreground: "white" Layout.fillWidth: true RowLayout { spacing: 15 anchors.fill: parent Layout.fillWidth: true ToolButton { id: toolButtonMain //icon.name: stackViewMain.depth > 1 ? "back" : "drawer" text: stackViewMain.depth > 1 ? Nwx.MdiFont.Icon.arrowLeft : Nwx.MdiFont.Icon.menu font.pixelSize: 28 onClicked: { if (stackViewMain.depth > 1) { stackViewMain.pop() listViewDrawerMain.currentIndex = -1 } else { drawerMain.open() } } } Label { id: titleLabel text: listViewDrawerMain.currentItem ? listViewDrawerMain.currentItem.text : "Hiedemann Rechtsanwälte" horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter Layout.fillWidth: true } Label { text: Nwx.MdiFont.Icon.account // only show account-icon, if authentication succeeded opacity: authenticated ? 1.0 : 0 anchors.right: menuMain.left } ToolButton { id: menuMain text: Nwx.MdiFont.Icon.dotsVertical font.pixelSize: 28 action: actionMenu Menu { id: menuOptions title: qsTr("Menu") x: parent.width - width transformOrigin: Menu.TopRight Menu { id: menuEdit title: Nwx.MdiFont.Icon.pencil + " " + qsTr("Edit") //title: qsTr("Edit") MenuItem { id: menuOptionsCut action: actionCut } MenuItem { id: menuOptionsCopy action: actionCopy } MenuItem { id: menuOptionsPaste action: actionPaste } } MenuSeparator { } Menu { id: menuOptionsSettings title: Nwx.MdiFont.Icon.settings + " " + qsTr("Settings") //action: actionSettings MenuItem { text: Nwx.MdiFont.Icon.settingsBox + " " + qsTr("Dialog Settings") //text: qsTr("Dialog Settings") //action: actionDialog onTriggered: dialogSettings.open() } Menu { id: menuUserSettings title: Nwx.MdiFont.Icon.accountSettingsVariant + " " + qsTr("User Settings") //title: qsTr("User Settings") MenuItem { id: menuOptonsUserChange action: actionUserChange } MenuItem { id: menuOptionsUserNew action: actionUserNew } } } MenuSeparator { } MenuItem { id: menuOptionsAbout action: actionAbout } MenuSeparator { } MenuItem { id: menuOptionsQuit action: actionQuit //onPressed: quitDialog.open() } } // menuOptions } } } Drawer { id: drawerMain width: Math.min(windowMain.width, windowMain.height) / 4 * 2 height: Math.min(windowMain.height) / 4 * 2 interactive: stackViewMain.depth === 1 ListView { id: listViewDrawerMain focus: true currentIndex: -1 anchors.fill: parent model: ListModel { ListElement { title: qsTr("Login Page"); source: "qrc:/pages/LoginPage.qml" } ListElement { title: qsTr("List of claims"); source: "qrc:/pages/PageNumberHarmList.qml" } //ListElement { title: qsTr("Case of damage"); source: "qrc:/pages/PageNumberHarm.qml" } ListElement { title: qsTr("List of users"); source: "qrc:/pages/PageUserList.qml" } ListElement { title: qsTr("List of user roles"); source: "qrc:/pages/UserRoleTablePage.qml" } //ListElement { title: qsTr("User Roles List"); source: "qrc:/pages/UserRoleListPage.qml" } //ListElement { title: qsTr("User List"); source: "qrc:/pages/UserListPage.qml" } //ListElement { title: qsTr("User Roles List"); source: "qrc:/pages/UserRoleListPage.qml" } //ListElement { title: qsTr("TableView Page"); source: "qrc:/pages/TableViewPage.qml" } //ListElement { title: qsTr("SqlView Page"); source: "qrc:/pages/SqlViewPage.qml" } ListElement { title: qsTr("List of MaterialIcons"); source: "qrc:/pages/MaterialIconsPage.qml" } ListElement { title: qsTr("Case of damage (static)"); source: "qrc:/pages/PageNumberHarmStatic.qml" } ListElement { title: qsTr("Test UserModel Page"); source: "qrc:/pages/UserModelPage.qml" } ListElement { title: qsTr("Test Page"); source: "qrc:/pages/TestPage.qml" } ListElement { title: qsTr("SqlTest Page"); source: "qrc:/pages/SqlTestPage.qml" } ListElement { title: qsTr("SwipeDelegate Page"); source: "qrc:/pages/SwipeDelegatePage.qml" } } delegate: ItemDelegate { width: parent.width text: model.title //highlighted: listViewDrawerMain.isCurrentItem //highlighted: drawerMain.listviewDrawerMain.isCurrentItem highlighted: ListView.isCurrentItem onPressed: { listViewDrawerMain.currentIndex = index stackViewMain.push(model.source) drawerMain.close() } } } } // drawerMain StackView { id: stackViewMain anchors.fill: parent initialItem: Pane { id: paneMain padding: 15 ColumnLayout { id: columnMain anchors.fill: parent Image { id: customerLogo source: "images/customer_logo.jpg" fillMode: Image.PreserveAspectFit anchors.top: parent.top Layout.fillWidth: true Layout.fillHeight: true Layout.alignment: Qt.AlignHCenter } // customerLogo //Nwx.Label { Label { id: advotrackerLabel text: qsTr("AdvoTracker© - hotline records for advocats") //anchors.top: customerLogo.bottom anchors.bottom: parent.bottom //anchors.topMargin: 12 Layout.alignment: Qt.AlignHCenter //Layout.fillWidth: true //anchors.bottom: networkxRow.top } // advotrackerLabel /* networkxRox RowLayout { id: networkxRow opacity: 0 Layout.alignment: Qt.AlignVCenter | Qt.AlignBaseline //Layout.fillWidth: true //width: paneMain.availableWidth / 6 * 1 //height: paneMain.availableHeight / 6 * 1 anchors.top: advotrackerLabel.bottom anchors.right: parent.right anchors.bottom: parent.bottom //anchors.topMargin: 18 //Layout.minimumWidth: 150 //Layout.preferredWidth: 150 //spacing: 2 Label { id: networkxLabel text: qsTr("created by") antialiasing: true font.pointSize: 9 } Image { id: networkxLogo //anchors.top: networkxLabel source: "images/networkx_logo.jpg" //anchors.right: paneMain.right //anchors.bottom: paneMain.bottom sourceSize.width: 1024 sourceSize.height: 1024 Layout.preferredWidth: sourceSize.width / 15 Layout.preferredHeight: sourceSize.height / 18 //width: paneMain.availableWidth / 10 //height: paneMain.availableHeight / 100 * 8 //text: "© Networkx GmbH" //fillMode: networkxLogo.PreserveAspectFit //fillMode: networkxLogo.PreserveAspectCrop //clip: true } // networkxLogo } // networkxRow */ //networkxRox } // columnViewMain } // paneMain } // stackViewMain Dialog { id: dialogSettings x: Math.round((windowMain.width - width) / 2) y: Math.round(windowMain.height / 6) width: Math.round(Math.min(windowMain.width, windowMain.height) / 3 * 2) modal: true focus: true title: "Settings" standardButtons: Dialog.Ok | Dialog.Cancel onAccepted: { settings.style = styleBox.displayText dialogSettings.close() } onRejected: { styleBox.currentIndex = styleBox.styleIndex dialogSettings.close() } contentItem: ColumnLayout { id: settingsColumn spacing: 20 RowLayout { spacing: 10 //Nwx.Label { Label { text: "Style:" } ComboBox { id: styleBox property int styleIndex: -1 model: availableStyles Component.onCompleted: { styleIndex = find(settings.style, Qt.MatchFixedString) if (styleIndex !== -1) currentIndex = styleIndex } Layout.fillWidth: true } } //Nwx.Label { Label { text: "Restart required" opacity: styleBox.currentIndex !== styleBox.styleIndex ? 1.0 : 0.0 horizontalAlignment: Label.AlignHCenter verticalAlignment: Label.AlignVCenter Layout.fillWidth: true Layout.fillHeight: true } } } // dialogSettings Dialog { id: dialogAbout modal: true focus: true title: "About" width: Math.min(windowMain.width, windowMain.height) / 3 * 2 contentHeight: aboutColumn.height x: (windowMain.width - width) / 2 y: windowMain.height / 6 Column { id: aboutColumn spacing: 20 //Nwx.Label { Label { width: dialogAbout.availableWidth text: "AdvoTracker verwendet Qt." wrapMode: Label.Wrap //font.pixelSize: 12 } //Nwx.Label { Label { width: dialogAbout.availableWidth text: "Mit Qt Quick Controls 2, einer schnellen Multiplattform GUI, " + "ist AdvoTracker bereits bestens für Android und andere " + "mobile Plattformen vorbereitet ..." wrapMode: Label.Wrap //font.pixelSize: 12 } } MouseArea { id: mouseAreaDialogAbout width: parent.width height: parent.height onClicked: dialogAbout.close() } } // dialogAbout Dialog { id: quitDialog modal: true focus: true x: (windowMain.width - width) / 2 y: windowMain.height / 6 standardButtons: Dialog.Ok | Dialog.Cancel onAccepted: { settings.style = styleBox.displayText Qt.quit() } onRejected: { styleBox.currentIndex = styleBox.styleIndex dialogSettings.close() } contentItem: ColumnLayout { id: quitColumn spacing: 20 RowLayout { spacing: 10 //Nwx.Label { Label { text: qsTr("Do you realy want to quit AdvoTracker?") } } } } // dialogQuit Dialog { id: newUserDrawer width: windowMain.width height: windowMain.height //width: Math.min(windowMain.width, parent.height) / 4 * 2 //height: Math.min(windowMain.height) / 4 * 2 title: qsTr("New User") modal: true focus: true enter: Transition { NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 } } exit: Transition { NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 } } Loader { //id: newUserLoader anchors.fill: parent anchors.centerIn: parent //sourceComponent: rect source: "qrc:/pages/NewUserPage.qml" } } // newUserDrawer } // windowMain