Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfDocument.h
Show All 20 Lines | |||||
21 | 21 | | |||
22 | #ifndef ACBFDOCUMENT_H | 22 | #ifndef ACBFDOCUMENT_H | ||
23 | #define ACBFDOCUMENT_H | 23 | #define ACBFDOCUMENT_H | ||
24 | 24 | | |||
25 | #include <memory> | 25 | #include <memory> | ||
26 | 26 | | |||
27 | #include <QObject> | 27 | #include <QObject> | ||
28 | #include "acbf_export.h" | 28 | #include "acbf_export.h" | ||
29 | 29 | /** | |||
30 | * \brief Class that handles all of the ACBF document. | ||||
31 | * | ||||
32 | * ACBF documents are made up of several subsections: | ||||
33 | * | ||||
34 | * - Metadata, which in turn holds book, publishing and document info. | ||||
35 | * - Body, which holds the pages and their frame and text definitions. | ||||
36 | * - Data, which holds embedded data like images and fonts. | ||||
37 | * - References, a section which holds notes and references that can be pointed | ||||
38 | * at from the text. Not supported currently. | ||||
39 | * - Stylesheet, which is a css stylesheet to inform how overlaid translations | ||||
40 | * should be rendered. Not supported currently. | ||||
41 | * | ||||
42 | * Of these, only Body and Metadata are necessary for a proper ACBF file. | ||||
43 | * | ||||
44 | * TODO: Support references and stylesheets. | ||||
45 | */ | ||||
30 | namespace AdvancedComicBookFormat | 46 | namespace AdvancedComicBookFormat | ||
31 | { | 47 | { | ||
32 | class Metadata; | 48 | class Metadata; | ||
33 | class Body; | 49 | class Body; | ||
34 | // class References; | 50 | // class References; | ||
35 | class Data; | 51 | class Data; | ||
36 | // class Stylesheet; | 52 | // class Stylesheet; | ||
37 | class ACBF_EXPORT Document : public QObject | 53 | class ACBF_EXPORT Document : public QObject | ||
38 | { | 54 | { | ||
39 | Q_OBJECT | 55 | Q_OBJECT | ||
40 | Q_PROPERTY(Metadata* metaData READ metaData NOTIFY metaDataChanged) | 56 | Q_PROPERTY(Metadata* metaData READ metaData NOTIFY metaDataChanged) | ||
41 | public: | 57 | public: | ||
42 | explicit Document(QObject* parent = nullptr); | 58 | explicit Document(QObject* parent = nullptr); | ||
43 | ~Document() override; | 59 | ~Document() override; | ||
44 | 60 | | |||
61 | /** | ||||
62 | * \brief write the whole document to an ACBF xml. | ||||
63 | */ | ||||
45 | QString toXml(); | 64 | QString toXml(); | ||
65 | /** | ||||
66 | * \brief load an ACBF file from XML. | ||||
67 | * @return True if the xmlReader encountered no errors. | ||||
68 | */ | ||||
46 | bool fromXml(QString xmlDocument); | 69 | bool fromXml(QString xmlDocument); | ||
47 | 70 | | |||
71 | /** | ||||
72 | * @returns The metadata object. | ||||
73 | */ | ||||
48 | Metadata* metaData() const; | 74 | Metadata* metaData() const; | ||
75 | /** | ||||
76 | * \brief triggers when the metadata is changed. | ||||
77 | */ | ||||
49 | Q_SIGNAL void metaDataChanged(); | 78 | Q_SIGNAL void metaDataChanged(); | ||
50 | 79 | | |||
80 | /** | ||||
81 | * @returns the Body object. | ||||
82 | */ | ||||
51 | Body* body() const; | 83 | Body* body() const; | ||
52 | // References* references(); | 84 | // References* references(); | ||
85 | /** | ||||
86 | * @returns the Data object. | ||||
87 | */ | ||||
53 | Data* data() const; | 88 | Data* data() const; | ||
54 | // Stylesheet* stylesheet(); | 89 | // Stylesheet* stylesheet(); | ||
55 | private: | 90 | private: | ||
56 | class Private; | 91 | class Private; | ||
57 | std::unique_ptr<Private> d; | 92 | std::unique_ptr<Private> d; | ||
58 | }; | 93 | }; | ||
59 | } | 94 | } | ||
60 | 95 | | |||
61 | #endif//ACBFDOCUMENT_H | 96 | #endif//ACBFDOCUMENT_H |