Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfTextlayer.h
Show All 19 Lines | |||||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #ifndef ACBFTEXTLAYER_H | 22 | #ifndef ACBFTEXTLAYER_H | ||
23 | #define ACBFTEXTLAYER_H | 23 | #define ACBFTEXTLAYER_H | ||
24 | 24 | | |||
25 | #include <memory> | 25 | #include <memory> | ||
26 | 26 | | |||
27 | #include "AcbfPage.h" | 27 | #include "AcbfPage.h" | ||
28 | 28 | /** | |||
29 | * \brief Class to handle the textlayer element. | ||||
30 | * | ||||
31 | * ACBF textlayers are groupings of textareas | ||||
32 | * according to a specific language. | ||||
33 | * | ||||
34 | * They also have a default textarea background color. | ||||
35 | */ | ||||
29 | namespace AdvancedComicBookFormat | 36 | namespace AdvancedComicBookFormat | ||
30 | { | 37 | { | ||
31 | class Textarea; | 38 | class Textarea; | ||
32 | class ACBF_EXPORT Textlayer : public QObject | 39 | class ACBF_EXPORT Textlayer : public QObject | ||
33 | { | 40 | { | ||
34 | Q_OBJECT | 41 | Q_OBJECT | ||
35 | public: | 42 | public: | ||
36 | explicit Textlayer(Page* parent = nullptr); | 43 | explicit Textlayer(Page* parent = nullptr); | ||
37 | ~Textlayer() override; | 44 | ~Textlayer() override; | ||
38 | 45 | | |||
46 | /** | ||||
47 | * \brief Write the textlayer into the xml writer. | ||||
48 | */ | ||||
39 | void toXml(QXmlStreamWriter* writer); | 49 | void toXml(QXmlStreamWriter* writer); | ||
50 | /** | ||||
51 | * \brief load a textlayer element into this object. | ||||
52 | * @return True if the xmlReader encountered no errors. | ||||
53 | */ | ||||
40 | bool fromXml(QXmlStreamReader *xmlReader); | 54 | bool fromXml(QXmlStreamReader *xmlReader); | ||
41 | 55 | | |||
56 | /** | ||||
57 | * @returns the language for this text-layer. | ||||
58 | */ | ||||
42 | QString language() const; | 59 | QString language() const; | ||
60 | /** | ||||
61 | * \brief set the language for this text-layer. | ||||
62 | * @param language - the language of the entry in language code, country | ||||
63 | * code format joined by a dash (not an underscore). | ||||
64 | */ | ||||
43 | void setLanguage(const QString& language); | 65 | void setLanguage(const QString& language); | ||
44 | 66 | | |||
67 | /** | ||||
68 | * @return the background color as a QString. | ||||
69 | * | ||||
70 | * It should be an 8bit per channel rgb hexcode. | ||||
71 | */ | ||||
45 | QString bgcolor() const; | 72 | QString bgcolor() const; | ||
73 | /** | ||||
74 | * \brief set the background color. | ||||
75 | * | ||||
76 | * @param newColor - a String with an 8bit per channel rgb hexcode (#ff00ff, or the like) | ||||
77 | */ | ||||
46 | void setBgcolor(const QString& newColor = QString()); | 78 | void setBgcolor(const QString& newColor = QString()); | ||
47 | 79 | | |||
80 | /** | ||||
81 | * @returns a list of textareas in this page. | ||||
82 | */ | ||||
48 | QList<Textarea*> textareas() const; | 83 | QList<Textarea*> textareas() const; | ||
84 | /** | ||||
85 | * @param index - index of the textarea. | ||||
86 | * @return the textarea of that index. | ||||
87 | */ | ||||
49 | Textarea* textarea(int index) const; | 88 | Textarea* textarea(int index) const; | ||
89 | /** | ||||
90 | * @param textarea - the textarea you want to index of. | ||||
91 | * @returns the index of the given textarea. | ||||
92 | */ | ||||
50 | int textareaIndex(Textarea* textarea) const; | 93 | int textareaIndex(Textarea* textarea) const; | ||
51 | 94 | | |||
52 | // If afterIndex is larger than zero, the insertion will happen at that index | 95 | /** | ||
96 | * \brief add a textarea to the list of frames. | ||||
97 | * @param textarea - the frame to add. | ||||
98 | * @param index - the index to add it at. If afterIndex is larger than | ||||
99 | * zero, the insertion will happen at that index | ||||
100 | */ | ||||
53 | void addTextarea(Textarea* textarea, int index = -1); | 101 | void addTextarea(Textarea* textarea, int index = -1); | ||
102 | /** | ||||
103 | * \brief remove the given textarea from the framelist. | ||||
104 | * @param textarea - the textarea to remove. | ||||
105 | */ | ||||
54 | void removeTextarea(Textarea* textarea); | 106 | void removeTextarea(Textarea* textarea); | ||
107 | /** | ||||
108 | * \brief Swap two textareas in the list. | ||||
109 | * @param swapThis - the first textarea to swap. | ||||
110 | * @param withThis - the second textarea to swap. | ||||
111 | */ | ||||
55 | bool swapTextareas(Textarea* swapThis, Textarea* withThis); | 112 | bool swapTextareas(Textarea* swapThis, Textarea* withThis); | ||
56 | private: | 113 | private: | ||
57 | class Private; | 114 | class Private; | ||
58 | std::unique_ptr<Private> d; | 115 | std::unique_ptr<Private> d; | ||
59 | }; | 116 | }; | ||
60 | } | 117 | } | ||
61 | 118 | | |||
62 | #endif//ACBFTEXTLAYER_H | 119 | #endif//ACBFTEXTLAYER_H |