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");
450 if (mLicenseText && *mLicenseText)
451 return( i18n(mLicenseText) );
454 result += i18n(
"No licensing terms for this program have been specified.\n"
455 "Please check the documentation or the source for any\n"
456 "licensing terms.\n");
461 result += i18n(
"This program is distributed under the terms of the %1.").arg( l );
466 if (file.open(IO_ReadOnly))
470 TQTextStream str(&file);
471 result += str.read();
481 if (mCopyrightStatement && *mCopyrightStatement)
482 return i18n(mCopyrightStatement);
484 return TQString::null;
490 return d->customAuthorPlainText;
496 return d->customAuthorRichText;
502 return d->customAuthorTextEnabled;
508 d->customAuthorPlainText = plainText;
509 d->customAuthorRichText = richText;
511 d->customAuthorTextEnabled =
true;
517 d->customAuthorPlainText = TQString::null;
518 d->customAuthorRichText = TQString::null;
520 d->customAuthorTextEnabled =
false;
TQString bugAddress() const
Returns the email address for bugs.
void setBugAddress(const char *bugAddress)
Defines the address where bug reports should be sent.
TQString webAddress() const
The home page or a relevant link.
static TQString aboutTranslationTeam()
Returns a message about the translation team.
TQString homepage() const
Returns the application homepage.
void unsetCustomAuthorText()
Clears any custom text displayed around the list of authors and falls back to the default message tel...
const char * appName() const
Returns the application's internal name.
void setHomepage(const char *homepage)
Defines the program homepage.
This structure is used to store information about a person or developer.
void addAuthor(const char *name, const char *task=0, const char *emailAddress=0, const char *webAddress=0)
Defines an author.
TQString programName() const
Returns the translated program name.
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.
TDEAboutTranslator(const TQString &name=TQString::null, const TQString &emailAddress=TQString::null)
Convenience constructor.
const TQValueList< TDEAboutPerson > credits() const
Returns a list of persons who contributed.
LicenseKey
Descibes the license of the software.
TQString task() const
The person's task.
TQString shortDescription() const
Returns a short, translated description.
void addCredit(const char *name, const char *task=0, const char *emailAddress=0, const char *webAddress=0)
Defines a person that deserves credit.
TQImage programLogo() const
Returns the program logo image.
TQString emailAddress() const
The translator's email.
const TQValueList< TDEAboutTranslator > translators() const
Returns a list of translators.
void setAppName(const char *appName)
Defines the program name used internally.
void setOtherText(const char *otherText)
Defines the additional text to show in the about dialog.
const TQValueList< TDEAboutPerson > authors() const
Returns a list of authors.
void setProgramLogo(const TQImage &image)
Defines the program logo.
This structure is used to store information about a translator.
TQString version() const
Returns the program's version.
TQString license() const
Returns the license.
void setProductName(const char *name)
Defines the product name wich will be used in the KBugReport dialog.
void setLicenseText(const char *license)
Defines a license text.
void setShortDescription(const char *shortDescription)
Defines a short description of what the program does.
const char * productName() const
Returns the application's product name, which will be used in KBugReport dialog.
TQString copyrightStatement() const
Returns the copyright statement.
TQString customAuthorRichText() const
Returns the rich text displayed around the list of authors instead of the default message telling use...
TQString name() const
The translator's name.
TQString emailAddress() const
The person's email address.
TQString customAuthorPlainText() const
Returns the plain text displayed around the list of authors instead of the default message telling us...
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 setProgramName(const char *programName)
Defines the displayable program name string.
static TDELocale * locale()
Returns the global locale object.
void setVersion(const char *version)
Defines the program version string.
void setCopyrightStatement(const char *copyrightStatement)
Defines the copyright statement to show when displaying the license.
bool customAuthorTextEnabled() const
Returns whether custom text should be displayed around the list of authors.
TQString otherText() const
Returns a translated, free form text.
void setLicenseTextFile(const TQString &file)
Defines a license text.
void setTranslator(const char *name, const char *emailAddress)
Sets the name of the translator of the gui.
void setLicense(LicenseKey licenseKey)
Defines the license identifier.
TQString name() const
The person's name.