Use common StackView

This commit is contained in:
Yuri Becker
2025-04-03 13:06:37 +02:00
parent f172468ba6
commit 3083406b1b
35 changed files with 131 additions and 277 deletions

View File

@@ -59,7 +59,7 @@ ColumnLayout
Button
{
text: qsTr("Abbrechen")
onClicked: appLoader.source = "CustomerTable.qml"
onClicked: contentStack.pop()
}
Button
{
@@ -72,7 +72,7 @@ ColumnLayout
{
new_business = JsLib.parseForm(customerView)
business_model.addBusiness(new_business, 0)
appLoader.source = "CustomerTable.qml"
contentStack.pop()
}
else
{
@@ -99,7 +99,7 @@ ColumnLayout
{
var con_id = arguments[0]
business_model.addBusiness(new_business, con_id)
appLoader.source = "CustomerTable.qml"
contentStack.pop()
}
}

View File

@@ -61,7 +61,7 @@ ColumnLayout
Button
{
text: qsTr("Abbrechen")
onClicked: appLoader.source = "ObjectTable.qml"
onClicked: contentStack.pop()
}
Button
{
@@ -105,7 +105,7 @@ ColumnLayout
object_model.viewCriterion("Alle")
}
appLoader.source = "ObjectTable.qml"
contentStack.pop()
}
}

View File

@@ -47,7 +47,7 @@ ColumnLayout
Button
{
text: qsTr("Abbrechen")
onClicked: appLoader.source = "OfferTable.qml"
onClicked: contentStack.pop()
}
Button
{

View File

@@ -12,8 +12,7 @@ ColumnLayout
Button
{
text: qsTr("Zurück")
//Layout.columnSpan: 2
onClicked: customersStack.pop()
onClicked: contentStack.pop()
}
SplitView

View File

@@ -1,21 +0,0 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Qt.labs.qmlmodels
Item {
anchors.fill: parent
property var availableFilters: ["Name", "Adresse", "PLZ", "Ort"]
StackView
{
id: customersStack
anchors.fill: parent
initialItem: "CustomersTable.qml"
}
}

View File

@@ -4,6 +4,7 @@ import QtQuick.Controls
import Qt.labs.qmlmodels
ColumnLayout {
property var availableFilters: ["Name", "Adresse", "PLZ", "Ort"]
function viewCriterion(criterion)
{
@@ -15,7 +16,7 @@ ColumnLayout {
anchors.fill: parent
spacing: Dimensions.l
Component.onCompleted: customersStack.pop()
Component.onCompleted: contentStack.pop()
RowLayout
{
@@ -67,7 +68,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignRight
icon.source: "qrc:/images/PlusCircle.svg"
text: qsTr("Kunde Hinzufügen")
onClicked: appLoader.source = "AddCustomer.qml"
onClicked: contentStack.push("AddCustomer.qml")
}
}
ColumnLayout
@@ -153,7 +154,7 @@ ColumnLayout {
onDoubleClicked: {
business_model.onRowClicked(row);
customersStack.push("CustomerDetails.qml", {
contentStack.push("CustomerDetails.qml", {
selectedClient: row
});
}

View File

@@ -114,7 +114,7 @@ ColumnLayout
Button
{
text: qsTr("Abbrechen")
onClicked: appLoader.source = "Employees/EmployeesView.qml"
onClicked: contentStack.pop()
}
Button
{
@@ -156,7 +156,7 @@ ColumnLayout
console.log('addedsuccesfully')
else
console.log('failedtoadd')
appLoader.source = 'Employees/EmployeesView.qml'
contentStack.pop()
}
function checkFields()

View File

@@ -16,7 +16,7 @@ Item
Button
{
text: qsTr("Mitarbeiter zeigen")
onClicked: employeesStack.pop()
onClicked: contentStack.pop()
}
}

View File

@@ -47,7 +47,7 @@ ColumnLayout {
icon.source: "qrc:/images/PlusCircle.svg"
text: qsTr("Mitarbeiter Hinzufügen")
onClicked: appLoader.source = "Employees/AddApplicant.qml"
onClicked: contentStack.push("AddApplicant.qml")
}
}
HorizontalHeaderView {
@@ -114,7 +114,7 @@ ColumnLayout {
hoverEnabled: true
onDoubleClicked: {
employeesStack.push("EmployeeDetails.qml", {
contentStack.push("EmployeeDetails.qml", {
selectedEmployee: row
});
}

View File

@@ -1,16 +0,0 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Qt.labs.qmlmodels
Item {
anchors.fill: parent
StackView {
id: employeesStack
anchors.fill: parent
initialItem: "EmployeesTable.qml"
}
}

View File

@@ -77,7 +77,7 @@ Item
title: qsTr("Wiederherstellen")
buttons: MessageDialog.Yes | MessageDialog.No
onAccepted: recoveryPaswordDialog.open()
onRejected: gotoLogin()
onRejected: contentStack.replace("LoginSreen.qml")
}
MessageDialog
@@ -147,7 +147,7 @@ Item
if (!adminAvailable) config.saveRecoveryKey(saveRecoveryDialog.currentFile, recpass)
else config.getRecoveryKey(saveRecoveryDialog.currentFile, recpass)
gotoLogin()
contentStack.replace("LoginSreen.qml")
}
onRejected:

View File

@@ -4,20 +4,19 @@ import QtQuick.Controls
import QtQuick.Dialogs
import QtQuick.Layouts
Item {
property string recpass: ""
function dbConnectionFailed(msg) {
oschkar.notificationBox.informativeText = msg;
oschkar.notificationBox.text = "Verbindung zum Datenbankserver verloren";
oschkar.notificationBox.open();
notifications.notificationDialog.informativeText = msg;
notifications.notificationDialog.text = "Verbindung zum Datenbankserver verloren";
notifications.notificationDialog.open();
}
function getEncryptionKey() {
recoveryPaswordDialog.open();
}
function loggedin() {
appLoader.source = "Dashboard.qml";
contentStack.replace("Dashboard.qml");
}
anchors.fill: parent
@@ -79,8 +78,8 @@ Item {
}
Button {
Layout.topMargin: Dimensions.m
implicitWidth: parent.width
icon.source: "qrc:/images/ArrowRightEndOnRectangle.svg"
implicitWidth: parent.width
text: qsTr("Login")
onClicked: {
@@ -132,8 +131,7 @@ Item {
onRejected: quit()
}
Notifications {
id: oschkar
id: notifications
}
}
}

View File

@@ -19,10 +19,7 @@ ColumnLayout {
ButtonGroup.group: buttonBar
icon.source: "qrc:/images/dash.svg"
text: qsTr("Dashboard")
onClicked: {
appLoader.source = "Dashboard.qml";
}
target: "/Gui/Dashboard.qml"
}
BarButton {
id: kunden
@@ -30,10 +27,7 @@ ColumnLayout {
ButtonGroup.group: buttonBar
icon.source: "qrc:/images/customer.svg"
text: qsTr("Kunden")
onClicked: {
appLoader.source = "CustomerTable.qml";
}
target: "/Gui/CustomersTable.qml"
}
BarButton {
id: objekt
@@ -41,10 +35,7 @@ ColumnLayout {
ButtonGroup.group: buttonBar
icon.source: "qrc:/images/object.svg"
text: qsTr("Objekt")
onClicked: {
appLoader.source = "ObjectTable.qml";
}
target: "/Gui/ObjectsTable.qml"
}
BarButton {
id: mitarbeiter
@@ -52,10 +43,7 @@ ColumnLayout {
ButtonGroup.group: buttonBar
icon.source: "qrc:/images/employee.svg"
text: qsTr("Mitarbeiter")
onClicked: {
appLoader.source = "Employees/EmployeesView.qml";
}
target: "/Gui/Employees/EmployeesTable.qml"
}
BarButton {
id: offers
@@ -63,10 +51,7 @@ ColumnLayout {
ButtonGroup.group: buttonBar
icon.source: "qrc:/images/offer.svg"
text: qsTr("Angebote")
onClicked: {
appLoader.source = "OfferTable.qml";
}
target: "/Gui/OffersTable.qml"
}
BarButton {
id: abrechnung
@@ -101,7 +86,7 @@ ColumnLayout {
onTriggered: {
// TODO: Check if logged-in user is admin first!!
appLoader.source = "PyqcrmConf.qml";
contentStack.push("PyqcrmConf.qml");
}
}
MenuSeparator {

View File

@@ -1,74 +1,27 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Rectangle
{
anchors.fill: parent
color: "slateblue"
ColumnLayout {
anchors.centerIn: parent
spacing: Dimensions.s
height: implicitHeight
Rectangle
{
id: info
anchors.horizontalCenter: parent.horizontalCenter
color: "slateblue"
implicitHeight: 55
implicitWidth: parent.width / 4
y: parent.height / 4
Text
{
anchors.centerIn: parent
text: qsTr("Keine Verbindung zur Datenbank!")
color: "moccasin"
font.bold: true
font.pixelSize: 45
}
H1 {
Layout.alignment: Qt.AlignCenter
text: qsTr("Keine Verbindung zur Datenbank!")
color: Colors.foreground
}
Rectangle
{
id: nostart
anchors.top: info.bottom
color: "slateblue"
anchors.horizontalCenter: parent.horizontalCenter
implicitHeight: 55
implicitWidth: parent.width / 4
Text
{
text: qsTr("Programm kann nicht starten..")
color: "moccasin"
anchors.centerIn: parent
font.bold: true
font.pixelSize: 45
}
H2 {
Layout.alignment: Qt.AlignCenter
text: qsTr("Programm kann nicht starten…")
color: Colors.foreground
}
Button {
Layout.topMargin: Dimensions.l
Layout.alignment: Qt.AlignCenter
text: qsTr("Beenden")
Rectangle
{
anchors.top: nostart.bottom
anchors.topMargin: 25
anchors.horizontalCenter: parent.horizontalCenter
color: "slateblue"
implicitHeight: 55
implicitWidth: parent.width / 4
Button
{
width: parent.width
height: 75
Text
{
text: qsTr("Beenden")
color: "moccasin"
anchors.centerIn: parent
font.bold: true
font.pixelSize: 45
}
anchors.centerIn: parent
background: Rectangle
{
color: "dodgerblue"
radius: 50
}
onClicked: Qt.quit()
}
onClicked: Qt.quit()
}
}

View File

@@ -3,8 +3,6 @@ import QtQuick.Dialogs
Item
{
id: oschkar
property alias notificationBox: notificationDialog
MessageDialog
{
id: notificationDialog

View File

@@ -16,7 +16,7 @@ Item
Button
{
text: qsTr("Zurück zu den Objekten")
onClicked: objectsStack.pop()
onClicked: contentStack.pop()
}
}

View File

@@ -1,22 +0,0 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Qt.labs.qmlmodels
Item {
property var availableFilters: [""]
anchors.fill: parent
StackView
{
id: objectsStack
anchors.fill: parent
initialItem: "ObjectsTable.qml"
}
}

View File

@@ -5,9 +5,11 @@ import Qt.labs.qmlmodels
ColumnLayout
{
property var availableFilters: [""]
anchors.fill: parent
spacing: Dimensions.l
function viewCriterion(criterion)
{
business_model.viewCriterion(criterion.text);
@@ -21,7 +23,7 @@ ColumnLayout
Component.onCompleted:
{
contact_model.objectContactAdded.connect(onObjectContactAdded)
objectsStack.pop()
contentStack.pop()
}
RowLayout
{
@@ -70,7 +72,7 @@ ColumnLayout
icon.source: "qrc:/images/PlusCircle.svg"
text: qsTr("Objekt Hinzufügen")
Layout.alignment: Qt.AlignRight
onClicked: appLoader.source = "AddObject.qml"
onClicked: contentStack.push("AddObject.qml")
}
}
@@ -172,7 +174,7 @@ ColumnLayout
hoverEnabled: true
onDoubleClicked:
{
objectsStack.push("ObjectDetails.qml", {selectedObject: row});
contentStack.push("ObjectDetails.qml", {selectedObject: row});
}
onEntered:
{

View File

@@ -1,17 +0,0 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Qt.labs.qmlmodels
Item
{
anchors.fill: parent
StackView
{
id: offersStack
anchors.fill: parent
initialItem: "OffersTable.qml"
}
}

View File

@@ -3,75 +3,64 @@ import QtQuick.Layouts
import QtQuick.Controls
import Qt.labs.qmlmodels
ColumnLayout
{
anchors.fill: parent
spacing: Dimensions.l
function viewOffers(criterion)
{
//offer_model.viewCriterion(criterion)
ColumnLayout {
function viewOffers(criterion) {
//offer_model.viewCriterion(criterion)
}
RowLayout
{
anchors.fill: parent
spacing: Dimensions.l
RowLayout {
Layout.fillWidth: true
spacing: Dimensions.l
SearchBar
{
SearchBar {
id: searchBar
}
QuickFilter
{
onSelectedChanged: (name) =>
{
business_model.viewCriterion(name)
}
model: ListModel
{
ListElement
{
QuickFilter {
model: ListModel {
ListElement {
name: "Alle"
text: qsTr("Alle")
selected: true
text: qsTr("Alle")
}
ListElement
{
ListElement {
name: "Offen"
selected: false
text: qsTr("Offen")
selected: false
}
ListElement
{
ListElement {
name: "Abgeschlossen"
selected: false
text: qsTr("Abgeschlossen")
selected: false
}
ListElement
{
ListElement {
name: "Erledigt"
text: qsTr("Erledigt")
selected: false
text: qsTr("Erledigt")
}
}
onSelectedChanged: name => {
business_model.viewCriterion(name);
}
}
Button
{
Button {
id: addOfferBtn
text: qsTr("Angebote Hinzufügen")
icon.source: "qrc:/images/PlusCircle.svg"
Layout.alignment: Qt.AlignRight
flat: true
onClicked: appLoader.source = "AddOffer.qml"
icon.source: "qrc:/images/PlusCircle.svg"
text: qsTr("Angebote Hinzufügen")
onClicked: contentStack.push("AddOffer.qml")
}
}
Item {
id: spacer
Layout.fillHeight: true
}
}

View File

@@ -101,7 +101,7 @@ Item
Button
{
text: qsTr("Ablehnen")
onClicked: appLoader.source = "Dashboard.qml"
onClicked: contentStack.pop()
}
Button

View File

@@ -97,7 +97,7 @@ Item
title: qsTr("Wiederherstellen")
buttons: MessageDialog.Yes | MessageDialog.No
onAccepted: recoveryPasswordDialog.open()
onRejected: gotoLogin()
onRejected: contentStack.replace("LoginSreen.qml")
}
MessageDialog

View File

@@ -10,10 +10,6 @@ ApplicationWindow {
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);
@@ -30,16 +26,15 @@ ApplicationWindow {
width: Screen.width * .75
Component.onCompleted: {
config.configurationReady.connect(goToLogin);
systray.activated.connect(showWindow);
if (bad_config) {
importDialog.open();
} else {
if (db_con)
appLoader.source = "LoginScreen.qml";
contentStack.replace("LoginScreen.qml")
else
appLoader.source = "NoDbConnection.qml";
contentStack.replace("NoDbConnection.qml");
}
}
onClosing: close => {
@@ -63,7 +58,7 @@ ApplicationWindow {
Navigation {
id: navigation
visible: bad_config || !db_con ? false : true
visible: !(bad_config || !db_con)
}
PrinterDialog {
id: printerDialog
@@ -82,17 +77,15 @@ ApplicationWindow {
id: contentBackground
anchors {
bottom: parent.bottom
left: navigation.right
left: navigation.visible ? navigation.right : parent.left
right: parent.right
top: parent.top
}
color: Colors.background
}
Loader {
id: appLoader
property alias window: appWindow
StackView {
id: contentStack
anchors {
fill: contentBackground
@@ -109,7 +102,7 @@ ApplicationWindow {
title: qsTr("Einstellungen importieren")
onAccepted: settingsFiledialog.open()
onRejected: appLoader.source = "Firststart.qml"
onRejected: contentStack.replace("Firststart.qml")
}
FileDialog {
id: settingsFiledialog