Lettore EPUB nativo: ReaderPage (WebView+capitoli+progresso), segno locale in QSettings, sync POST /ajax/bookmark con fallback CSRF, pulsante Leggi nel dettaglio

This commit is contained in:
2026-08-12 14:21:45 +02:00
parent ae15c39421
commit 6f0ca6ed07
10 changed files with 489 additions and 13 deletions
+17 -2
View File
@@ -129,7 +129,8 @@ QString readTextFile(const QString &path)
// EpubBook
// ---------------------------------------------------------------------------
EpubBook::EpubBook()
EpubBook::EpubBook(QObject *parent)
: QObject(parent)
{
}
@@ -189,7 +190,9 @@ bool EpubBook::open(const QString &epubPath)
return false;
if (!parseOpf())
return false;
return !m_chapters.isEmpty();
const bool ok = !m_chapters.isEmpty();
emit changed();
return ok;
}
bool EpubBook::parseContainer()
@@ -397,6 +400,18 @@ QString EpubBook::chapterTitle(int index) const
return m_chapters.at(index).title;
}
QVariantList EpubBook::chapterList() const
{
QVariantList list;
for (int i = 0; i < m_chapters.size(); ++i) {
QVariantMap m;
m.insert(QStringLiteral("index"), i);
m.insert(QStringLiteral("title"), m_chapters.at(i).title);
list.append(m);
}
return list;
}
QString EpubBook::makeBookmarkKey(int chapterIndex, double fraction) const
{
return QStringLiteral("cw:v1:%1:%2").arg(chapterIndex).arg(fraction, 0, 'f', 4);