14 /** Content item in the table of contents. */
21 /** Bookmark: a chapter index and a relative position in chapter. */
24 Bookmark(int chapter_, qreal pos_): chapter(chapter_), pos(pos_) {}
25 Bookmark() {chapter = pos = 0;}
30 /** Construct a book from an EPUB file in path. */
31 explicit Book(const QString &path);
33 /** Load book from persistent storage. */
36 /** Save book to persistent storage. */
39 /** Extract and parse EPUB contents, fill in all members except mPath. */
42 /** Clear toc and content members, remove extracted content files. */
45 /** Return path to EPUB. */
49 * Return path to root directory of extracted EPUB.
50 * Only valid after parsing Book::opsPath().
52 QString rootPath() const;
54 /** Return temporary directory path for extracting EPUB file. */
55 QString tmpDir() const;
57 /** Clear directory. */
58 bool clearDir(const QString &directory);
60 /** Set last bookmark. */
61 void setLastBookmark(int chapter, qreal position);
63 /** Get last bookmark. */
64 Bookmark lastBookmark() const;
67 void addBookmark(int chapter, qreal position);
69 /** List bookmarks. */
70 QList<Bookmark> bookmarks() const;
72 QString title; //< Book title from EPUB.
73 QStringList toc; //< Table of contents from EPUB.
74 QHash<QString, ContentItem> content; //< Content items from EPUB.
75 QIcon cover; //< Cover image.
76 QStringList creators; //< Creators.
77 QString date; //< Date of creation.
78 QString publisher; //< Publisher.
79 QString datePublished; //< Date of publishing.
80 QString subject; //< Subject.
81 QString source; //< Source.
82 QString rights; //< Rights.
85 /** Indicate failure by creating a single "error" content item. */
86 void fail(const QString &details,
87 const QString &error = QString("Could not open book"));
89 /** Extract EPUB as ZIP. */
92 /** Parse exteacted EPUB. */
95 /** Clear all book fields except path. */
98 /** Get location of OPS file in EPUB archive. */
101 QString mPath; //< Path to EPUB file.
102 Bookmark mLastBookmark; //< Last position read.
103 QList<Bookmark> mBookmarks; //< List of bookmarks.
104 QString mRootPath; //< Path to root item in EPUB dir.