Changeset View
Changeset View
Standalone View
Standalone View
src/lib/kaboutdata.h
Show All 23 Lines | |||||
24 | */ | 24 | */ | ||
25 | 25 | | |||
26 | #ifndef KABOUTDATA_H | 26 | #ifndef KABOUTDATA_H | ||
27 | #define KABOUTDATA_H | 27 | #define KABOUTDATA_H | ||
28 | 28 | | |||
29 | #include <kcoreaddons_export.h> | 29 | #include <kcoreaddons_export.h> | ||
30 | #include <QString> | 30 | #include <QString> | ||
31 | #include <QSharedDataPointer> | 31 | #include <QSharedDataPointer> | ||
32 | #include <QObject> | ||||
32 | 33 | | |||
33 | template <class T> class QList; | 34 | template <class T> class QList; | ||
34 | class QCommandLineParser; | 35 | class QCommandLineParser; | ||
35 | class QJsonObject; | 36 | class QJsonObject; | ||
36 | class QVariant; | 37 | class QVariant; | ||
37 | class KAboutData; | 38 | class KAboutData; | ||
38 | class KPluginMetaData; | 39 | class KPluginMetaData; | ||
39 | namespace KCrash | 40 | namespace KCrash | ||
Show All 22 Lines | |||||
62 | * | 63 | * | ||
63 | * about.addAuthor(i18n("Joe Developer"), i18n("developer"), "joe@host.com", 0); | 64 | * about.addAuthor(i18n("Joe Developer"), i18n("developer"), "joe@host.com", 0); | ||
64 | * QList<KAboutPerson> people = about.authors(); | 65 | * QList<KAboutPerson> people = about.authors(); | ||
65 | * about.addCredit(people[0].name(), people[0].task()); | 66 | * about.addCredit(people[0].name(), people[0].task()); | ||
66 | * @endcode | 67 | * @endcode | ||
67 | */ | 68 | */ | ||
68 | class KCOREADDONS_EXPORT KAboutPerson | 69 | class KCOREADDONS_EXPORT KAboutPerson | ||
69 | { | 70 | { | ||
71 | Q_GADGET | ||||
72 | Q_PROPERTY(QString name READ name) | ||||
73 | Q_PROPERTY(QString task READ task) | ||||
74 | Q_PROPERTY(QString emailAddress READ emailAddress) | ||||
75 | Q_PROPERTY(QString webAddress READ webAddress) | ||||
76 | Q_PROPERTY(QString ocsUsername READ ocsUsername) | ||||
70 | friend class KAboutData; | 77 | friend class KAboutData; | ||
71 | public: | 78 | public: | ||
72 | /** | 79 | /** | ||
73 | * Convenience constructor | 80 | * Convenience constructor | ||
74 | * | 81 | * | ||
75 | * @param name The name of the person. | 82 | * @param name The name of the person. | ||
76 | * | 83 | * | ||
77 | * @param task The task of this person. | 84 | * @param task The task of this person. | ||
78 | * | 85 | * | ||
79 | * @param emailAddress The email address of the person. | 86 | * @param emailAddress The email address of the person. | ||
80 | * | 87 | * | ||
81 | * @param webAddress Home page of the person. | 88 | * @param webAddress Home page of the person. | ||
82 | * | 89 | * | ||
83 | * @param ocsUsername Open Collaboration Services username of the person. | 90 | * @param ocsUsername Open Collaboration Services username of the person. | ||
84 | */ | 91 | */ | ||
85 | explicit KAboutPerson(const QString &name, | 92 | explicit KAboutPerson(const QString &name = QString(), | ||
aacid: Change "Default arguments @since 5.53" to "name default argument @since 5.53" | |||||
86 | const QString &task = QString(), | 93 | const QString &task = QString(), | ||
87 | const QString &emailAddress = QString(), | 94 | const QString &emailAddress = QString(), | ||
88 | const QString &webAddress = QString(), | 95 | const QString &webAddress = QString(), | ||
89 | const QString &ocsUsername = QString()); | 96 | const QString &ocsUsername = QString()); | ||
90 | 97 | | |||
91 | /** | 98 | /** | ||
92 | * Copy constructor. Performs a deep copy. | 99 | * Copy constructor. Performs a deep copy. | ||
93 | * @param other object to copy | 100 | * @param other object to copy | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | |||||
171 | * Explicitly creating a KAboutLicense object is not possible. | 178 | * Explicitly creating a KAboutLicense object is not possible. | ||
172 | * If the license is wanted for a KDE component having KAboutData object, | 179 | * If the license is wanted for a KDE component having KAboutData object, | ||
173 | * use KAboutData::licenses() to get the licenses for that component. | 180 | * use KAboutData::licenses() to get the licenses for that component. | ||
174 | * If the license is for a non-code resource and given by a keyword | 181 | * If the license is for a non-code resource and given by a keyword | ||
175 | * (e.g. in .desktop files), try using KAboutLicense::byKeyword(). | 182 | * (e.g. in .desktop files), try using KAboutLicense::byKeyword(). | ||
176 | */ | 183 | */ | ||
177 | class KCOREADDONS_EXPORT KAboutLicense | 184 | class KCOREADDONS_EXPORT KAboutLicense | ||
178 | { | 185 | { | ||
186 | Q_GADGET | ||||
187 | Q_PROPERTY(QString name READ name) | ||||
188 | Q_PROPERTY(QString text READ text) | ||||
189 | Q_PROPERTY(KAboutLicense::LicenseKey key READ key) | ||||
190 | Q_PROPERTY(QString spdx READ spdx) | ||||
179 | friend class KAboutData; | 191 | friend class KAboutData; | ||
180 | public: | 192 | public: | ||
193 | | ||||
181 | /** | 194 | /** | ||
182 | * Describes the license of the software. | 195 | * Describes the license of the software. | ||
183 | */ | 196 | */ | ||
184 | enum LicenseKey { | 197 | enum LicenseKey { | ||
185 | Custom = -2, | 198 | Custom = -2, | ||
186 | File = -1, | 199 | File = -1, | ||
187 | Unknown = 0, | 200 | Unknown = 0, | ||
188 | GPL = 1, | 201 | GPL = 1, | ||
189 | GPL_V2 = 1, | 202 | GPL_V2 = 1, | ||
190 | LGPL = 2, | 203 | LGPL = 2, | ||
191 | LGPL_V2 = 2, | 204 | LGPL_V2 = 2, | ||
192 | BSDL = 3, | 205 | BSDL = 3, | ||
193 | Artistic = 4, | 206 | Artistic = 4, | ||
194 | QPL = 5, | 207 | QPL = 5, | ||
195 | QPL_V1_0 = 5, | 208 | QPL_V1_0 = 5, | ||
196 | GPL_V3 = 6, | 209 | GPL_V3 = 6, | ||
197 | LGPL_V3 = 7, | 210 | LGPL_V3 = 7, | ||
198 | LGPL_V2_1 = 8 ///< @since 5.25 | 211 | LGPL_V2_1 = 8 ///< @since 5.25 | ||
199 | }; | 212 | }; | ||
213 | Q_ENUM(LicenseKey) | ||||
200 | 214 | | |||
201 | /** | 215 | /** | ||
202 | * Format of the license name. | 216 | * Format of the license name. | ||
203 | */ | 217 | */ | ||
204 | enum NameFormat { | 218 | enum NameFormat { | ||
205 | ShortName, | 219 | ShortName, | ||
206 | FullName | 220 | FullName | ||
207 | }; | 221 | }; | ||
222 | Q_ENUM(NameFormat) | ||||
208 | 223 | | |||
209 | /** | 224 | /** | ||
210 | * Whether later versions of the license are allowed. | 225 | * Whether later versions of the license are allowed. | ||
211 | */ | 226 | */ | ||
212 | enum VersionRestriction { | 227 | enum VersionRestriction { | ||
213 | OnlyThisVersion, | 228 | OnlyThisVersion, | ||
214 | OrLaterVersions | 229 | OrLaterVersions | ||
215 | }; | 230 | }; | ||
231 | Q_ENUM(VersionRestriction) | ||||
232 | | ||||
233 | explicit KAboutLicense(); | ||||
216 | 234 | | |||
217 | /** | 235 | /** | ||
218 | * Copy constructor. Performs a deep copy. | 236 | * Copy constructor. Performs a deep copy. | ||
219 | * @param other object to copy | 237 | * @param other object to copy | ||
220 | */ | 238 | */ | ||
221 | KAboutLicense(const KAboutLicense &other); | 239 | KAboutLicense(const KAboutLicense &other); | ||
222 | 240 | | |||
223 | ~KAboutLicense(); | 241 | ~KAboutLicense(); | ||
Show All 13 Lines | |||||
237 | */ | 255 | */ | ||
238 | QString text() const; | 256 | QString text() const; | ||
239 | 257 | | |||
240 | /** | 258 | /** | ||
241 | * Returns the license name. | 259 | * Returns the license name. | ||
242 | * | 260 | * | ||
243 | * @return The license name as a string. | 261 | * @return The license name as a string. | ||
244 | */ | 262 | */ | ||
245 | QString name(KAboutLicense::NameFormat formatName) const; | 263 | QString name(KAboutLicense::NameFormat formatName = ShortName) const; | ||
246 | 264 | | |||
247 | /** | 265 | /** | ||
248 | * Returns the license key. | 266 | * Returns the license key. | ||
249 | * | 267 | * | ||
250 | * @return The license key as element of KAboutLicense::LicenseKey enum. | 268 | * @return The license key as element of KAboutLicense::LicenseKey enum. | ||
251 | */ | 269 | */ | ||
252 | KAboutLicense::LicenseKey key() const; | 270 | KAboutLicense::LicenseKey key() const; | ||
253 | 271 | | |||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Line(s) | |||||
377 | * | 395 | * | ||
378 | * @short Holds information needed by the "About" box and other | 396 | * @short Holds information needed by the "About" box and other | ||
379 | * classes. | 397 | * classes. | ||
380 | * @author Espen Sand (espen@kde.org), David Faure (faure@kde.org) | 398 | * @author Espen Sand (espen@kde.org), David Faure (faure@kde.org) | ||
381 | * | 399 | * | ||
382 | */ | 400 | */ | ||
383 | class KCOREADDONS_EXPORT KAboutData | 401 | class KCOREADDONS_EXPORT KAboutData | ||
384 | { | 402 | { | ||
403 | Q_GADGET | ||||
404 | Q_PROPERTY(QString displayName READ displayName) | ||||
405 | Q_PROPERTY(QString productName READ productName) | ||||
406 | Q_PROPERTY(QString componentName READ componentName) | ||||
407 | Q_PROPERTY(QVariant programLogo READ programLogo) | ||||
408 | Q_PROPERTY(QString shortDescription READ shortDescription) | ||||
409 | Q_PROPERTY(QString homepage READ homepage) | ||||
410 | Q_PROPERTY(QString bugAddress READ bugAddress) | ||||
411 | Q_PROPERTY(QString version READ version) | ||||
412 | Q_PROPERTY(QString otherText READ otherText) | ||||
413 | Q_PROPERTY(QVariantList authors READ authorsVariant) | ||||
414 | Q_PROPERTY(QVariantList credits READ creditsVariant) | ||||
415 | Q_PROPERTY(QVariantList translators READ translatorsVariant) | ||||
416 | Q_PROPERTY(QVariantList licenses READ licensesVariant) | ||||
417 | Q_PROPERTY(QString copyrightStatement READ copyrightStatement) | ||||
418 | Q_PROPERTY(QString desktopFileName READ desktopFileName) | ||||
385 | public: | 419 | public: | ||
386 | 420 | | |||
387 | /** | 421 | /** | ||
388 | * Returns the KAboutData for the application. | 422 | * Returns the KAboutData for the application. | ||
389 | * | 423 | * | ||
390 | * This contains information such as authors, license, etc., | 424 | * This contains information such as authors, license, etc., | ||
391 | * provided that setApplicationData has been called before. | 425 | * provided that setApplicationData has been called before. | ||
392 | * If not called before, the returned KAboutData will be initialized from the | 426 | * If not called before, the returned KAboutData will be initialized from the | ||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | 473 | public: | |||
509 | * | 543 | * | ||
510 | * @param version The component version string. | 544 | * @param version The component version string. | ||
511 | * | 545 | * | ||
512 | * Sets the property desktopFileName to "org.kde."+componentName and | 546 | * Sets the property desktopFileName to "org.kde."+componentName and | ||
513 | * the property organizationDomain to "kde.org". | 547 | * the property organizationDomain to "kde.org". | ||
514 | * | 548 | * | ||
515 | * @see setOrganizationDomain(const QByteArray&), setDesktopFileName(const QString&) | 549 | * @see setOrganizationDomain(const QByteArray&), setDesktopFileName(const QString&) | ||
516 | */ | 550 | */ | ||
517 | KAboutData(const QString &componentName, | 551 | explicit KAboutData(const QString &componentName = {}, | ||
518 | const QString &displayName, | 552 | const QString &displayName = {}, | ||
519 | const QString &version | 553 | const QString &version = {} | ||
Do we want to make this constructor explicit since the new default values now make it possible to construct a KAboutData with no parameters at all? mpyne: Do we want to make this constructor `explicit` since the new default values now make it… | |||||
520 | ); | 554 | ); | ||
521 | 555 | | |||
522 | /** | 556 | /** | ||
523 | * Copy constructor. Performs a deep copy. | 557 | * Copy constructor. Performs a deep copy. | ||
524 | * @param other object to copy | 558 | * @param other object to copy | ||
525 | */ | 559 | */ | ||
526 | KAboutData(const KAboutData &other); | 560 | KAboutData(const KAboutData &other); | ||
527 | 561 | | |||
▲ Show 20 Lines • Show All 581 Lines • ▼ Show 20 Line(s) | |||||
1109 | 1143 | | |||
1110 | /** | 1144 | /** | ||
1111 | * @returns The desktop file name of this application (e.g. "org.kde.foo") | 1145 | * @returns The desktop file name of this application (e.g. "org.kde.foo") | ||
1112 | * @sa setDesktopFileName(const QString&) | 1146 | * @sa setDesktopFileName(const QString&) | ||
1113 | * @since 5.16 | 1147 | * @since 5.16 | ||
1114 | **/ | 1148 | **/ | ||
1115 | QString desktopFileName() const; | 1149 | QString desktopFileName() const; | ||
1116 | 1150 | | |||
1151 | QVariantList licensesVariant() const; | ||||
1152 | QVariantList authorsVariant() const; | ||||
1153 | QVariantList creditsVariant() const; | ||||
1154 | QVariantList translatorsVariant() const; | ||||
1155 | | ||||
1117 | private: | 1156 | private: | ||
1118 | 1157 | | |||
1119 | friend void KCrash::defaultCrashHandler(int sig); | 1158 | friend void KCrash::defaultCrashHandler(int sig); | ||
1120 | static const KAboutData *applicationDataPointer(); | 1159 | static const KAboutData *applicationDataPointer(); | ||
1121 | 1160 | | |||
1122 | class Private; | 1161 | class Private; | ||
1123 | Private *const d; | 1162 | Private *const d; | ||
1124 | }; | 1163 | }; | ||
1125 | 1164 | | |||
1165 | Q_DECLARE_METATYPE(KAboutData) | ||||
1166 | Q_DECLARE_METATYPE(KAboutLicense) | ||||
1167 | Q_DECLARE_METATYPE(KAboutPerson) | ||||
1168 | | ||||
1126 | #endif | 1169 | #endif | ||
1127 | 1170 | |
Change "Default arguments @since 5.53" to "name default argument @since 5.53"