From fcacd0495d43deaa0ffb37a0483b5a351d5fab76 Mon Sep 17 00:00:00 2001 From: Agel Date: Mon, 16 Mar 2026 14:01:16 +0100 Subject: [PATCH] initial scroll position saving --- .claude/settings.local.json | 1 + src/qml/Main.qml | 42 +++++++++----------- src/qml/pages/SettingsPage.qml | 70 ++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 25 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 4d226ff..871206e 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -4,6 +4,7 @@ "Bash(find:*)", "Bash(grep:*)", "Bash(cmake:*)", + "Bash(ninja:*)", "Bash(ctest:*)", "Bash(*cmake.exe*)", "Bash(*ninja.exe*)", diff --git a/src/qml/Main.qml b/src/qml/Main.qml index 39e4992..48c1905 100644 --- a/src/qml/Main.qml +++ b/src/qml/Main.qml @@ -17,6 +17,7 @@ ApplicationWindow { property bool sidebarOpen: false property string currentPage: "starter" + property string pageFlipMode: "scroll" // "scroll" | "page" Row { anchors.fill: parent @@ -28,11 +29,9 @@ ApplicationWindow { onCloseDrawer: window.sidebarOpen = false onNavigateTo: function(page) { window.currentPage = page - window.sidebarOpen = false } onOpenFile: { bookController.browseAndOpen() - window.sidebarOpen = false } } @@ -48,16 +47,24 @@ ApplicationWindow { onMenuClicked: window.sidebarOpen = true } - Loader { - id: contentLoader + Item { + id: contentArea width: parent.width height: parent.height - header.height - (footerLoader.active ? Theme.footerHeight : 0) - sourceComponent: { - switch (window.currentPage) { - case "reader": return readerComponent - case "settings": return settingsComponent - default: return starterComponent - } + + StarterPage { + anchors.fill: parent + visible: window.currentPage !== "reader" && window.currentPage !== "settings" + } + + ReaderPage { + anchors.fill: parent + visible: window.currentPage === "reader" + } + + SettingsPage { + anchors.fill: parent + visible: window.currentPage === "settings" } } @@ -70,21 +77,6 @@ ApplicationWindow { } } - Component { - id: starterComponent - StarterPage {} - } - - Component { - id: readerComponent - ReaderPage {} - } - - Component { - id: settingsComponent - SettingsPage {} - } - ErrorPopup { anchors.fill: parent z: 3000 diff --git a/src/qml/pages/SettingsPage.qml b/src/qml/pages/SettingsPage.qml index fa724af..89d8828 100644 --- a/src/qml/pages/SettingsPage.qml +++ b/src/qml/pages/SettingsPage.qml @@ -1,4 +1,5 @@ import QtQuick +import QtQuick.Controls import Asteria Rectangle { @@ -6,4 +7,73 @@ Rectangle { GradientStop { position: 0.0; color: Theme.gradientTop } GradientStop { position: 1.0; color: Theme.gradientBottom } } + + ScrollView { + anchors.fill: parent + anchors.margins: 32 + contentWidth: availableWidth + + Column { + width: parent.width + spacing: 24 + + // Section header + Text { + text: "Reading" + font.pixelSize: 13 + font.weight: Font.Medium + color: Theme.dimText + leftPadding: 4 + } + + // Page flip mode selector + Column { + width: parent.width + spacing: 0 + + Text { + text: "Page flip" + font.pixelSize: 15 + color: Theme.uiText + bottomPadding: 12 + leftPadding: 4 + } + + Row { + spacing: 8 + + Repeater { + model: [ + { label: "Scroll", value: "scroll" }, + { label: "Page", value: "page" } + ] + + delegate: Rectangle { + width: 100 + height: 40 + radius: 6 + color: window.pageFlipMode === modelData.value + ? Theme.primaryAccent + : Theme.surface + + Text { + anchors.centerIn: parent + text: modelData.label + font.pixelSize: 14 + color: window.pageFlipMode === modelData.value + ? Theme.readingText + : Theme.uiText + } + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: window.pageFlipMode = modelData.value + } + } + } + } + } + } + } }