dictionary
This commit is contained in:
@@ -2,6 +2,7 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Controls.Material
|
import QtQuick.Controls.Material
|
||||||
|
import "../js/qmldict.js" as Qmldict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -34,8 +35,15 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
TabButton
|
TabButton
|
||||||
|
|
||||||
{
|
{
|
||||||
|
id: dbTab
|
||||||
text: qsTr("Datenbank einrichten")
|
text: qsTr("Datenbank einrichten")
|
||||||
|
|
||||||
|
}
|
||||||
|
onCurrentIndexChanged:
|
||||||
|
{
|
||||||
|
submitBtn.text = currentIndex === 0? "Weiter" : "Speichern"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,6 +53,7 @@ Item
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
currentIndex: bar.currentIndex
|
currentIndex: bar.currentIndex
|
||||||
Layout.margins: 9
|
Layout.margins: 9
|
||||||
|
id: stackl
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
@@ -109,10 +118,12 @@ Item
|
|||||||
rowSpacing: 9
|
rowSpacing: 9
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: qsTr("DB-Host:")
|
text: qsTr("DB-Host:")
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField
|
TextField
|
||||||
@@ -120,6 +131,7 @@ Item
|
|||||||
id: dbHost
|
id: dbHost
|
||||||
placeholderText: qsTr("Hier Host eingeben")
|
placeholderText: qsTr("Hier Host eingeben")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
property string name: "db-host"
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
@@ -133,6 +145,7 @@ Item
|
|||||||
id: dbPort
|
id: dbPort
|
||||||
placeholderText: qsTr("Hier DB-Port eingeben")
|
placeholderText: qsTr("Hier DB-Port eingeben")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
property string name: "db-port"
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
@@ -146,6 +159,7 @@ Item
|
|||||||
id: dbName
|
id: dbName
|
||||||
placeholderText: qsTr("Hier DB-Name eingeben")
|
placeholderText: qsTr("Hier DB-Name eingeben")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
property string name: "db-name"
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
@@ -159,6 +173,7 @@ Item
|
|||||||
id: dbUserName
|
id: dbUserName
|
||||||
placeholderText: qsTr("Hier DB-Benutzername eingeben")
|
placeholderText: qsTr("Hier DB-Benutzername eingeben")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
property string name: "db-username"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +189,7 @@ Item
|
|||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
placeholderText: qsTr("Hier DB-Passwort eingeben")
|
placeholderText: qsTr("Hier DB-Passwort eingeben")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
property string name: "db-password"
|
||||||
}
|
}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
@@ -202,22 +218,27 @@ Item
|
|||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
id: submitBtn
|
id: submitBtn
|
||||||
text: qsTr("Speichern")
|
text: qsTr("Weiter")
|
||||||
|
property var grids: [createUserGrid, dbGrid]
|
||||||
|
property var dict: ({})
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
config.createUser(benutzerName.text)
|
if (bar.itemAt(bar.currentIndex) !== dbTab)
|
||||||
for (var i = 0; i < createUserGrid.children.length; i++)
|
|
||||||
{
|
{
|
||||||
// console.log(createUserGrid.children[i].name)
|
|
||||||
// console.log(createUserGrid.children[i].text)
|
|
||||||
|
|
||||||
if (createUserGrid.children[i].name)
|
bar.currentIndex = 1
|
||||||
{
|
|
||||||
console.log(createUserGrid.children[i].name);
|
|
||||||
console.log(createUserGrid.children[i].text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dict = Qmldict.func(submitBtn.grids)
|
||||||
|
console.log(dict)
|
||||||
|
if (dict)
|
||||||
|
config.setConfig(dict)
|
||||||
|
|
||||||
|
appLoader.source = "start.qml"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,5 +247,6 @@ Item
|
|||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
appLoader.window.title = "PYQCRM - Einstellungen"
|
appLoader.window.title = "PYQCRM - Einstellungen"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
Component.onCompleted:
|
||||||
|
{
|
||||||
|
appLoader.window.title = "pyqcrm"
|
||||||
|
appLoader.window.height = Screen.height
|
||||||
|
appLoader.window.width = Screen.width
|
||||||
|
|
||||||
parent.width: 1080
|
}
|
||||||
parent.height: 1920
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
34
js/qmldict.js
Normal file
34
js/qmldict.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
.pragma library
|
||||||
|
|
||||||
|
var dict = new Object()
|
||||||
|
|
||||||
|
function func(createUserGrid)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (var j = 0; j < createUserGrid.length; j++)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (var i = 0; i < createUserGrid[j].children.length; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (createUserGrid[j].children[i].name)
|
||||||
|
{
|
||||||
|
if (!createUserGrid[j].children[i].text.trim())
|
||||||
|
return false
|
||||||
|
|
||||||
|
// dict.set(createUserGrid[j].children[i].name , createUserGrid[j].children[i].text)
|
||||||
|
dict[createUserGrid[j].children[i].name] = createUserGrid[j].children[i].text
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return dict
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -17,8 +17,9 @@ class ConfigLoader(QObject):
|
|||||||
self.__configLoad()
|
self.__configLoad()
|
||||||
|
|
||||||
@Slot(str)
|
@Slot(str)
|
||||||
def createUser(self, username):
|
def setConfig(self, app_config):
|
||||||
pass
|
|
||||||
|
print (type(app_config))
|
||||||
|
|
||||||
def __configLoad(self):
|
def __configLoad(self):
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"lib/__init__.py",
|
"lib/__init__.py",
|
||||||
"main.py",
|
"main.py",
|
||||||
"gui/main.qml",
|
"gui/main.qml",
|
||||||
"gui/start.qml"
|
"gui/start.qml",
|
||||||
|
"js/qmldict.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user