FirstStart angepasst
This commit is contained in:
72
Gui/AdminUserConfig.qml
Normal file
72
Gui/AdminUserConfig.qml
Normal file
@@ -0,0 +1,72 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
GridLayout
|
||||
{
|
||||
id: createUserGrid
|
||||
columns: 2
|
||||
columnSpacing: 5
|
||||
rowSpacing: 9
|
||||
// anchors.fill: parent
|
||||
|
||||
property string name: "pyqcrm"
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Admin User erstellen")
|
||||
font.pixelSize: 40
|
||||
Layout.columnSpan: 2
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
padding: 15
|
||||
}
|
||||
|
||||
|
||||
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"
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Info:")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: gecos
|
||||
placeholderText: qsTr("Zusätzliche Info")
|
||||
Layout.fillWidth: true
|
||||
property string name: "PYQCRM_ADMIN_INFO"
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
@@ -182,7 +182,7 @@ Item {
|
||||
MouseArea
|
||||
{
|
||||
id: mouseArea
|
||||
property bool hovered:false
|
||||
property bool hovered: false
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
104
Gui/DbConfiguration.qml
Normal file
104
Gui/DbConfiguration.qml
Normal file
@@ -0,0 +1,104 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
|
||||
GridLayout
|
||||
{
|
||||
// property alias firstStart: firstStartGrid
|
||||
id: dbGrid
|
||||
columns: 2
|
||||
columnSpacing: 5
|
||||
rowSpacing: 9
|
||||
|
||||
property string name: "database"
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Datenbank Einstellungen")
|
||||
font.pixelSize: 40
|
||||
Layout.columnSpan: 2
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
padding: 15
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
45
Gui/EncryptionKey.qml
Normal file
45
Gui/EncryptionKey.qml
Normal file
@@ -0,0 +1,45 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
GridLayout
|
||||
{
|
||||
id: passEncryptKeyGrid
|
||||
columns: 2
|
||||
columnSpacing: 5
|
||||
rowSpacing: 9
|
||||
// anchors.fill: parent
|
||||
|
||||
property string name: "pyqcrm"
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Encryption Key eingeben")
|
||||
font.pixelSize: 40
|
||||
Layout.columnSpan: 2
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
padding: 15
|
||||
}
|
||||
|
||||
|
||||
Label
|
||||
{
|
||||
text: qsTr("Encryption Key:")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: passEncryptKey
|
||||
placeholderText: qsTr("Hier Encryption Key eingeben")
|
||||
Layout.fillWidth: true
|
||||
height: 3
|
||||
echoMode: TextInput.Password
|
||||
property string name: "ENCRYPT_KEY"
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
@@ -22,255 +22,79 @@ import "../js/qmldict.js" as Qmldict
|
||||
|
||||
Item
|
||||
{
|
||||
ColumnLayout
|
||||
anchors.fill: parent
|
||||
StackView
|
||||
{
|
||||
id: firstStart
|
||||
anchors.fill: parent
|
||||
TabBar
|
||||
initialItem: "DbConfiguration.qml"
|
||||
}
|
||||
RowLayout
|
||||
{
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: 9
|
||||
width: parent.width
|
||||
|
||||
|
||||
Item
|
||||
{
|
||||
id: bar
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
TabButton
|
||||
Button
|
||||
{
|
||||
id: cancelBtn
|
||||
text: qsTr("Abbrechen")
|
||||
onClicked:
|
||||
{
|
||||
text: qsTr("Benutzer erstellen")
|
||||
}
|
||||
|
||||
TabButton
|
||||
|
||||
{
|
||||
id: dbTab
|
||||
text: qsTr("Datenbank einrichten")
|
||||
|
||||
}
|
||||
|
||||
onCurrentIndexChanged:
|
||||
{
|
||||
submitBtn.text = currentIndex === 0? "Weiter" : "Speichern"
|
||||
Qt.quit()
|
||||
}
|
||||
}
|
||||
|
||||
StackLayout
|
||||
Button
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
currentIndex: bar.currentIndex
|
||||
Layout.margins: 9
|
||||
id: stackl
|
||||
|
||||
Item
|
||||
id: submitBtn
|
||||
text: qsTr("Speichern")
|
||||
property var grids: firstStart.currentItem
|
||||
property var pyqcrm_conf: ({})
|
||||
property var admin: Boolean
|
||||
onClicked:
|
||||
{
|
||||
id: createUser
|
||||
Layout.fillWidth: parent.width
|
||||
|
||||
GridLayout
|
||||
if (firstStart.currentItem.name === "database")
|
||||
{
|
||||
id: createUserGrid
|
||||
columns: 2
|
||||
columnSpacing: 5
|
||||
rowSpacing: 9
|
||||
anchors.fill: parent
|
||||
Layout.margins: 9
|
||||
property string name: "pyqcrm"
|
||||
|
||||
Label
|
||||
pyqcrm_conf = Qmldict.func(submitBtn.grids)
|
||||
if (pyqcrm_conf)
|
||||
{
|
||||
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"
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: qsTr("Info:")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: gecos
|
||||
placeholderText: qsTr("Zusätzliche Info")
|
||||
Layout.fillWidth: true
|
||||
property string name: "PYQCRM_ADMIN_INFO"
|
||||
}
|
||||
|
||||
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)
|
||||
admin = config.setConfig(pyqcrm_conf)
|
||||
if (admin)
|
||||
{
|
||||
config.setConfig(pyqcrm_conf)
|
||||
appLoader.source = "Dashboard.qml"
|
||||
|
||||
topBar.visible = true
|
||||
firstStart.push("EncryptionKey.qml")
|
||||
}
|
||||
else
|
||||
{
|
||||
firstStart.push("AdminUserConfig.qml")
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pyqcrm_conf = Qmldict.func(submitBtn.grids)
|
||||
if (pyqcrm_conf)
|
||||
{
|
||||
admin = config.addAdminUser(pyqcrm_conf)
|
||||
if (admin)
|
||||
{
|
||||
appLoader.source = "Dashboard.qml"
|
||||
topBar.visible = true
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("Konfiguration Admin fehlgeschlagen")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
appLoader.window.title = "PYQCRM - Einstellungen"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user