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:
+21
-10
@@ -2,7 +2,9 @@
|
||||
#define EPUB_H
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVariantList>
|
||||
|
||||
struct EpubChapter
|
||||
{
|
||||
@@ -11,27 +13,36 @@ struct EpubChapter
|
||||
QString title;
|
||||
};
|
||||
|
||||
class EpubBook
|
||||
class EpubBook : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString title READ title NOTIFY changed)
|
||||
Q_PROPERTY(QString author READ author NOTIFY changed)
|
||||
Q_PROPERTY(int chapterCount READ chapterCount NOTIFY changed)
|
||||
|
||||
public:
|
||||
EpubBook();
|
||||
explicit EpubBook(QObject *parent = 0);
|
||||
~EpubBook();
|
||||
|
||||
bool open(const QString &epubPath);
|
||||
void close();
|
||||
Q_INVOKABLE bool open(const QString &epubPath);
|
||||
Q_INVOKABLE void close();
|
||||
|
||||
QString title() const { return m_title; }
|
||||
QString author() const { return m_author; }
|
||||
QList<EpubChapter> chapters() const { return m_chapters; }
|
||||
QString baseDir() const { return m_baseDir; }
|
||||
int chapterCount() const { return m_chapters.size(); }
|
||||
|
||||
QString chapterFilePath(int index) const;
|
||||
QString chapterTitle(int index) const;
|
||||
Q_INVOKABLE QString chapterFilePath(int index) const;
|
||||
Q_INVOKABLE QString chapterTitle(int index) const;
|
||||
// elenco [{index, title}] per la lista capitoli
|
||||
Q_INVOKABLE QVariantList chapterList() const;
|
||||
|
||||
// chiave segno locale, es. "cw:v1:3:0.42" (capitolo 3, 42% del capitolo)
|
||||
QString makeBookmarkKey(int chapterIndex, double fraction) const;
|
||||
bool parseBookmarkKey(const QString &key, int *chapterIndex, double *fraction) const;
|
||||
Q_INVOKABLE QString makeBookmarkKey(int chapterIndex, double fraction) const;
|
||||
Q_INVOKABLE bool parseBookmarkKey(const QString &key, int *chapterIndex, double *fraction) const;
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
private:
|
||||
bool extractZip(const QString &epubPath);
|
||||
|
||||
Reference in New Issue
Block a user