Manga (CBZ) Support

This commit is contained in:
Agel committed 2026-05-12 16:37:03 +02:00
1 parent 20dfdb3745
commit 9167f10b1c
12 files changed
+937 -17

No files matched your search

+16 -13
View File
@@ -10,25 +10,26 @@ Asteria Qt is a cross-platform desktop book/document reader built with Qt6/C++.
### Format Support
Initial implementation: **TXT, FB2, EPUB**
Initial implementation: **TXT, FB2, EPUB, CBZ**
Full target format list (derived from actual library inventory):
| Format | Count | Priority | Approach |
|---|---|---|---|
|---|-------|---|---|
| EPUB | ~2500 | initial | Unzip (QuaZip/minizip) + parse OPF spine + render HTML |
| FB2 | ~1900 | initial | `QXmlStreamReader` (pure XML) |
| TXT | ~170 | initial | `QTextStream` + encoding detection (uchardet/ICU) |
| PDF | ~520 | high | `QtPdf` module (`QPdfDocument`, Qt 6.4+) |
| DOC | ~330 | high | `libwpd` or antiword subprocess |
| RTF | ~260 | high | `QTextDocumentReader` or RTF→HTML |
| HTML/HTM | ~350 | high | `QTextDocument` / `QWebEngineView` |
| DOCX | ~65 | medium | Unzip + parse `word/document.xml` (`QXmlStreamReader`) |
| DJVU | ~60 | medium | `DjVuLibre` |
| ODT | ~5 | medium | Unzip + parse OpenDocument XML |
| CHM | ~5 | medium | `CHMLib` |
| TXT | ~170 | initial | `QTextStream` + encoding detection (uchardet/ICU) |
| CBZ | ??? | initial | Unzip (minizip) + parse optional ComicInfo.xml + one image per chunk |
| PDF | ~520 | high | `QtPdf` module (`QPdfDocument`, Qt 6.4+) |
| DOC | ~330 | high | `libwpd` or antiword subprocess |
| RTF | ~260 | high | `QTextDocumentReader` or RTF→HTML |
| HTML/HTM | ~350 | high | `QTextDocument` / `QWebEngineView` |
| DOCX | ~65 | medium | Unzip + parse `word/document.xml` (`QXmlStreamReader`) |
| DJVU | ~60 | medium | `DjVuLibre` |
| ODT | ~5 | medium | Unzip + parse OpenDocument XML |
| CHM | ~5 | medium | `CHMLib` |
| PDB | small | low | Palm/Mobipocket format |
| ZIP/RAR | ~210 | low | Inspect contents; open book files within archive |
| ZIP/RAR | ~210 | low | Inspect contents; open book files within archive |
> ACSM files are Adobe DRM tokens — not directly readable; skip.
> PPT/XLS and source code files (.py, .cs, etc.) are in the library from programming books; no need to render them.
@@ -180,7 +181,7 @@ struct Chapter {
- `QList<TocEntry> tableOfContents()` — empty list if a format has no TOC (e.g., TXT)
- `QString title()`, `QString author()` — metadata
Chapter mapping by format: TXT = 1 chapter (whole file). FB2 = `<section>` elements. EPUB = spine items. PDF = outline entries or individual pages.
Chapter mapping by format: TXT = 1 chapter (whole file). FB2 = `<section>` elements. EPUB = spine items. CBZ = 1 chapter (whole archive). PDF = outline entries or individual pages.
**Chunking:** Each format reader splits content into chunks natively — chunking at the reader level is trivial and reliable compared to splitting arbitrary HTML. TxtReader splits raw text at ~4096 character boundaries (preferring `\n`, falling back to whitespace), then converts each chunk to HTML independently. Each chunk is a standalone HTML fragment (contains its own `<p>` tags).
@@ -216,6 +217,8 @@ src/
TxtReader.h/cpp
Fb2Reader.h/cpp
EpubReader.h/cpp
CbzReader.h/cpp
CbzImageProvider.h/cpp
PdfReader.h/cpp
RtfReader.h/cpp
DocReader.h/cpp