KDECore
kaboutdata.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE Libraries 00003 * Copyright (C) 2000 Espen Sand (espen@kde.org) 00004 * Copyright (C) 2008 Friedrich W. H. Kossebau <kossebau@kde.org> 00005 * Copyright (C) 2010 Teo Mrnjavac <teo@kde.org> 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Library General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Library General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Library General Public License 00018 * along with this library; see the file COPYING.LIB. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 * Boston, MA 02110-1301, USA. 00021 * 00022 */ 00023 00024 #ifndef KABOUTDATA_H 00025 #define KABOUTDATA_H 00026 00027 #include <kdecore_export.h> 00028 #include <klocale.h> 00029 // Qt 00030 #include <QtCore/QString> 00031 #include <QtCore/QSharedDataPointer> 00032 00033 template <class T> class QList; 00034 class QVariant; 00035 class KAboutData; 00036 00068 class KDECORE_EXPORT KAboutPerson 00069 { 00070 friend class KAboutData; 00071 public: 00083 explicit KAboutPerson( const KLocalizedString &name, 00084 const KLocalizedString &task = KLocalizedString(), 00085 const QByteArray &emailAddress = QByteArray(), 00086 const QByteArray &webAddress = QByteArray() ); 00087 00101 explicit KAboutPerson( const KLocalizedString &name, 00102 const KLocalizedString &task, 00103 const QByteArray &emailAddress, 00104 const QByteArray &webAddress, 00105 const QByteArray &ocsUsername ); //KDE5: merge into main ctor 00106 00111 KAboutPerson(const KAboutPerson& other); 00112 00113 ~KAboutPerson(); 00114 00119 KAboutPerson& operator=(const KAboutPerson& other); 00120 00121 00127 QString name() const; 00128 00134 QString task() const; 00135 00141 QString emailAddress() const; 00142 00148 QString webAddress() const; 00149 00155 QString ocsUsername() const; 00156 00157 private: 00161 explicit KAboutPerson( const QString &name, const QString &email ); 00162 00163 class Private; 00164 Private *const d; 00165 }; 00166 00167 class KAboutLicense; 00168 00169 // KDE5: refactor together with KComponentData. 00170 // Like changing all property names which contain Program or App. 00171 00192 class KDECORE_EXPORT KAboutData 00193 { 00194 public: 00198 enum LicenseKey // KDE5: move to KAboutLicense, cut License_ prefix 00199 { 00200 License_Custom = -2, 00201 License_File = -1, 00202 License_Unknown = 0, 00203 License_GPL = 1, 00204 License_GPL_V2 = 1, 00205 License_LGPL = 2, 00206 License_LGPL_V2 = 2, 00207 License_BSD = 3, 00208 License_Artistic = 4, 00209 License_QPL = 5, 00210 License_QPL_V1_0 = 5, 00211 License_GPL_V3 = 6, 00212 License_LGPL_V3 = 7 00213 }; 00214 00218 enum NameFormat // KDE5: move to KAboutLicense 00219 { 00220 ShortName, 00221 FullName 00222 }; 00223 00224 public: 00266 KAboutData( const QByteArray &appName, 00267 const QByteArray &catalogName, 00268 const KLocalizedString &programName, 00269 const QByteArray &version, 00270 const KLocalizedString &shortDescription = KLocalizedString(), 00271 enum LicenseKey licenseType = License_Unknown, 00272 const KLocalizedString ©rightStatement = KLocalizedString(), 00273 const KLocalizedString &otherText = KLocalizedString(), 00274 const QByteArray &homePageAddress = QByteArray(), 00275 const QByteArray &bugsEmailAddress = "submit@bugs.kde.org" 00276 ); 00277 00282 KAboutData(const KAboutData& other); 00283 00288 KAboutData& operator=(const KAboutData& other); 00289 00290 ~KAboutData(); 00291 00314 KAboutData &addAuthor( const KLocalizedString &name, 00315 const KLocalizedString &task = KLocalizedString(), 00316 const QByteArray &emailAddress = QByteArray(), 00317 const QByteArray &webAddress = QByteArray() ); 00318 00344 KAboutData &addAuthor( const KLocalizedString &name, 00345 const KLocalizedString &task, 00346 const QByteArray &emailAddress, 00347 const QByteArray &webAddress, 00348 const QByteArray &ocsUsername ); //KDE5: merge with addAuthor 00349 00372 KAboutData &addCredit( const KLocalizedString &name, 00373 const KLocalizedString &task = KLocalizedString(), 00374 const QByteArray &emailAddress = QByteArray(), 00375 const QByteArray &webAddress = QByteArray() ); 00376 00402 KAboutData &addCredit( const KLocalizedString &name, 00403 const KLocalizedString &task, 00404 const QByteArray &emailAddress, 00405 const QByteArray &webAddress, 00406 const QByteArray &ocsUsername ); //KDE5: merge with addCredit 00407 00430 KAboutData &setTranslator( const KLocalizedString& name, 00431 const KLocalizedString& emailAddress ); 00432 00443 KAboutData &setLicenseText( const KLocalizedString &license ); 00444 00460 KAboutData &addLicenseText( const KLocalizedString &license ); 00461 00468 KAboutData &setLicenseTextFile( const QString &file ); 00469 00481 KAboutData &addLicenseTextFile( const QString &file ); 00482 00488 KAboutData &setAppName( const QByteArray &appName ); 00489 00497 KAboutData &setProgramName( const KLocalizedString &programName ); 00498 00509 KAboutData &setProgramIconName( const QString &iconName ); 00510 00523 KAboutData &setProgramLogo(const QVariant& image); 00524 00537 KAboutData &setOcsProvider( const QByteArray &providerUrl ); 00538 00544 KAboutData &setVersion( const QByteArray &version ); 00545 00553 KAboutData &setShortDescription( const KLocalizedString &shortDescription ); 00554 00560 KAboutData &setCatalogName( const QByteArray &catalogName ); 00561 00568 KAboutData &setLicense( LicenseKey licenseKey ); 00569 00580 KAboutData &addLicense( LicenseKey licenseKey ); 00581 00589 KAboutData &setCopyrightStatement( const KLocalizedString ©rightStatement ); 00590 00598 KAboutData &setOtherText( const KLocalizedString &otherText ); 00599 00607 KAboutData &setHomepage( const QByteArray &homepage ); 00608 00615 KAboutData &setBugAddress( const QByteArray &bugAddress ); 00616 00634 KAboutData &setOrganizationDomain( const QByteArray &domain ); 00635 00644 KAboutData &setProductName( const QByteArray &name ); 00645 00650 QString appName() const; 00651 00659 QString productName() const; 00660 00665 QString programName() const; 00666 00672 QString organizationDomain() const; 00673 00678 const char* internalProgramName() const; 00679 00684 void translateInternalProgramName() const; 00685 00697 QString programIconName() const; 00698 00708 QVariant programLogo() const; 00709 00714 QString ocsProviderUrl() const; 00715 00720 QString version() const; 00721 00726 const char* internalVersion() const; 00727 00733 QString shortDescription() const; 00734 00739 QString catalogName() const; 00740 00746 QString homepage() const; 00747 00752 QString bugAddress() const; 00753 00758 const char* internalBugAddress() const; 00759 00764 QList<KAboutPerson> authors() const; 00765 00770 QList<KAboutPerson> credits() const; 00771 00776 QList<KAboutPerson> translators() const; 00777 00782 static QString aboutTranslationTeam(); 00783 00788 QString otherText() const; 00789 00799 QString license() const; 00800 00808 QString licenseName(NameFormat formatName) const; 00809 00816 QList<KAboutLicense> licenses() const; 00817 00822 QString copyrightStatement() const; 00823 00831 QString customAuthorPlainText() const; 00832 00840 QString customAuthorRichText() const; 00841 00849 bool customAuthorTextEnabled() const; 00850 00862 KAboutData &setCustomAuthorText(const KLocalizedString &plainText, 00863 const KLocalizedString &richText); 00864 00870 KAboutData &unsetCustomAuthorText(); 00871 00872 private: 00873 00874 class Private; 00875 Private *const d; 00876 }; 00877 00878 00894 class KDECORE_EXPORT KAboutLicense 00895 { 00896 friend class KAboutData; 00897 public: 00902 KAboutLicense(const KAboutLicense& other); 00903 00904 ~KAboutLicense(); 00905 00910 KAboutLicense& operator=(const KAboutLicense& other); 00911 00912 00920 QString text() const; 00921 00927 QString name(KAboutData::NameFormat formatName) const; 00928 00935 KAboutData::LicenseKey key() const; 00936 00959 static KAboutLicense byKeyword(const QString &keyword); 00960 00961 private: 00965 explicit KAboutLicense( enum KAboutData::LicenseKey licenseType, const KAboutData *aboutData ); 00969 explicit KAboutLicense( const QString &pathToFile, const KAboutData *aboutData ); 00973 explicit KAboutLicense( const KLocalizedString &licenseText, const KAboutData *aboutData ); 00974 00975 class Private; 00976 QSharedDataPointer<Private> d; 00977 }; 00978 00979 #endif 00980
KDE 4.6 API Reference