Settings page was added
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user