Changeset View
Changeset View
Standalone View
Standalone View
src/lib/kaboutdata.cpp
Show First 20 Lines • Show All 189 Lines • ▼ Show 20 Line(s) | 172 | { | |||
---|---|---|---|---|---|
190 | case KAboutLicense::Custom: | 190 | case KAboutLicense::Custom: | ||
191 | case KAboutLicense::File: | 191 | case KAboutLicense::File: | ||
192 | case KAboutLicense::Unknown: | 192 | case KAboutLicense::Unknown: | ||
193 | return QString(); | 193 | return QString(); | ||
194 | } | 194 | } | ||
195 | return QString(); | 195 | return QString(); | ||
196 | } | 196 | } | ||
197 | 197 | | |||
198 | KAboutLicense::KAboutLicense() | ||||
199 | : d(new Private(Unknown, {}, nullptr)) | ||||
200 | {} | ||||
201 | | ||||
202 | | ||||
198 | KAboutLicense::KAboutLicense(LicenseKey licenseType, | 203 | KAboutLicense::KAboutLicense(LicenseKey licenseType, | ||
199 | VersionRestriction versionRestriction, | 204 | VersionRestriction versionRestriction, | ||
200 | const KAboutData *aboutData) | 205 | const KAboutData *aboutData) | ||
201 | : d(new Private(licenseType, versionRestriction, aboutData)) | 206 | : d(new Private(licenseType, versionRestriction, aboutData)) | ||
202 | { | 207 | { | ||
203 | 208 | | |||
204 | } | 209 | } | ||
205 | 210 | | |||
▲ Show 20 Lines • Show All 904 Lines • ▼ Show 20 Line(s) | 1114 | if (app) { | |||
1110 | app->setApplicationVersion(aboutData.version()); | 1115 | app->setApplicationVersion(aboutData.version()); | ||
1111 | app->setApplicationName(aboutData.componentName()); | 1116 | app->setApplicationName(aboutData.componentName()); | ||
1112 | app->setOrganizationDomain(aboutData.organizationDomain()); | 1117 | app->setOrganizationDomain(aboutData.organizationDomain()); | ||
1113 | app->setProperty("applicationDisplayName", aboutData.displayName()); | 1118 | app->setProperty("applicationDisplayName", aboutData.displayName()); | ||
1114 | app->setProperty("desktopFileName", aboutData.desktopFileName()); | 1119 | app->setProperty("desktopFileName", aboutData.desktopFileName()); | ||
1115 | } else { | 1120 | } else { | ||
1116 | qCWarning(KABOUTDATA) << "Could not initialize the equivalent properties of Q*Application: no instance (yet) existing."; | 1121 | qCWarning(KABOUTDATA) << "Could not initialize the equivalent properties of Q*Application: no instance (yet) existing."; | ||
1117 | } | 1122 | } | ||
1123 | | ||||
1118 | // KF6: Rethink the current relation between KAboutData::applicationData and the Q*Application metadata | 1124 | // KF6: Rethink the current relation between KAboutData::applicationData and the Q*Application metadata | ||
1119 | // Always overwriting the Q*Application metadata here, but not updating back the KAboutData | 1125 | // Always overwriting the Q*Application metadata here, but not updating back the KAboutData | ||
1120 | // in applicationData() is unbalanced and can result in out-of-sync data if the Q*Application | 1126 | // in applicationData() is unbalanced and can result in out-of-sync data if the Q*Application | ||
1121 | // setters have been called meanwhile | 1127 | // setters have been called meanwhile | ||
1122 | // Options are to remove the overlapping properties of KAboutData for cleancode, or making the | 1128 | // Options are to remove the overlapping properties of KAboutData for cleancode, or making the | ||
1123 | // overlapping properties official shadow properties of their Q*Application countparts, though | 1129 | // overlapping properties official shadow properties of their Q*Application countparts, though | ||
1124 | // that increases behavioural complexity a little. | 1130 | // that increases behavioural complexity a little. | ||
1125 | } | 1131 | } | ||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 1174 | { | |||
1201 | if (!desktopFileName.isEmpty()) { | 1207 | if (!desktopFileName.isEmpty()) { | ||
1202 | d->desktopFileName = desktopFileName; | 1208 | d->desktopFileName = desktopFileName; | ||
1203 | } | 1209 | } | ||
1204 | 1210 | | |||
1205 | if (foundArgument) { | 1211 | if (foundArgument) { | ||
1206 | ::exit(EXIT_SUCCESS); | 1212 | ::exit(EXIT_SUCCESS); | ||
1207 | } | 1213 | } | ||
1208 | } | 1214 | } | ||
1215 | | ||||
1216 | template <class T> | ||||
1217 | QVariantList listToVariant(const QList<T>& values) | ||||
1218 | { | ||||
1219 | QVariantList ret; | ||||
1220 | ret.reserve(values.count()); | ||||
1221 | for(const auto &license: values) { | ||||
1222 | ret << QVariant::fromValue(license); | ||||
1223 | } | ||||
1224 | return ret; | ||||
1225 | } | ||||
1226 | | ||||
1227 | QVariantList KAboutData::licensesVariant() const | ||||
1228 | { | ||||
1229 | return listToVariant(d->_licenseList); | ||||
1230 | } | ||||
1231 | | ||||
1232 | QVariantList KAboutData::authorsVariant() const | ||||
1233 | { | ||||
1234 | return listToVariant(d->_authorList); | ||||
1235 | } | ||||
1236 | | ||||
1237 | QVariantList KAboutData::creditsVariant() const | ||||
1238 | { | ||||
1239 | return listToVariant(d->_creditList); | ||||
1240 | } | ||||
1241 | | ||||
1242 | QVariantList KAboutData::translatorsVariant() const | ||||
1243 | { | ||||
1244 | return listToVariant(d->_translatorList); | ||||
1245 | } |