23 #include <tdeaboutdata.h>
24 #include <kstandarddirs.h>
26 #include <tqtextstream.h>
31 return TQString::fromUtf8(mName);
40 return TQString::null;
46 return TQString::fromUtf8(mEmailAddress);
53 return TQString::fromUtf8(mWebAddress);
58 const TQString & emailAddress)
74 class TDEAboutDataPrivate
78 : translatorName(
"_: NAME OF TRANSLATORS\nYour names")
79 , translatorEmail(
"_: EMAIL OF TRANSLATORS\nYour emails")
82 , customAuthorTextEnabled(false)
83 , mTranslatedProgramName( 0 )
85 ~TDEAboutDataPrivate()
88 delete[] mTranslatedProgramName;
90 const char *translatorName;
91 const char *translatorEmail;
92 const char *productName;
94 TQString customAuthorPlainText, customAuthorRichText;
95 bool customAuthorTextEnabled;
96 const char *mTranslatedProgramName;
99 const char *TDEAboutData::defaultBugTracker =
"http://bugs.trinitydesktop.org";
102 const char *programName,
104 const char *shortDescription,
106 const char *copyrightStatement,
108 const char *homePageAddress,
109 const char *bugsEmailAddress
111 mProgramName( programName ),
113 mShortDescription( shortDescription ),
114 mLicenseKey( licenseType ),
115 mCopyrightStatement( copyrightStatement ),
117 mHomepageAddress( homePageAddress ),
118 mBugEmailAddress( (bugsEmailAddress!=0)?bugsEmailAddress:defaultBugTracker ),
121 d =
new TDEAboutDataPrivate;
124 const char *p = strrchr(
appName,
'/');
133 TDEAboutData::~TDEAboutData()
135 if (mLicenseKey == License_File)
136 delete [] mLicenseText;
142 const char *emailAddress,
const char *webAddress )
144 mAuthorList.append(
TDEAboutPerson(name,task,emailAddress,webAddress));
149 const char *emailAddress,
const char *webAddress )
151 mCreditList.append(
TDEAboutPerson(name,task,emailAddress,webAddress));
157 d->translatorName=name;
158 d->translatorEmail=emailAddress;
164 mLicenseText = licenseText;
165 mLicenseKey = License_Custom;
171 mLicenseText = tqstrdup(TQFile::encodeName(file));
172 mLicenseKey = License_File;
185 translateInternalProgramName();
203 mLicenseKey = licenseKey;
246 return d->productName;
254 if (mProgramName && *mProgramName)
255 return i18n(mProgramName);
257 return TQString::null;
261 TDEAboutData::internalProgramName()
const
263 if (d->mTranslatedProgramName)
264 return d->mTranslatedProgramName;
273 TDEAboutData::translateInternalProgramName()
const
275 delete[] d->mTranslatedProgramName;
276 d->mTranslatedProgramName = 0;
278 d->mTranslatedProgramName = tqstrdup(
programName().utf8());
284 return d->programLogo ? (*d->programLogo) : TQImage();
291 d->programLogo =
new TQImage( image );
293 *d->programLogo = image;
299 return TQString::fromLatin1(mVersion);
305 if (mShortDescription && *mShortDescription)
306 return i18n(mShortDescription);
308 return TQString::null;
314 return TQString::fromLatin1(mHomepageAddress);
320 return TQString::fromLatin1(mBugEmailAddress);
323 const TQValueList<TDEAboutPerson>
329 const TQValueList<TDEAboutPerson>
335 const TQValueList<TDEAboutTranslator>
338 TQValueList<TDEAboutTranslator> personList;
340 if(d->translatorName == 0)
343 TQStringList nameList;
344 TQStringList emailList;
346 TQString names = i18n(d->translatorName);
347 if(names != TQString::fromUtf8(d->translatorName))
349 nameList = TQStringList::split(
',',names);
353 if(d->translatorEmail)
355 TQString emails = i18n(d->translatorEmail);
357 if(emails != TQString::fromUtf8(d->translatorEmail))
359 emailList = TQStringList::split(
',',emails,
true);
364 TQStringList::Iterator nit;
365 TQStringList::Iterator eit=emailList.begin();
367 for(nit = nameList.begin(); nit != nameList.end(); ++nit)
370 if(eit != emailList.end())
378 personList.append(
TDEAboutTranslator(name.stripWhiteSpace(), email.stripWhiteSpace()));
387 return i18n(
"replace this with information about your translation team",
388 "<p>TDE is translated into many languages thanks to the work "
389 "of the translation teams all over the world.</p>"
390 "<p>For more information on TDE internationalization "
391 "visit the <a href=\"https://wiki.trinitydesktop.org/"
392 "TDE_Weblate_Translation_Workspace\">TDE Weblate "
393 "Translation Workspace (TWTW)</a></p>"
400 if (mOtherText && *mOtherText)
401 return i18n(mOtherText);
403 return TQString::null;
416 switch ( mLicenseKey )
419 f = TQFile::decodeName(mLicenseText);
423 f = locate(
"data",
"LICENSES/GPL_V2");
425 case License_LGPL_V2:
427 f = locate(
"data",
"LICENSES/LGPL_V2");
431 f = locate(
"data",
"LICENSES/GPL_V3");
433 case License_LGPL_V3:
435 f = locate(
"data",
"LICENSES/LGPL_V3");
439 f = locate(
"data",
"LICENSES/BSD");
441 case License_Artistic:
442 l =
"Artistic License";
443 f = locate(
"data",
"LICENSES/ARTISTIC");
445 case License_QPL_V1_0:
447 f = locate(
"data",
"LICENSES/QPL_V1.0");
451 f = locate(
"data",
"LICENSES/MIT");
454 if (mLicenseText && *mLicenseText)
455 return( i18n(mLicenseText) );
458 result += i18n(
"No licensing terms for this program have been specified.\n"
459 "Please check the documentation or the source for any\n"
460 "licensing terms.\n");
465 result += i18n(
"This program is distributed under the terms of the %1.").arg( l );
470 if (file.open(IO_ReadOnly))
474 TQTextStream str(&file);
475 result += str.read();
485 if (mCopyrightStatement && *mCopyrightStatement)
486 return i18n(mCopyrightStatement);
488 return TQString::null;
494 return d->customAuthorPlainText;
500 return d->customAuthorRichText;
506 return d->customAuthorTextEnabled;
512 d->customAuthorPlainText = plainText;
513 d->customAuthorRichText = richText;
515 d->customAuthorTextEnabled =
true;
521 d->customAuthorPlainText = TQString::null;
522 d->customAuthorRichText = TQString::null;
524 d->customAuthorTextEnabled =
false;
void setProductName(const char *name)
Defines the product name wich will be used in the KBugReport dialog.
const TQValueList< TDEAboutPerson > authors() const
Returns a list of authors.
void setProgramName(const char *programName)
Defines the displayable program name string.
void setShortDescription(const char *shortDescription)
Defines a short description of what the program does.
void addAuthor(const char *name, const char *task=0, const char *emailAddress=0, const char *webAddress=0)
Defines an author.
void setLicense(LicenseKey licenseKey)
Defines the license identifier.
TQString shortDescription() const
Returns a short, translated description.
TQString license() const
Returns the license.
void setProgramLogo(const TQImage &image)
Defines the program logo.
TQString copyrightStatement() const
Returns the copyright statement.
void addCredit(const char *name, const char *task=0, const char *emailAddress=0, const char *webAddress=0)
Defines a person that deserves credit.
TQString customAuthorPlainText() const
Returns the plain text displayed around the list of authors instead of the default message telling us...
void setOtherText(const char *otherText)
Defines the additional text to show in the about dialog.
void unsetCustomAuthorText()
Clears any custom text displayed around the list of authors and falls back to the default message tel...
static TQString aboutTranslationTeam()
Returns a message about the translation team.
void setTranslator(const char *name, const char *emailAddress)
Sets the name of the translator of the gui.
void setLicenseText(const char *license)
Defines a license text.
TQString bugAddress() const
Returns the email address for bugs.
void setCustomAuthorText(const TQString &plainText, const TQString &richText)
Sets the custom text displayed around the list of authors instead of the default message telling user...
void setCopyrightStatement(const char *copyrightStatement)
Defines the copyright statement to show when displaying the license.
TQImage programLogo() const
Returns the program logo image.
void setVersion(const char *version)
Defines the program version string.
void setHomepage(const char *homepage)
Defines the program homepage.
const TQValueList< TDEAboutPerson > credits() const
Returns a list of persons who contributed.
LicenseKey
Descibes the license of the software.
TQString homepage() const
Returns the application homepage.
TQString customAuthorRichText() const
Returns the rich text displayed around the list of authors instead of the default message telling use...
TQString version() const
Returns the program's version.
const char * appName() const
Returns the application's internal name.
const TQValueList< TDEAboutTranslator > translators() const
Returns a list of translators.
TDEAboutData(const char *appName, const char *programName, const char *version, const char *shortDescription=0, int licenseType=License_Unknown, const char *copyrightStatement=0, const char *text=0, const char *homePageAddress=0, const char *bugsEmailAddress=0)
Constructor.
const char * productName() const
Returns the application's product name, which will be used in KBugReport dialog.
void setAppName(const char *appName)
Defines the program name used internally.
TQString programName() const
Returns the translated program name.
TQString otherText() const
Returns a translated, free form text.
void setBugAddress(const char *bugAddress)
Defines the address where bug reports should be sent.
bool customAuthorTextEnabled() const
Returns whether custom text should be displayed around the list of authors.
void setLicenseTextFile(const TQString &file)
Defines a license text.
This structure is used to store information about a person or developer.
TQString webAddress() const
The home page or a relevant link.
TQString name() const
The person's name.
TQString task() const
The person's task.
TQString emailAddress() const
The person's email address.
This structure is used to store information about a translator.
TQString emailAddress() const
The translator's email.
TDEAboutTranslator(const TQString &name=TQString::null, const TQString &emailAddress=TQString::null)
Convenience constructor.
TQString name() const
The translator's name.
static TDELocale * locale()
Returns the global locale object.