75 lines
1.5 KiB
QML
75 lines
1.5 KiB
QML
import QtQuick 2.15
|
|
import QtQuick.Controls 2.15
|
|
import Components 1.0
|
|
|
|
Page {
|
|
id: root
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|