Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfPage.h
Context not available. | |||||
23 | #define ACBFPAGE_H | 23 | #define ACBFPAGE_H | ||
---|---|---|---|---|---|
24 | 24 | | |||
25 | #include "AcbfDocument.h" | 25 | #include "AcbfDocument.h" | ||
26 | 26 | /** | |||
27 | * \brief Class to handle page objects. | ||||
28 | * | ||||
29 | * A proper ACBF document should have entries for all pages | ||||
30 | * and said entries should point at the images that make up | ||||
31 | * the comic. | ||||
32 | * | ||||
33 | * However, ACBF also has room from frame definitions, transcriptions, | ||||
34 | * translations, table of contents, jumps and more. | ||||
35 | * | ||||
36 | * The frame definitions are used to navigate a page and zoom efficiently on a | ||||
37 | * small screen. Similarly, transscriptions and translations can be used to show | ||||
38 | * text when the image itself is too blurry. | ||||
39 | * | ||||
40 | * Title is used to generate a table of contents. | ||||
41 | * | ||||
42 | * Transition is to indicate extra information about how the page should be entered. | ||||
43 | * | ||||
44 | * bgcolor is used by the reading software to determine what background color to give. | ||||
45 | * | ||||
46 | * Jumps can be used to move around in the comic. | ||||
47 | * | ||||
48 | * TODO: Frame and Jump seem to be missing classes despite being used here? | ||||
49 | */ | ||||
27 | class QXmlStreamWriter; | 50 | class QXmlStreamWriter; | ||
28 | class QXmlStreamReader; | 51 | class QXmlStreamReader; | ||
29 | namespace AdvancedComicBookFormat | 52 | namespace AdvancedComicBookFormat | ||
Context not available. | |||||
39 | explicit Page(Document* parent = nullptr); | 62 | explicit Page(Document* parent = nullptr); | ||
40 | ~Page() override; | 63 | ~Page() override; | ||
41 | 64 | | |||
65 | /** | ||||
66 | * \brief Write the page into the xml writer. | ||||
67 | */ | ||||
42 | void toXml(QXmlStreamWriter* writer); | 68 | void toXml(QXmlStreamWriter* writer); | ||
69 | /** | ||||
70 | * \brief load a page element into this object. | ||||
71 | * @return True if the xmlReader encountered no errors. | ||||
72 | */ | ||||
43 | bool fromXml(QXmlStreamReader *xmlReader); | 73 | bool fromXml(QXmlStreamReader *xmlReader); | ||
44 | 74 | | |||
75 | /** | ||||
76 | * @return the background color as a QString. | ||||
77 | * | ||||
78 | * It should be an 8bit per channel rgb hexcode. | ||||
79 | */ | ||||
45 | QString bgcolor() const; | 80 | QString bgcolor() const; | ||
81 | /** | ||||
82 | * \brief set the background color. | ||||
83 | * | ||||
84 | * @param newColor - a String with an 8bit per channel rgb hexcode (#ff00ff, or the like) | ||||
85 | */ | ||||
46 | void setBgcolor(const QString& newColor = QString()); | 86 | void setBgcolor(const QString& newColor = QString()); | ||
47 | 87 | | |||
88 | /** | ||||
89 | * @return transition type as a string. | ||||
90 | */ | ||||
48 | QString transition() const; | 91 | QString transition() const; | ||
92 | /** | ||||
93 | * \brief set the transition type. | ||||
94 | * @param transition - the transition type, possible entries are in the availableTransitions() stringlist. | ||||
95 | */ | ||||
49 | void setTransition(const QString& transition); | 96 | void setTransition(const QString& transition); | ||
97 | /** | ||||
98 | * @returns a list of strings that can be used for the transition. | ||||
99 | */ | ||||
50 | static QStringList availableTransitions(); | 100 | static QStringList availableTransitions(); | ||
51 | 101 | | |||
102 | /** | ||||
103 | * @return all titles for this page in all languages. | ||||
104 | */ | ||||
52 | QStringList titleForAllLanguages() const; | 105 | QStringList titleForAllLanguages() const; | ||
106 | /** | ||||
107 | * @param language - the language of the entry in language code, country | ||||
108 | * code format joined by a dash (not an underscore). | ||||
109 | * @return the title for this language. | ||||
110 | */ | ||||
53 | QString title(const QString& language = QString()) const; | 111 | QString title(const QString& language = QString()) const; | ||
112 | /** | ||||
113 | * \brief set the title for this language. | ||||
114 | * @param language - the language of the entry in language code, country | ||||
115 | * code format joined by a dash (not an underscore). | ||||
116 | */ | ||||
54 | void setTitle(const QString& title, const QString& language = QString()); | 117 | void setTitle(const QString& title, const QString& language = QString()); | ||
55 | 118 | | |||
119 | /** | ||||
120 | * @returns the URI for the image of this page as a QString | ||||
121 | */ | ||||
56 | QString imageHref() const; | 122 | QString imageHref() const; | ||
123 | /** | ||||
124 | * \brief set the URI for the image of this page. | ||||
125 | * @param imageHref - the URI to an image. | ||||
126 | * | ||||
127 | * - A Binary representation will use the ID of that representation. | ||||
128 | * - A reference to a file on the internet will start with "http://" or "https://" | ||||
129 | * - A reference to a file in a zip will be prefixed with "zip:" | ||||
130 | * - Everything else is presumed to be a file on disk. | ||||
131 | */ | ||||
57 | void setImageHref(const QString& imageHref); | 132 | void setImageHref(const QString& imageHref); | ||
58 | 133 | | |||
134 | /** | ||||
135 | * @returns all the textlayers objects. | ||||
136 | */ | ||||
59 | QList<Textlayer*> textLayersForAllLanguages() const; | 137 | QList<Textlayer*> textLayersForAllLanguages() const; | ||
138 | /** | ||||
139 | * @param language - the language of the entry in language code, country | ||||
140 | * code format joined by a dash (not an underscore). | ||||
141 | * @returns the TextLayer object for that language. | ||||
142 | */ | ||||
60 | Textlayer* textLayer(const QString& language = QString()) const; | 143 | Textlayer* textLayer(const QString& language = QString()) const; | ||
61 | // Setting the textlayer for a language to null removes that language (as with other translated entries, though this one not being text warranted a comment) | 144 | /** | ||
145 | * | ||||
146 | * @param language - the language of the entry in language code, country | ||||
147 | * code format joined by a dash (not an underscore). Setting the textlayer | ||||
148 | * for a language to null removes that language (as with other translated | ||||
149 | * entries, though this one not being text warranted a comment) | ||||
150 | */ | ||||
62 | void setTextLayer(Textlayer* textlayer, const QString& language = ""); | 151 | void setTextLayer(Textlayer* textlayer, const QString& language = ""); | ||
63 | 152 | | |||
153 | /** | ||||
154 | * @returns a list of frames in this page. | ||||
155 | */ | ||||
64 | QList<Frame*> frames() const; | 156 | QList<Frame*> frames() const; | ||
157 | /** | ||||
158 | * @param index - index of the frame. | ||||
159 | * @return the frame of that index. | ||||
160 | */ | ||||
65 | Frame* frame(int index) const; | 161 | Frame* frame(int index) const; | ||
162 | /** | ||||
163 | * @param frame - the frame you want to index of. | ||||
164 | * @returns the index of the given frame. | ||||
165 | */ | ||||
66 | int frameIndex(Frame* frame) const; | 166 | int frameIndex(Frame* frame) const; | ||
67 | 167 | | |||
68 | // If afterIndex is larger than zero, the insertion will happen at that index | 168 | /** | ||
169 | * \brief add a frame to the list of frames. | ||||
170 | * @param frame - the frame to add. | ||||
171 | * @param index - the index to add it at. If afterIndex is larger than | ||||
172 | * zero, the insertion will happen at that index | ||||
173 | */ | ||||
69 | void addFrame(Frame* frame, int index = -1); | 174 | void addFrame(Frame* frame, int index = -1); | ||
175 | /** | ||||
176 | * \brief remove the given frame from the framelist. | ||||
177 | * @param frame - the frame to remove. | ||||
178 | */ | ||||
70 | void removeFrame(Frame* frame); | 179 | void removeFrame(Frame* frame); | ||
180 | /** | ||||
181 | * \brief Swap two frames in the list. | ||||
182 | * @param swapThis - the first frame to swap. | ||||
183 | * @param withThis - the second frame to swap. | ||||
184 | */ | ||||
71 | bool swapFrames(Frame* swapThis, Frame* withThis); | 185 | bool swapFrames(Frame* swapThis, Frame* withThis); | ||
72 | 186 | | |||
187 | /** | ||||
188 | * @return the list of jump objects for this page. | ||||
189 | */ | ||||
73 | QList<Jump*> jumps() const; | 190 | QList<Jump*> jumps() const; | ||
191 | /** | ||||
192 | * @param index - the index for which you want the jump object. | ||||
193 | * @return a jump object for the given frame. | ||||
194 | */ | ||||
74 | Jump* jump(int index) const; | 195 | Jump* jump(int index) const; | ||
196 | /** | ||||
197 | * @param jump - the jump you want to index of. | ||||
198 | * @returns the index of the given jump. | ||||
199 | */ | ||||
75 | int jumpIndex(Jump* jump) const; | 200 | int jumpIndex(Jump* jump) const; | ||
76 | 201 | | |||
77 | // If afterIndex is larger than zero, the insertion will happen at that index | 202 | /** | ||
203 | * \brief add a jump to the list of frames. | ||||
204 | * @param jump - the jump to add. | ||||
205 | * @param index - the index to add it at. If afterIndex is larger than | ||||
206 | * zero, the insertion will happen at that index | ||||
207 | */ | ||||
78 | void addJump(Jump* jump, int index = -1); | 208 | void addJump(Jump* jump, int index = -1); | ||
209 | /** | ||||
210 | * \brief remove the given jump from the list of jumps. | ||||
211 | * @param jump - the jump to remove. | ||||
212 | */ | ||||
79 | void removeJump(Jump* jump); | 213 | void removeJump(Jump* jump); | ||
214 | /** | ||||
215 | * \brief Swap two jumps in the list. | ||||
216 | * @param swapThis - the first jumps to swap. | ||||
217 | * @param withThis - the second jumps to swap. | ||||
218 | */ | ||||
80 | bool swapJumps(Jump* swapThis, Jump* withThis); | 219 | bool swapJumps(Jump* swapThis, Jump* withThis); | ||
81 | 220 | | |||
221 | /** | ||||
222 | * @returns whether this is the cover page. | ||||
223 | */ | ||||
82 | bool isCoverPage() const; | 224 | bool isCoverPage() const; | ||
225 | /** | ||||
226 | * \brief toggle whether this is the cover page. | ||||
227 | * | ||||
228 | */ | ||||
83 | void setIsCoverPage(bool isCoverPage = false); | 229 | void setIsCoverPage(bool isCoverPage = false); | ||
84 | private: | 230 | private: | ||
85 | class Private; | 231 | class Private; | ||
Context not available. |