diff --git a/SettingsForm.qml b/SettingsForm.qml
index 687a15f..f4bb193 100644
--- a/SettingsForm.qml
+++ b/SettingsForm.qml
@@ -11,8 +11,8 @@ Page {
ListElement {
name: "serviceUrl"
- title: qsTr("nooLite service URL:")
- inputHint: Qt.ImhUrlCharactersOnly
+ title: qsTr("nooLite service URL")
+ inputMethodHint: Qt.ImhUrlCharactersOnly
}
}
@@ -20,36 +20,43 @@ Page {
model: settingsModel
anchors.fill: parent
- anchors.margins: 8
-
- delegate: Item {
- id: settingsItem
+ delegate: SubtitledItemDelegate {
width: parent.width
- height: childrenRect.height
+ text: model.title
+ subtitle: settings[model.name]
- Label {
- id: titleLabel
+ onClicked: inputDialog.open()
- anchors.left: settingsItem.left
- anchors.verticalCenter: valueField.verticalCenter
+ Dialog {
+ id: inputDialog
- text: model.title
- }
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ parent: ApplicationWindow.overlay
- TextField {
- id: valueField
+ focus: true
+ modal: true
+ title: model.title
+ standardButtons: Dialog.Ok | Dialog.Cancel
- anchors.right: settingsItem.right
- anchors.left: titleLabel.right
- anchors.leftMargin: 10
+ Column {
+ spacing: 20
+ anchors.fill: parent
- inputMethodHints: model.inputHint
+ TextField {
+ id: textField
- text: settings[model.name]
+ width: parent.width
+ focus: true
+ inputMethodHints: Qt.ImhNoAutoUppercase | model.inputMethodHint
+ placeholderText: model.title
+ text: settings[model.name]
+ }
+ }
- onTextChanged: {
- settings[model.name] = text
+ onAccepted: {
+ settings[model.name] = textField.text
}
}
}
diff --git a/SubtitledItemDelegate.qml b/SubtitledItemDelegate.qml
new file mode 100644
index 0000000..8942433
--- /dev/null
+++ b/SubtitledItemDelegate.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+import QtQuick.Controls 2.2
+
+ItemDelegate {
+ id: root
+
+ property string subtitle: ""
+
+ contentItem: Column {
+ Label {
+ id: titleLabel
+
+ width: parent.width
+ text: root.text
+ }
+
+ Label {
+ width: parent.width
+ font.pixelSize: titleLabel.font.pixelSize - 2
+ text: root.subtitle ? root.subtitle : qsTr("undefined")
+ opacity: 0.8
+ }
+ }
+}
diff --git a/main.qml b/main.qml
index 027061a..0d3bd39 100644
--- a/main.qml
+++ b/main.qml
@@ -74,4 +74,11 @@ ApplicationWindow {
initialItem: "HomeForm.qml"
anchors.fill: parent
}
+
+ onClosing: {
+ if (stackView.depth > 1) {
+ close.accepted = false
+ stackView.pop()
+ }
+ }
}
diff --git a/qml.qrc b/qml.qrc
index fc6eab0..d5c7474 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -5,5 +5,6 @@
HomeForm.qml
SettingsForm.qml
MenuBackButton.qml
+ SubtitledItemDelegate.qml
diff --git a/qtquickcontrols2.conf b/qtquickcontrols2.conf
index 0d0c15c..613ab74 100644
--- a/qtquickcontrols2.conf
+++ b/qtquickcontrols2.conf
@@ -8,6 +8,6 @@ Style=Material
[Material]
Theme=Dark
Primary=#3C3C3C
-;Accent=Steel
+Accent=BlueGrey
;Foreground=Brown
;Background=Steel