Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfTextarea.h
Show All 16 Lines | |||||
17 | * You should have received a copy of the GNU Lesser General Public | 17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | * | 19 | * | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #ifndef ACBFTEXTAREA_H | 22 | #ifndef ACBFTEXTAREA_H | ||
23 | #define ACBFTEXTAREA_H | 23 | #define ACBFTEXTAREA_H | ||
24 | 24 | | |||
25 | #include <memory> | ||||
26 | | ||||
25 | #include "AcbfTextlayer.h" | 27 | #include "AcbfTextlayer.h" | ||
26 | 28 | | |||
27 | #include <QPoint> | 29 | #include <QPoint> | ||
28 | 30 | | |||
29 | namespace AdvancedComicBookFormat | 31 | namespace AdvancedComicBookFormat | ||
30 | { | 32 | { | ||
31 | class ACBF_EXPORT Textarea : public QObject | 33 | class ACBF_EXPORT Textarea : public QObject | ||
32 | { | 34 | { | ||
33 | Q_OBJECT | 35 | Q_OBJECT | ||
34 | public: | 36 | public: | ||
35 | explicit Textarea(Textlayer* parent = nullptr); | 37 | explicit Textarea(Textlayer* parent = nullptr); | ||
36 | ~Textarea() override; | 38 | ~Textarea() override; | ||
37 | 39 | | |||
40 | static QStringList availableTypes(); | ||||
41 | | ||||
38 | void toXml(QXmlStreamWriter* writer); | 42 | void toXml(QXmlStreamWriter* writer); | ||
39 | bool fromXml(QXmlStreamReader *xmlReader); | 43 | bool fromXml(QXmlStreamReader *xmlReader); | ||
40 | 44 | | |||
41 | QList<QPoint> points(); | 45 | QList<QPoint> points() const; | ||
42 | QPoint point(int index); | 46 | QPoint point(int index) const; | ||
43 | int pointIndex(QPoint point); | 47 | int pointIndex(const QPoint& point) const; | ||
48 | | ||||
44 | // If afterIndex is larger than zero, the insertion will happen at that index | 49 | // If afterIndex is larger than zero, the insertion will happen at that index | ||
45 | void addPoint(QPoint point, int index = -1); | 50 | void addPoint(const QPoint& point, int index = -1); | ||
46 | void removePoint(QPoint point); | 51 | void removePoint(const QPoint& point); | ||
47 | bool swapPoints(QPoint swapThis, QPoint withThis); | 52 | bool swapPoints(const QPoint& swapThis, const QPoint& withThis); | ||
48 | 53 | | |||
49 | QString bgcolor(); | 54 | QString bgcolor() const; | ||
50 | void setBgcolor(QString newColor = ""); | 55 | void setBgcolor(const QString& newColor = QString()); | ||
51 | 56 | | |||
52 | int textRotation(); | 57 | int textRotation() const; | ||
53 | void setTextRotation(int rotation = 0); | 58 | void setTextRotation(int rotation = 0); | ||
54 | 59 | | |||
55 | QString type(); | 60 | QString type() const; | ||
56 | void setType(QString type = "speech"); | 61 | void setType(const QString& type = QStringLiteral("speech")); | ||
57 | static QStringList availableTypes(); | | |||
58 | 62 | | |||
59 | bool inverted(); | 63 | bool inverted() const; | ||
60 | void setInverted(bool inverted = false); | 64 | void setInverted(bool inverted = false); | ||
61 | 65 | | |||
62 | bool transparent(); | 66 | bool transparent() const; | ||
63 | void setTransparent(bool transparent = false); | 67 | void setTransparent(bool transparent = false); | ||
64 | 68 | | |||
65 | QStringList paragraphs(); | 69 | QStringList paragraphs() const; | ||
66 | // Allowed sub-elements: strong, emphasis, strikethrough, sub, sup, a (with mandatory href attribute only) | 70 | // Allowed sub-elements: strong, emphasis, strikethrough, sub, sup, a (with mandatory href attribute only) | ||
67 | // Deprecated sub-elements (superceded by...): code (type option code), inverted (textarea option inverted) | 71 | // Deprecated sub-elements (superceded by...): code (type option code), inverted (textarea option inverted) | ||
68 | void setParagraphs(QStringList paragraphs); | 72 | void setParagraphs(const QStringList& paragraphs); | ||
69 | private: | 73 | private: | ||
70 | class Private; | 74 | class Private; | ||
71 | Private* d; | 75 | std::unique_ptr<Private> d; | ||
72 | }; | 76 | }; | ||
73 | } | 77 | } | ||
74 | 78 | | |||
75 | #endif//ACBFTEXTAREA_H | 79 | #endif//ACBFTEXTAREA_H |