fix ui state save
This commit is contained in:
5 files changed
+57
-18
No files matched your search
@@ -112,7 +112,7 @@ Backend (C++) handles all file I/O, format parsing, text layout calculation, and
|
||||
| `book` (`Book`) | Open/close book, async loading, error state, metadata (title, author, coverImageUrl). Owns `FormatReader`. |
|
||||
| `readingModel` (`ReadingModel`) | `QAbstractListModel` exposing chunks (`ContentRole`, `LayoutRole`, `PixelHeightRole`), layout updates, reading mode (`isTextMode`, `isMangaMode`), manga page pairs, and per-book toggles (`pageShift`, `mangaRTL`, `useBookColours`). |
|
||||
| `readingPreferences` (`ReadingPreferences`) | Font size, line spacing, horizontal margin, vertical margin (`QSettings`). |
|
||||
| `uiState` (`UiState`) | Current theme, last page, sidebar open state, last file path, custom theme colors, window geometry. |
|
||||
| `uiState` (`UiState`) | Current theme, last page, sidebar open state, reader bars visibility (`barsVisible`), last file path, custom theme colors, window geometry. |
|
||||
| `historyModel` (`HistoryModel`) | `QAbstractListModel` of recent books with async metadata extraction and reading progress. |
|
||||
| `isDebugBuild` | Boolean constant indicating debug build. |
|
||||
|
||||
@@ -187,6 +187,7 @@ public:
|
||||
|
||||
## Position Restoration & State Persistence
|
||||
- **Position Persistence**: `BookPositionStore` persists `BookPosition` (`chunkIndex`, `intraOffset`, `progress`, `pageShift`, `mangaRTL`, `useBookColours`) indexed by file content MD5 (`contentHash()`), ensuring state survives file renames or moves.
|
||||
- **UI State Persistence**: `UiState` persists `themeName`, `lastPage`, `sidebarOpen`, `barsVisible`, `lastFilePath`, `customTheme`, and window geometry. Distraction-free chrome toggling via spacebar toggles `barsVisible` without destroying the persistent `sidebarOpen` user preference; effective sidebar visibility in reader mode is gated by `(!inReader || barsVisible) && uiState.sidebarOpen`.
|
||||
- **Restoration Flow**:
|
||||
- Text mode: `ReadingModel` computes layout for the saved anchor chunk first, then emits `restoreReady(chunkIndex, intraOffset)`. `ScrollPageView` positions the `ListView` at `chunkIndex` and applies `intraOffset`.
|
||||
- Comic mode: `restoreReady(chunkIndex)` triggers `MangaPageView.showPair(pairIndexForChunk(chunkIndex))`.
|
||||
|
||||
Reference in new issue
Block a user