Refactor using Fable

This commit is contained in:
Agel committed 2026-07-31 17:31:02 +02:00
1 parent 1a60a6b93c
commit 83968646c6
90 files changed
+2080 -2267

No files matched your search

+11 -6
View File
@@ -157,7 +157,7 @@ When `CMakeLists.txt` gains a new `find_package` or `pkg_check_modules` dependen
| Object | Responsibility |
|---|---|
| `Book` | Open/close book, owns reader (via `ReaderFactory`), exposes metadata (title, author), TOC |
| `Book` | Open/close book, owns reader (via `FormatRegistry`), exposes metadata (title, author), TOC |
| `ReadingModel` | QAbstractListModel exposing chapter chunks (ContentRole), position, next/prev navigation, progress |
| `AppState` | Window geometry, last file, preferences (`QSettings`) |
@@ -195,9 +195,9 @@ Chapter mapping by format: TXT = 1 chapter (whole file). FB2 = `<section>` eleme
**Progress tracking** to track reading position ONLY ListView y offset must be used. Current page / progress percentage must be calculated using this and total height only.
### Reader Factory
### Format Registry
`ReaderFactory` is separate from `FormatReader`. It provides a static `create(const QString &filePath)` method backed by a registration map (extension → factory function). Adding a new format requires only a new map entry — no modifications to existing factory logic (OCP). No plugin system needed.
`FormatRegistry` is separate from `FormatReader`. It is driven by a `FormatSpec` table (one row per format: extension or directory match, image scheme, reader factory, byte-source factory) built in `main()`. Readers, image providers, sync image loaders, and QML scheme registration all derive from the same row, so adding a new format requires only a new table row — no modifications to existing factory logic (OCP). No plugin system needed.
### Async Book Opening
@@ -218,13 +218,18 @@ src/
ReadingModel.h/cpp # Chapter content, position, navigation — exposed to QML
AppState.h/cpp # Window/session state (QSettings) — exposed to QML
FormatReader.h # Abstract interface + Chapter/TocEntry structs
ReaderFactory.h/cpp # Extension → reader mapping
AppCoordinator.h/cpp # Cross-class signal wiring (book open, history, quit)
reading/
MangaPagination.h/cpp # Pure page-pair layout for manga mode
MeasurementController.h/cpp # Off-thread chunk height measurement
formats/
FormatRegistry.h/cpp # FormatSpec table: readers, providers, schemes
IByteSource.h # Byte access to named entries (zip/rar/dir/fb2)
EntryImageProvider.h/cpp # Generic image provider over any IByteSource
sources/ # ZipByteSource, RarByteSource, DirByteSource, Fb2ByteSource
TxtReader.h/cpp
Fb2Reader.h/cpp
EpubReader.h/cpp
CbzReader.h/cpp
CbzImageProvider.h/cpp
PdfReader.h/cpp
RtfReader.h/cpp
DocReader.h/cpp