Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfAuthor.h
Context not available. | |||||
25 | #include "AcbfMetadata.h" | 25 | #include "AcbfMetadata.h" | ||
---|---|---|---|---|---|
26 | #include <memory> | 26 | #include <memory> | ||
27 | 27 | | |||
28 | /** | ||||
29 | * \brief Class for handling ACBF style authors. | ||||
30 | * | ||||
31 | * ACBF style authors have their names split up into | ||||
32 | * first/middle/last and nickname. This is because | ||||
33 | * traditionally archives use a lastname, first name | ||||
34 | * format to catalogue the entry, while in the west | ||||
35 | * their proper name is firstname/lastname. | ||||
36 | * | ||||
37 | * Nickname is particularly necessary for comics because | ||||
38 | * many artists use a nom de plume of sorts. | ||||
39 | * | ||||
40 | * activity is similar to EPUB role, but where EPUB uses | ||||
41 | * MARC relators, ACBF has its own limited list of activities. | ||||
42 | * These are available as a stringlist from | ||||
43 | * the available activities function. | ||||
44 | * | ||||
45 | * Authors also have two contact options | ||||
46 | * available(homepage and email), the official xsd | ||||
47 | * allows multiple of these. | ||||
48 | * | ||||
49 | * Authors can also have a language assigned. | ||||
50 | * This is relevant for translator in particular, but | ||||
51 | * the official xsd does not invalidate any other with | ||||
52 | * the attribute. | ||||
53 | * | ||||
54 | * Authors should, at minimum have a name, which is either | ||||
55 | * a nickname, or a first and lastname. | ||||
56 | */ | ||||
57 | | ||||
28 | namespace AdvancedComicBookFormat | 58 | namespace AdvancedComicBookFormat | ||
29 | { | 59 | { | ||
30 | class ACBF_EXPORT Author : public QObject | 60 | class ACBF_EXPORT Author : public QObject | ||
Context not available. | |||||
35 | explicit Author(Metadata* parent = nullptr); | 65 | explicit Author(Metadata* parent = nullptr); | ||
36 | ~Author(); | 66 | ~Author(); | ||
37 | 67 | | |||
68 | /** | ||||
69 | * Write the data from this author object into the XmlStream. | ||||
70 | */ | ||||
38 | void toXml(QXmlStreamWriter* writer); | 71 | void toXml(QXmlStreamWriter* writer); | ||
72 | | ||||
73 | /** | ||||
74 | * \brief Load the data from the acbf xml into this author object. | ||||
75 | * @return True if the xmlReader encountered no errors. | ||||
76 | */ | ||||
39 | bool fromXml(QXmlStreamReader *xmlReader); | 77 | bool fromXml(QXmlStreamReader *xmlReader); | ||
40 | 78 | | |||
79 | /** | ||||
80 | * \brief convenience function to put together the different parts | ||||
81 | * of the author's name into a single string. | ||||
82 | * @return a single string for the author's name. | ||||
83 | */ | ||||
41 | Q_INVOKABLE QString displayName() const; | 84 | Q_INVOKABLE QString displayName() const; | ||
42 | 85 | | |||
86 | /** | ||||
87 | * @return The activity this author performed on the book. | ||||
88 | */ | ||||
43 | Q_INVOKABLE QString activity() const; | 89 | Q_INVOKABLE QString activity() const; | ||
90 | | ||||
91 | /** | ||||
92 | * \brief Set the activity this author performed on the book. | ||||
93 | * @param activity - the activity as a string, should be an entry | ||||
94 | * of availableActivities(). | ||||
95 | */ | ||||
44 | Q_INVOKABLE void setActivity(const QString& activity); | 96 | Q_INVOKABLE void setActivity(const QString& activity); | ||
97 | | ||||
98 | /** | ||||
99 | * @return A list of all the approved activities. | ||||
100 | */ | ||||
45 | Q_INVOKABLE static QStringList availableActivities(); | 101 | Q_INVOKABLE static QStringList availableActivities(); | ||
46 | 102 | | |||
47 | // The language this author worked in for this book. Activity dependent (writer, translator, letterer...) | 103 | /** | ||
104 | * \brief The language this author worked in for this book. Activity dependent (writer, translator, letterer...) | ||||
105 | * @return The language in xs:language style language-COUNTRY format. | ||||
106 | */ | ||||
48 | Q_INVOKABLE QString language() const; | 107 | Q_INVOKABLE QString language() const; | ||
108 | | ||||
109 | /** | ||||
110 | * \brief Set the language used by this author, in particular necessary for translator. | ||||
111 | * | ||||
112 | * @param language should be xs:language, which is BCP 47 minus the script. | ||||
113 | */ | ||||
49 | Q_INVOKABLE void setLanguage(const QString& language = QString()); | 114 | Q_INVOKABLE void setLanguage(const QString& language = QString()); | ||
50 | 115 | | |||
116 | /** | ||||
117 | * @return the given name of this author as a QString. | ||||
118 | */ | ||||
51 | Q_INVOKABLE QString firstName() const; | 119 | Q_INVOKABLE QString firstName() const; | ||
120 | | ||||
121 | /** | ||||
122 | * \brief Set the given name of this author. | ||||
123 | * @param name - the given name as a string. | ||||
124 | */ | ||||
52 | Q_INVOKABLE void setFirstName(const QString& name); | 125 | Q_INVOKABLE void setFirstName(const QString& name); | ||
126 | | ||||
127 | /** | ||||
128 | * @return the middles name(s) of this author as a QString. | ||||
129 | */ | ||||
53 | Q_INVOKABLE QString middleName() const; | 130 | Q_INVOKABLE QString middleName() const; | ||
131 | | ||||
132 | /** | ||||
133 | * \brief Set the middles name(s) of this author. | ||||
134 | * @param name - the middle name(s) as a string. | ||||
135 | */ | ||||
54 | Q_INVOKABLE void setMiddleName(const QString& name); | 136 | Q_INVOKABLE void setMiddleName(const QString& name); | ||
137 | | ||||
138 | /** | ||||
139 | * @return the family name of this author as a QString. | ||||
140 | */ | ||||
55 | Q_INVOKABLE QString lastName() const; | 141 | Q_INVOKABLE QString lastName() const; | ||
142 | | ||||
143 | /** | ||||
144 | * \brief Set the family name of this author. | ||||
145 | * @param name - the family name as a string. | ||||
146 | */ | ||||
56 | Q_INVOKABLE void setLastName(const QString& name); | 147 | Q_INVOKABLE void setLastName(const QString& name); | ||
148 | | ||||
149 | /** | ||||
150 | * @return the nick name of this author as a QString. | ||||
151 | */ | ||||
57 | Q_INVOKABLE QString nickName() const; | 152 | Q_INVOKABLE QString nickName() const; | ||
153 | | ||||
154 | /** | ||||
155 | * \brief set the nick name of this author. | ||||
156 | * @param name - the nickname as a string. | ||||
157 | */ | ||||
58 | Q_INVOKABLE void setNickName(const QString& name); | 158 | Q_INVOKABLE void setNickName(const QString& name); | ||
159 | | ||||
160 | /** | ||||
161 | * @return the homepage associated with this author as a QString. | ||||
162 | */ | ||||
59 | Q_INVOKABLE QString homePage() const; | 163 | Q_INVOKABLE QString homePage() const; | ||
164 | | ||||
165 | /** | ||||
166 | * \brief Set the homepage associated with this author. | ||||
167 | * @param homepage - the url of the homepage as a string. | ||||
168 | */ | ||||
60 | Q_INVOKABLE void setHomePage(const QString& homepage); | 169 | Q_INVOKABLE void setHomePage(const QString& homepage); | ||
170 | | ||||
171 | /** | ||||
172 | * @return The email adress associated with this author as a QString. | ||||
173 | */ | ||||
61 | Q_INVOKABLE QString email() const; | 174 | Q_INVOKABLE QString email() const; | ||
175 | | ||||
176 | /** | ||||
177 | * \brief Set the email adress associated with this author. | ||||
178 | * @param email - email as a string. | ||||
179 | */ | ||||
62 | Q_INVOKABLE void setEmail(const QString& email); | 180 | Q_INVOKABLE void setEmail(const QString& email); | ||
63 | private: | 181 | private: | ||
64 | class Private; | 182 | class Private; | ||
Context not available. |