-
Notifications
You must be signed in to change notification settings - Fork 8
/
epubdocument.h
50 lines (35 loc) · 974 Bytes
/
epubdocument.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef EPUBDOCUMENT_H
#define EPUBDOCUMENT_H
#include "epubcontainer.h"
#include <QObject>
#include <QTextDocument>
#include <QImage>
class EPubContainer;
class EPubDocument : public QTextDocument
{
Q_OBJECT
public:
explicit EPubDocument(QObject *parent);
virtual ~EPubDocument();
bool loaded() { return m_loaded; }
void openDocument(const QString &path);
void clearCache() { m_renderedSvgs.clear(); }
signals:
void loadCompleted();
protected:
virtual QVariant loadResource(int type, const QUrl &url) override;
private slots:
void loadDocument();
private:
void fixImages(QDomDocument &newDocument);
const QImage &getSvgImage(const QString &id);
QHash<QString, QByteArray> m_svgs;
QHash<QString, QImage> m_renderedSvgs;
QString m_documentPath;
EPubContainer *m_container;
EpubItem m_currentItem;
QList<int> m_loadedFonts;
QSizeF m_docSize;
bool m_loaded;
};
#endif // EPUBDOCUMENT_H