Changed Folder gui to GUI

This commit is contained in:
2024-11-15 15:41:12 +01:00
parent 167d5ff3fe
commit 9f5e4af741
22 changed files with 25 additions and 17 deletions

305
Gui/AddCustomer.qml Normal file
View File

@@ -0,0 +1,305 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Fusion
ColumnLayout
{
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 15
Label
{
text: qsTr("Kunden anlegen")
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
font.pixelSize: 35
}
CheckBox
{
text: qsTr("Ansprechpartner hinzufügen")
Layout.alignment: Qt.AlignRight
checked: false
onCheckStateChanged: addContactLayout.visible = checked
}
RowLayout
{
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 45
GridLayout
{
columns: 2
Layout.fillWidth: true
Layout.fillHeight: true
rowSpacing: 9
Label
{
text: qsTr("Firmenname")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
TextField
{
id: firmenName
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
}
Label
{
text: qsTr("Straße")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
TextField
{
id: street
Layout.fillWidth: true
}
Label
{
text: qsTr("PLZ")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
Layout.fillWidth: true
editable: true
}
Label
{
text: qsTr("Ort")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
TextField
{
id: location
Layout.fillWidth: true
}
Label
{
text: qsTr("Telefon")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
TextField
{
id: telephone
Layout.fillWidth: true
}
Label
{
text: qsTr("E-Mail")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: email
Layout.fillWidth: true
}
Label
{
text: qsTr("Homepage")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: homepage
Layout.fillWidth: true
}
Label
{
text: qsTr("Geschäftsführer")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: ceo
Layout.fillWidth: true
}
Label
{
text: qsTr("USt-IdNr")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: taxno
Layout.fillWidth: true
}
Label
{
text: qsTr("Info")
Layout.alignment: Qt.AlignRight | Qt.AlignTop
}
ScrollView
{
Layout.fillWidth: true
Layout.preferredHeight: 100
TextArea
{
id: customerInfo
background: Rectangle
{
color: customerInfo.palette.base
border.color: customerInfo.activeFocus? customerInfo.palette.highlight: customerInfo.palette.base
}
}
}
}
GridLayout
{
id: addContactLayout
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignTop
columns: 2
rowSpacing: 9
visible: false
Label
{
text: qsTr("Anrede")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
id: title
Layout.fillWidth: true
editable: true
}
Label
{
text: qsTr("Vorname")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: firstname
Layout.fillWidth: true
}
Label
{
text: qsTr("Nachname")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: lastname
Layout.fillWidth: true
}
Label
{
text: qsTr("Position")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
id: jobdescription
Layout.fillWidth: true
editable: true
}
Label
{
text: qsTr("E-Mail")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: emailcontact
Layout.fillWidth: true
}
Label
{
text: qsTr("Telefon")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: telephonecontact
Layout.fillWidth: true
}
Label
{
text: qsTr("Geburtsdatum")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: birthday
Layout.fillWidth: true
}
Label
{
text: qsTr("Priorität")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
id: rank
Layout.fillWidth: true
editable: true
}
Label
{
text: qsTr("Rechnung")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
id: invoice
Layout.fillWidth: true
editable: true
}
Label
{
text: qsTr("Mahnung")
Layout.alignment: Qt.AlignRight
}
ComboBox
{
id: due
Layout.fillWidth: true
editable: true
}
}
}
RowLayout
{
Layout.fillHeight: true
Layout.alignment: Qt.AlignRight
Button
{
text: qsTr("Abbrechen")
onClicked: appLoader.source = "CustomerTables.qml"
}
Button
{
text: qsTr("Speichern")
}
}
Item
{
id: spacer3
Layout.fillHeight: true
}
}

212
Gui/CustomerTables.qml Normal file
View File

@@ -0,0 +1,212 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Qt.labs.qmlmodels
import QtQuick.Controls.Fusion
Item {
anchors.fill: parent
//color: "lightslategrey"
property var availableFilters: ["Name", "Adresse", "PLZ", "Ort"]
id: test
SearchBar
{
id:searchBar
anchors.margins: 9
}
Button
{
id: addBusinessBtn
//icon.source: "../images/addbusiness.svg"
icon.source: "qrc:/images/addbusiness.svg"
icon.color: "olive"
//width: icon.width
anchors.right: parent.right
flat: true
onClicked: appLoader.source = "AddCustomer.qml"
}
ColumnLayout
{
id: tableColumn
anchors
{
top: searchBar.bottom
bottom: parent.bottom
left: parent.left
right: parent.right
}
RowLayout
{
// Layout.fillHeight: true
// Layout.fillWidth: true
RadioButton
{
checked: true
text: qsTr("Alle")
}
RadioButton
{
text: qsTr("Interessent")
}
RadioButton
{
text: qsTr("Kunden")
}
RadioButton
{
text: qsTr("Erledigt")
}
}
HorizontalHeaderView
{
id: horizontalHeader
Layout.fillWidth: true
implicitHeight: 40
movableColumns: true //@disable-check M16
syncView: testTable
delegate: Rectangle {
color: addBusinessBtn.palette.alternateBase
border.color: addBusinessBtn.palette.base
implicitHeight: 40
Layout.fillWidth: true
implicitWidth: 1
Text
{
text: model.display
elide: Text.ElideRight
width: parent.width
height: parent.height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: addBusinessBtn.palette.text
}
}
}
TableView
{
property var customWidths: [0.2, 0.5, 0.3]
property real newWidth: 0
id: testTable
Layout.fillHeight: true
Layout.fillWidth: true
columnSpacing: 1
rowSpacing: 2
model: dbm
alternatingRows: true
resizableColumns: true // @disable-check M16
selectionBehavior: TableView.SelectRows
selectionModel: ItemSelectionModel
{
id: selModel
model: testTable.model
}
// columnWidthProvider: function(column)
// {
// switch (column)
// {
// case 0: return width * 0.2;
// case 1: return width * 0.5;
// case 2: return width * 0.3;
// default: return width / model.columnCount();
// }
//return customWidths[column] * width;
//return tableColumn.content.implicitWidth // model.columnCount()
// newWidth = columnWidth(column)
// return newWidth
// }
// Timer
// {
// running: true
// interval: 3000
// repeat: true
// onTriggered:
// {
// //testTable.columnWidths[2] = 150
// console.log("Timing..")
// testTable.forceLayout();
// }
// }
delegate:Rectangle
{
required property bool selected
required property bool current
implicitWidth: tableColumn.width / testTable.columns
Layout.fillWidth: true
implicitHeight: 25
//color: selected? "lightblue": palette.base
color: selected
? addBusinessBtn.palette.highlight //palette.highlight
: (testTable.alternatingRows && row % 2 !== 0
? addBusinessBtn.palette.base // palette.base
: addBusinessBtn.palette.alternateBase) //palette.alternateBase)
Text
{
//Layout.fillWidth: true
text: model.display
elide: Text.ElideRight
width: parent.width
height: parent.height
verticalAlignment: Text.AlignVCenter
leftPadding: 9 //@d isable-check M16
color: addBusinessBtn.palette.text
}
MouseArea
{
id: mouseArea
property bool hovered:false
anchors.fill: parent
hoverEnabled: true
onClicked:
{
dbm.onRowClicked(row)
}
onEntered:
{
testTable.selectionModel.select(testTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows)
}
}
}
}
Item
{
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}

16
Gui/Dashboard.qml Normal file
View File

@@ -0,0 +1,16 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
ColumnLayout
{
anchors.top: TopBar.bottom
Rectangle
{
color: "blue"
Layout.fillHeight: true
Layout.fillWidth: true
Layout.bottomMargin: 9
}
}

126
Gui/EmployeTables.qml Normal file
View File

@@ -0,0 +1,126 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Qt.labs.qmlmodels
Item {
property var availableFilters: ["Name", "Adresse", "PLZ", "Ort", "Status"]
SearchBar
{
id:searchBar
anchors.margins: 9
}
ColumnLayout
{
anchors
{
top: searchBar.bottom
bottom: parent.bottom
left: parent.left
right: parent.right
}
RowLayout
{
RadioButton
{
checked: true
text: qsTr("Alle")
}
RadioButton
{
text: qsTr("Bewerber")
}
RadioButton
{
text: qsTr("Mitarbeiter")
}
RadioButton
{
text: qsTr("Erledigt")
}
RadioButton
{
text: qsTr("Ausgeschieden")
}
}
HorizontalHeaderView
{
id: horizontalHeader
Layout.fillWidth: true
syncView: testTable
}
TableView
{
id: testTable
Layout.fillHeight: true
Layout.fillWidth: true
columnSpacing: 1
rowSpacing: 2
model: dbm
selectionBehavior: TableView.SelectRows
selectionModel: ItemSelectionModel
{
id: selModel
model: testTable.model
}
delegate:Rectangle
{
required property bool selected
required property bool current
implicitWidth: 200
implicitHeight: 25
color: selected? "lightblue": palette.base
Text
{
Layout.fillWidth: true
text: model.display
}
MouseArea
{
id: mouseArea
property bool hovered:false
anchors.fill: parent
hoverEnabled: true
onClicked:
{
dbm.onRowClicked(row)
testTable.selectionModel.select(testTable.model.index(row, 0), ItemSelectionModel.SelectCurrent | ItemSelectionModel.Rows)
}
}
}
}
}
}

82
Gui/SearchBar.qml Normal file
View File

@@ -0,0 +1,82 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
RowLayout
{
id: searchBar
TextField
{
id: searchField
placeholderText: qsTr("Suche")
leftPadding: 3
rightPadding: 3
Layout.preferredWidth: 300
Button
{
icon.source: "qrc:/images/search.svg"
icon.color: "olive"
x: parent.x + parent.width - width
height: parent.height
flat: true
}
Button
{
id: filterBtn
icon.source: "qrc:/images/filter.svg"
icon.color: "olive"
x: parent.x + parent.width
height: searchField.height
flat: true
onClicked: filterPopup.open()
}
}
Popup
{
id: filterPopup
x: filterBtn.x + filterBtn.width
y: filterBtn.y
width: 100
height: 150
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
contentItem: Item
{
ColumnLayout
{
anchors.fill: parent
//id: filterContent
Repeater
{
model: availableFilters
CheckBox
{
text: model.modelData
onClicked:
{
setFilter(text, checkState)
}
}
}
}
}
}
function setFilter(filter,activated)
{
console.log(filter)
console.log(activated)
}
}

91
Gui/TopBar.qml Normal file
View File

@@ -0,0 +1,91 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
RowLayout
{
id: topBar
spacing: 0
height: 35
width: parent.width
anchors
{
top: parent.top
left: parent.left
}
Button
{
id: dashBoard
flat: true
text: qsTr("Dashboard")
implicitWidth: dashBoard.implicitContentWidth + 10
onClicked:
{
appLoader.source = "Dashboard.qml"
}
}
Button
{
id: kunden
flat: true
text: qsTr("Kunden")
implicitWidth: kunden.implicitContentWidth + 10
onClicked:
{
appLoader.source = "CustomerTables.qml"
}
}
Button
{
id: objekt
flat: true
text: qsTr("Objekt")
implicitWidth: objekt.implicitContentWidth + 10
}
Button
{
id: mitarbeiter
flat: true
text: qsTr("Mitarbeiter")
implicitWidth: mitarbeiter.implicitContentWidth + 10
onClicked:
{
appLoader.source = "EmployeTables.qml"
}
}
Button
{
id: abrechnung
flat: true
text: qsTr("Abrechnung")
implicitWidth: abrechnung.implicitContentWidth + 10
}
Item
{
id: hspacer
Layout.fillWidth: true
}
Button
{
id: atajos
icon.source: "qrc:/images/menu.svg"
icon.color: "red"
flat: true
Layout.rightMargin: 9
}
}

263
Gui/firststart.qml Normal file
View File

@@ -0,0 +1,263 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import "../js/qmldict.js" as Qmldict
// Item {
// benutzername
// passwort
// server
// port
// benutzername(db)
// passwort(db)
// DbName
// type
// }
Item
{
ColumnLayout
{
anchors.fill: parent
TabBar
{
id: bar
Layout.fillWidth: true
TabButton
{
text: qsTr("Benutzer erstellen")
}
TabButton
{
id: dbTab
text: qsTr("Datenbank einrichten")
}
onCurrentIndexChanged:
{
submitBtn.text = currentIndex === 0? "Weiter" : "Speichern"
}
}
StackLayout
{
Layout.fillWidth: true
Layout.fillHeight: true
currentIndex: bar.currentIndex
Layout.margins: 9
id: stackl
Item
{
id: createUser
Layout.fillWidth: parent.width
GridLayout
{
id: createUserGrid
columns: 2
columnSpacing: 5
rowSpacing: 9
anchors.fill: parent
Layout.margins: 9
property string name: "pyqcrm"
Label
{
text: qsTr("Benutzername:")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: benutzerName
placeholderText: qsTr("Hier Benutzername eingeben")
Layout.fillWidth: true
height: 3
property string name: "PYQCRM_ADMIN"
}
Label
{
text: qsTr("Passwort:")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: password
echoMode: TextInput.Password
placeholderText: qsTr("Hier Passwort eingeben")
Layout.fillWidth: true
property string name: "PYQCRM_ADMIN_PASS"
}
Item
{
Layout.fillHeight: true
}
}
}
Item
{
id: settingsDB
Layout.fillWidth: parent.width
GridLayout
{
id: dbGrid
columns: 2
columnSpacing: 5
rowSpacing: 9
anchors.fill: parent
property string name: "database"
Label
{
text: qsTr("DB-Host:")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: dbHost
placeholderText: qsTr("Hier Host eingeben")
Layout.fillWidth: true
property string name: "DB_HOST"
}
Label
{
text: qsTr("DB-Port:")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: dbPort
placeholderText: qsTr("Hier DB-Port eingeben")
Layout.fillWidth: true
property string name: "DB_PORT"
}
Label
{
text: qsTr("DB-Name:")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: dbName
placeholderText: qsTr("Hier DB-Name eingeben")
Layout.fillWidth: true
property string name: "DB_NAME"
}
Label
{
text: qsTr("DB-Benutzername:")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: dbUserName
placeholderText: qsTr("Hier DB-Benutzername eingeben")
Layout.fillWidth: true
property string name: "DB_USER"
}
Label
{
text: qsTr("DB-Passwort:")
Layout.alignment: Qt.AlignRight
}
TextField
{
id: dbPassword
echoMode: TextInput.Password
placeholderText: qsTr("Hier DB-Passwort eingeben")
Layout.fillWidth: true
property string name: "DB_PASS"
}
Item
{
Layout.fillHeight: true
}
}
}
}
RowLayout
{
Layout.margins: 9
Item
{
Layout.fillWidth: true
}
Button
{
id: cancelBtn
text: qsTr("Abbrechen")
onClicked:
{
Qt.quit()
}
}
Button
{
id: submitBtn
text: qsTr("Weiter")
property var grids: [createUserGrid, dbGrid]
property var pyqcrm_conf: ({})
onClicked:
{
if (bar.itemAt(bar.currentIndex) !== dbTab)
{
bar.currentIndex = 1
}
else
{
pyqcrm_conf = Qmldict.func(submitBtn.grids)
if (pyqcrm_conf)
{
config.setConfig(pyqcrm_conf)
appLoader.source = "Dashboard.qml"
topBar.visible = true
}
}
}
}
}
}
Component.onCompleted:
{
appLoader.window.title = "PYQCRM - Einstellungen"
}
}

49
Gui/main.qml Normal file
View File

@@ -0,0 +1,49 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Gui
ApplicationWindow
{
id: appWindow
width: Screen.width * .6
height: Screen.height * .7
visible: true
title: "PYQCRM"
TopBar
{
id:topBar
anchors
{
rightMargin: 9
leftMargin: 9
}
visible: bad_config? false: true
}
Item
{
id: mainView
}
Loader
{
id: appLoader
anchors
{
left: parent.left
right: parent.right
top: topBar.bottom
bottom: parent.bottom
topMargin: 0
rightMargin: 9
leftMargin: 9
}
source: bad_config? "firststart.qml": "Dashboard.qml"
property alias window: appWindow
}
}

2
Gui/qmldir Normal file
View File

@@ -0,0 +1,2 @@
module gui
TopBar 1.0 TopBar.qml

138
Gui/test.qml Normal file
View File

@@ -0,0 +1,138 @@
import QtQuick
import QtQuick.Controls
import Qt.labs.qmlmodels
TableView
{
id: testTable
anchors.fill: parent
columnSpacing: 10
rowSpacing: 2
//boundsBehavior: Flickable.StopAtBounds
model: TableModel
{
TableModelColumn { display: "checked" }
TableModelColumn { display: "amount" }
TableModelColumn { display: "fruitType" }
TableModelColumn { display: "fruitName" }
TableModelColumn { display: "fruitPrice" }
rows:
[
{
checked: "checked",
amount: "amount",
fruitType: "Fruittype",
fruitName: "fruitName",
fruitPrice: "Price"
},
{
checked: true,
amount: 2,
fruitType: "Fruittype",
fruitName: "blabla",
fruitPrice: 1.50
},
{
checked: true,
amount: 1,
fruitType: "Apple",
fruitName: "Granny Smith",
fruitPrice: 1.50
},
{
checked: "true",
amount: 4,
fruitType: "Orange",
fruitName: "Navel",
fruitPrice: 2.50
},
{
checked: "false",
amount: 1,
fruitType: "Banana",
fruitName: "Cavendish",
fruitPrice: 3.50
}
]
}
delegate: DelegateChooser
{
DelegateChoice
{
column: 0
delegate: Text
{
text: model.display
//selectByMouse: true
//implicitWidth: 140
//onVisibleChanged: model.display = "checked"
}
}
DelegateChoice
{
column: 1
delegate: Text
{
text: model.display
//selectByMouse: true
//implicitWidth: 140
//onVisibleChanged: model.display = "amount"
//onLinkHovered: model.display = checked
}
}
DelegateChoice
{
column: 2
delegate: Text
{
text: model.display
//selectByMouse: true
//implicitWidth: 140
//model.display : "fruitType"
}
}
DelegateChoice
{
column: 3
delegate: Text
{
text: model.display
//selectByMouse: true
//implicitWidth: 140
//onVisibleChanged: model.display = "fruitName"
}
}
DelegateChoice
{
column: 4
delegate: Text
{
text: model.display
//selectByMouse: true
//implicitWidth: 140
//onVisibleChanged: model.display = "fruitPrice"
}
}
}
}