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"
Rectangle
{
id: info
anchors.horizontalCenter: parent.horizontalCenter
color: "slateblue"
implicitHeight: 55
implicitWidth: parent.width / 4
y: parent.height / 4
Text
{
ColumnLayout {
anchors.centerIn: parent
spacing: Dimensions.s
height: implicitHeight
H1 {
Layout.alignment: Qt.AlignCenter
text: qsTr("Keine Verbindung zur Datenbank!")
color: "moccasin"
font.bold: true
font.pixelSize: 45
color: Colors.foreground
}
H2 {
Layout.alignment: Qt.AlignCenter
text: qsTr("Programm kann nicht starten…")
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
}
}
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
{
Button {
Layout.topMargin: Dimensions.l
Layout.alignment: Qt.AlignCenter
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()
}
}
}

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,6 +5,8 @@ import Qt.labs.qmlmodels
ColumnLayout
{
property var availableFilters: [""]
anchors.fill: parent
spacing: Dimensions.l
@@ -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)
{
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"
text: qsTr("Abgeschlossen")
selected: false
text: qsTr("Abgeschlossen")
}
ListElement {
name: "Erledigt"
selected: false
text: qsTr("Erledigt")
}
}
ListElement
{
name: "Erledigt"
text: qsTr("Erledigt")
selected: false
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

View File

@@ -6,6 +6,8 @@ import QtQuick.Templates as T
T.ToolButton {
id: control
property string target
checkable: true
icon.color: Colors.foreground
icon.height: 36
@@ -18,16 +20,16 @@ T.ToolButton {
readonly property color color: control.checked ? Colors.primaryShade : control.hovered ? Colors.primary : Colors.foreground
IconLabel {
icon.color: parent.color
icon.source: control.icon.source
icon.height: control.icon.height
icon.width: control.icon.width
color: parent.color
icon.color: parent.color
icon.height: control.icon.height
icon.source: control.icon.source
icon.width: control.icon.width
x: parent.width * .5 - width * .5
}
Label {
font: Typography.small
color: parent.color
font: Typography.small
text: control.text
x: parent.width * .5 - width * .5
}
@@ -49,4 +51,12 @@ T.ToolButton {
onPressed: mouse => mouse.accepted = false
}
onClicked: {
if(!target) {
console.warn(`BarButton with text ${this.text} has no target.`)
return
}
contentStack.replace(target)
}
}

5
TeroStyle/H1.qml Normal file
View File

@@ -0,0 +1,5 @@
import QtQuick
Text {
font: Typography.h1
}

5
TeroStyle/H2.qml Normal file
View File

@@ -0,0 +1,5 @@
import QtQuick
Text {
font: Typography.h2
}

View File

@@ -2,14 +2,13 @@ module TeroStyle
singleton Colors Colors.qml
singleton Dimensions Dimensions.qml
singleton Typography Typography.qml
BarButton BarButton.qml
Button Button.qml
ComboBox ComboBox.qml
Field Field.qml
TextField TextField.qml
BarButton BarButton.qml
H1 H1.qml
H2 H2.qml
Label Label.qml
QuickFilter QuickFilter.qml
SearchBar SearchBar.qml
TextField TextField.qml

View File

@@ -1,4 +0,0 @@
# pyqcrm
CRM - Tero
Python + QML

View File

@@ -12,7 +12,6 @@ class EmployeeModel(QAbstractTableModel):
__visible_index = None
__visible_columns = None
__col_name = ""
__employee_dao = None
__col_skip = 2
__everyone = True

14
qml.qrc
View File

@@ -7,24 +7,22 @@
<file>Gui/LoginScreen.qml</file>
<file>Gui/AddContact.qml</file>
<file>Gui/AddCustomer.qml</file>
<file>Gui/CustomerTable.qml</file>
<file>Gui/Dashboard.qml</file>
<file>Gui/main.qml</file>
<file>js/qmldict.js</file>
<file>Gui/CustomerView.qml</file>
<file>Gui/NoDbConnection.qml</file>
<file>Gui/Notifications.qml</file>
<file>Gui/ObjectTable.qml</file>
<file>Gui/AddObject.qml</file>
<file>Gui/ObjectView.qml</file>
<file>Gui/ObjectAddOns.qml</file>
<file>Gui/ObjectAddOnContactPerson.qml</file>
<file>Gui/ObjectAddOnEmployee.qml</file>
<file>Gui/AddObjectEmployee.qml</file>
<file>Gui/ApplicantPersonalData.qml</file>
<file>Gui/ApplicantBankData.qml</file>
<file>Gui/ApplicantNationalInsurance.qml</file>
<file>Gui/ApplicantVarious.qml</file>
<file>Gui/Employees/ApplicantPersonalData.qml</file>
<file>Gui/Employees/ApplicantBankData.qml</file>
<file>Gui/Employees/ApplicantNationalInsurance.qml</file>
<file>Gui/Employees/ApplicantVarious.qml</file>
<file>Gui/CustomersTable.qml</file>
<file>Gui/CustomerDetails.qml</file>
<file>Gui/ObjectsTable.qml</file>
@@ -43,11 +41,9 @@
<file>Gui/MiscConf.qml</file>
<file>Gui/UtilityDialogs.qml</file>
<file>Gui/OffersTable.qml</file>
<file>Gui/OfferTable.qml</file>
<file>Gui/Employees/AddApplicant.qml</file>
<file>Gui/Employees/EmployeeDetails.qml</file>
<file>Gui/Employees/EmployeesTable.qml</file>
<file>Gui/Employees/EmployeesView.qml</file>
<file>Gui/Employees/qmldir</file>
<file>TeroStyle/BarButton.qml</file>
<file>TeroStyle/Button.qml</file>
@@ -55,6 +51,8 @@
<file>TeroStyle/ComboBox.qml</file>
<file>TeroStyle/Dimensions.qml</file>
<file>TeroStyle/Field.qml</file>
<file>TeroStyle/H1.qml</file>
<file>TeroStyle/H2.qml</file>
<file>TeroStyle/Label.qml</file>
<file>TeroStyle/qmldir</file>
<file>TeroStyle/QuickFilter.qml</file>