Settings page was added

This commit is contained in:
2023-03-30 20:06:03 +02:00
parent 31cb989f67
commit 25e8a3ea79
16 changed files with 272 additions and 55 deletions

View File

@@ -1,11 +1,74 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import Components 1.0
Page {
id: root
Label {
anchors.centerIn: parent
text: "Settings"
title: qsTr("Settings")
ListModel {
id: settingsModel
ListElement {
title: qsTr("BeerLog service address")
name: "serverAddress"
}
ListElement {
title: qsTr("Selected user id")
name: "selectedUserId"
}
}
ListView {
anchors.fill: parent
model: settingsModel
delegate: SubtitledItemDelegate {
width: parent.width
text: model.title
subtitle: settingsService[model.name]
onClicked: {
inputDialog.title = model.title
inputDialog.name = model.name
inputDialog.open()
}
}
}
Dialog {
id: inputDialog
property string name: ""
width: root.width * 0.8
anchors.centerIn: parent
parent: ApplicationWindow.overlay
modal: true
standardButtons: Dialog.Ok | Dialog.Cancel
Column {
spacing: 20
anchors.fill: parent
TextField {
id: textField
width: parent.width
inputMethodHints: Qt.ImhNoAutoUppercase
placeholderText: inputDialog.title
text: settingsService[inputDialog.name] || ""
}
}
onAccepted: {
settingsService[inputDialog.name] = textField.text
}
}
}