Files
pyqcrm/Gui/firststart.qml

264 lines
6.7 KiB
QML

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"
}
}