aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/Settings.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/Settings.qml')
-rw-r--r--desktop/Settings.qml55
1 files changed, 48 insertions, 7 deletions
diff --git a/desktop/Settings.qml b/desktop/Settings.qml
index a397105..af41fe4 100644
--- a/desktop/Settings.qml
+++ b/desktop/Settings.qml
@@ -30,11 +30,17 @@ Scope {
if (root.modules[i].settings) out.push(root.modules[i]);
return out;
}
- readonly property QtObject current: root.pages.find(m => m.name === root.page) ?? root.pages[0] ?? null
+ // Null is the landing page.
+ readonly property QtObject current: root.pages.find(m => m.name === root.page) ?? null
- // An unknown or empty name opens the first page.
+ // An unknown or empty name opens the landing page.
function show(name) { root.page = name; root.open = true; }
- function close() { root.open = false; }
+ // One step out: a page to the landing page, the landing page closes.
+ function back() {
+ if (root.current) root.page = "";
+ else root.close();
+ }
+ function close() { root.open = false; root.page = ""; }
LazyLoader {
active: root.open
@@ -49,7 +55,7 @@ Scope {
Item {
anchors.fill: parent
focus: true
- Keys.onEscapePressed: root.close()
+ Keys.onEscapePressed: root.back()
ListView {
id: side
@@ -100,15 +106,50 @@ Scope {
color: Qt.alpha(Theme.text, 0.12)
}
+ // The landing page: every settings page as a tile, as the
+ // drawer's grid shows its modules. Where back returns to.
+ Item {
+ anchors { top: parent.top; right: parent.right; bottom: parent.bottom; left: rule.right; margins: 16 }
+ visible: root.current === null
+
+ Text {
+ id: landingTitle
+ height: 44
+ verticalAlignment: Text.AlignVCenter
+ text: "Settings"
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize + 2; bold: true }
+ color: Theme.text
+ }
+
+ Flow {
+ id: landing
+ anchors { top: landingTitle.bottom; topMargin: 12; left: parent.left; right: parent.right }
+ spacing: 10
+
+ Repeater {
+ model: root.pages
+
+ Tile {
+ required property QtObject modelData
+ width: (landing.width - 2 * landing.spacing) / 3
+ icon: modelData.icon
+ label: modelData.label
+ onClicked: root.page = modelData.name
+ }
+ }
+ }
+ }
+
Loader {
id: pageLoader
anchors { top: parent.top; right: parent.right; bottom: parent.bottom; left: rule.right; margins: 16 }
sourceComponent: root.current?.page ?? null
- // The Page's back arrow and dismiss close the window;
- // go() moves to another settings page by name.
+ // The Page's back arrow steps out to the landing page,
+ // dismiss closes the window, and go() moves to another
+ // settings page by name.
onLoaded: {
- if (item && item.back) item.back.connect(root.close);
+ if (item && item.back) item.back.connect(root.back);
if (item && item.dismiss) item.dismiss.connect(root.close);
if (item && item.go) item.go.connect(name => root.page = name);
}