1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
|
/*
* This file is part of the KDE Libraries
* Copyright (C) 2000 Espen Sand (espen@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include <tqvaluelist.h>
#include <tqstring.h>
#include <tqimage.h>
#include <tdelocale.h>
#ifndef _TDEABOUTDATA_H_
#define _TDEABOUTDATA_H_
class TDEAboutDataPrivate;
/**
* This structure is used to store information about a person or developer.
* It can store the person's name, a task, an email address and a
* link to a home page. This class is intended for use in the
* TDEAboutData class, but it can be used elsewhere as well.
* Normally you should at least define the person's name.
*
* Example Usage within a main():
*
* \code
* TDEAboutData about("khello", I18N_NOOP("KHello"), "0.1",
* I18N_NOOP("A TDE version of Hello, world!"),
* TDEAboutData::License_LGPL,
* I18N_NOOP("Copyright (c) 2003 Developer"));
*
* about.addAuthor("Joe Developer", I18N_NOOP("developer"), "joe@host.com", 0);
* about.addCredit("Joe User", I18N_NOOP("A lot of bug reports"),
* "joe.user@host.org", 0);
* TDECmdLineArgs::init(argc, argv, &about);
* \endcode
*/
class TDECORE_EXPORT TDEAboutPerson
{
public:
/**
* Convenience constructor
*
* @param name The name of the person.
*
* @param task The task of this person. This string should be
* marked for translation, e.g.
* I18N_NOOP("Task description....")
*
* @param emailAddress The email address of the person.
*
* @param webAddress Home page of the person.
*/
TDEAboutPerson(const char *name = nullptr, const char *task = nullptr,
const char *emailAddress = nullptr, const char *webAddress = nullptr)
{
mName = name;
mTask = task;
mEmailAddress = emailAddress;
mWebAddress = webAddress;
}
/**
* The person's name
* @return the person's name (can be TQString::null, if it has been
* constructed with a null name)
*/
TQString name() const;
/**
* The person's task
* @return the person's task (can be TQString::null, if it has been
* constructed with a null task)
*/
TQString task() const;
/**
* The person's email address
* @return the person's email address (can be TQString::null, if it has been
* constructed with a null email)
*/
TQString emailAddress() const;
/**
* The home page or a relevant link
* @return the persons home page (can be TQString::null, if it has been
* constructed with a null home page)
*/
TQString webAddress() const;
protected:
TQCString mName;
TQCString mTask;
TQCString mEmailAddress;
TQCString mWebAddress;
};
/**
* This structure is used to store information about a translator.
* It can store the translator's name and an email address.
* This class is intended for use in the TDEAboutData class,
* but it can be used elsewhere as well.
* Normally you should at least define the translator's name.
*
* It's not possible to use TDEAboutPerson for this, because
* TDEAboutPerson stores internally only const char* pointers, but the
* translator information is generated dynamically from the translation
* of a dummy string.
*/
class TDECORE_EXPORT TDEAboutTranslator
{
public:
/**
* Convenience constructor
*
* @param name The name of the person.
*
* @param emailAddress The email address of the person.
*/
TDEAboutTranslator(const TQString & name=TQString::null,
const TQString & emailAddress=TQString::null);
/**
* The translator's name
* @return the translators's name (can be TQString::null, if it has been
* constructed with a null name)
*/
TQString name() const;
/**
* The translator's email
* @return the translator's email address (can be TQString::null, if it has been
* constructed with a null email)
*/
TQString emailAddress() const;
private:
TQString mName;
TQString mEmail;
};
/**
* This class is used to store information about a program. It can store
* such values as version number, program name, home page, email address
* for bug reporting, multiple authors and contributors
* (using TDEAboutPerson), license and copyright information.
*
* Currently, the values set here are shown by the "About" box
* (see TDEAboutDialog), used by the bug report dialog (see KBugReport),
* and by the help shown on command line (see TDECmdLineArgs).
*
* @short Holds information needed by the "About" box and other
* classes.
* @author Espen Sand (espen@kde.org), David Faure (faure@kde.org)
*/
class TDECORE_EXPORT TDEAboutData
{
public:
/**
* Descibes the license of the software.
*/
enum LicenseKey
{
License_Custom = -2,
License_File = -1,
License_Unknown = 0,
License_GPL = 1,
License_GPL_V2 = 1,
License_LGPL = 2,
License_LGPL_V2 = 2,
License_BSD = 3,
License_Artistic = 4,
License_QPL = 5,
License_QPL_V1_0 = 5,
License_GPL_V3 = 6,
License_LGPL_V3 = 7
};
public:
/**
* Constructor.
*
* @param appName The program name used internally. Example: "kedit"
*
* @param programName A displayable program name string. This string
* should be marked for translation. Example: I18N_NOOP("KEdit")
*
* @param version The program version string.
*
* @param shortDescription A short description of what the program does.
* This string should be marked for translation.
* Example: I18N_NOOP("A simple text editor.")
*
* @param licenseType The license identifier. Use setLicenseText if
* you use a license not predefined here.
*
* @param copyrightStatement A copyright statement, that can look like this:
* "(c) 1999-2000, Name". The string specified here is not modified
* in any manner. The author information from addAuthor is not
* used.
*
* @param text Some free form text, that can contain any kind of
* information. The text can contain newlines. This string
* should be marked for translation.
*
* @param homePageAddress The program homepage string.
* Start the address with "http://". "http://some.domain" is
* is correct, "some.domain" is not.
*
* @param bugsEmailAddress The bug report email address string.
* This defaults to the trinitydesktop.org bug system.
*
*/
TDEAboutData(const char *appName,
const char *programName,
const char *version,
const char *shortDescription = nullptr,
int licenseType = License_Unknown,
const char *copyrightStatement = nullptr,
const char *text = nullptr,
const char *homePageAddress = nullptr,
const char *bugsEmailAddress = nullptr
);
~TDEAboutData();
/**
* Defines an author. You can call this function as many times you
* need. Each entry is appended to a list. The person in the first entry
* is assumed to be the leader of the project.
*
* @param name The developer's name in UTF-8 encoding.
*
* @param task What the person is responsible for. This text can contain
* newlines. It should be marked for translation like this:
* I18N_NOOP("Task description..."). Can be 0.
*
* @param emailAddress An Email address where the person can be reached.
* Can be 0.
*
* @param webAddress The person's homepage or a relevant link.
* Start the address with "http://". "http://some.domain" is
* correct, "some.domain" is not. Can be 0.
*
*/
void addAuthor( const char *name,
const char *task=0,
const char *emailAddress=0,
const char *webAddress=0 );
/**
* Defines a person that deserves credit. You can call this function
* as many times you need. Each entry is appended to a list.
*
* @param name The person's name in UTF-8 encoding.
*
* @param task What the person has done to deserve the honor. The
* text can contain newlines. It should be marked for
* translation like this: I18N_NOOP("Task description...")
* Can be 0.
*
* @param emailAddress An Email address when the person can be reached.
* Can be 0.
*
* @param webAddress The person's homepage or a relevant link.
* Start the address with "http://". "http://some.domain" is
* is correct, "some.domain" is not. Can be 0.
*
*/
void addCredit( const char *name,
const char *task=0,
const char *emailAddress=0,
const char *webAddress=0 );
/**
* Sets the name of the translator of the gui. Since this depends
* on the language, just use a dummy text marked for translation.
*
* For example:
* \code
* setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS\\nYour names")
* ,I18N_NOOP("_: EMAIL OF TRANSLATORS\\nYour emails"));
* \endcode
*
* The translator can then translate this dummy text with his name
* or with a list of names separated with ",".
* If there is no translation or the application is used with the
* default language, this function call is ignored.
*
* Note: If you are using the default KDE automake environment,
* there is no need to use this function, because the two
* default strings above are added to the applications po file
* automatically.
*
* @param name the name of the translator
* @param emailAddress the email address of the translator
* @see TDEAboutTranslator
*/
void setTranslator(const char* name, const char* emailAddress);
/**
* Defines a license text.
*
* The text will be translated if it got marked for
* translations with the I18N_NOOP() macro.
*
* Example:
* \code
* setLicenseText( I18N_NOOP("This is my license"));
* \endcode
*
* NOTE: No copy of the text is made.
*
* @param license The license text in utf8 encoding.
*/
void setLicenseText( const char *license );
/**
* Defines a license text.
*
* @param file File containing the license text.
*/
void setLicenseTextFile( const TQString &file );
/**
* Defines the program name used internally.
*
* @param appName The application name. Example: "kate".
*/
void setAppName( const char *appName );
/**
* Defines the displayable program name string.
*
* @param programName The program name. This string should be
* marked for translation.
* Example: I18N_NOOP("Advanced Text Editor").
* @since 3.2
*/
void setProgramName( const char* programName );
/**
* Defines the program logo.
* Use this if you need to have application logo
* in AboutData other than application icon.
*
* @param image logo image.
* @see programLogo()
* @since 3.4
*/
void setProgramLogo(const TQImage& image);
/**
* Defines the program version string.
*
* @param version The program version.
*/
void setVersion( const char* version );
/**
* Defines a short description of what the program does.
*
* @param shortDescription The program description This string should be marked
* for translation. Example: I18N_NOOP("An advanced text editor
* with syntax highlithing support.").
*/
void setShortDescription( const char *shortDescription );
/**
* Defines the license identifier.
*
* @param licenseKey The license identifier.
*/
void setLicense( LicenseKey licenseKey);
/**
* Defines the copyright statement to show when displaying the license.
*
* @param copyrightStatement A copyright statement, that can look like
* this: "(c) 1999-2000, Name". The string specified here is not
* modified in any manner. The author information from addAuthor
* is not used.
*/
void setCopyrightStatement( const char *copyrightStatement );
/**
* Defines the additional text to show in the about dialog.
*
* @param otherText Some free form text, that can contain any kind of
* information. The text can contain newlines. This string
* should be marked for translation.
*/
void setOtherText( const char *otherText );
/**
* Defines the program homepage.
*
* @param homepage The program homepage string.
* Start the address with "http://". "http://kate-editor.org/" is
* is correct, "kate-editor.org" is not.
*/
void setHomepage( const char *homepage );
/**
* Defines the address where bug reports should be sent.
*
* @param bugAddress The bug report email address string.
* This defaults to the kde.org bug system.
*/
void setBugAddress( const char *bugAddress );
/**
* Defines the product name wich will be used in the KBugReport dialog.
* By default it's the appName, but you can overwrite it here to provide
* support for special components e.g. 'product/component' like
* 'kontact/summary'.
*
* @param name The name of product
*/
void setProductName( const char *name );
/**
* Returns the application's internal name.
* @return the internal program name.
*/
const char *appName() const;
/**
* Returns the application's product name, which will be used in KBugReport
* dialog. By default it returns appName(), otherwise the one which is set
* with setProductName()
*
* @return the product name.
*/
const char *productName() const;
/**
* Returns the translated program name.
* @return the program name (translated).
*/
TQString programName() const;
/**
* @internal
*/
const char* internalProgramName() const;
/**
* @internal
*/
void translateInternalProgramName() const;
/**
* Returns the program logo image.
* @return the program logo data or null image if there is
* no custom application logo defined.
* @since 3.4
*/
TQImage programLogo() const;
/**
* Returns the program's version.
* @return the version string.
*/
TQString version() const;
/**
* @internal
*/
const char* internalVersion() const { return mVersion; }
/**
* Returns a short, translated description.
* @return the short description (translated). Can be
* TQString::null if not set.
*/
TQString shortDescription() const;
/**
* Returns the application homepage.
* @return the application homepage URL. Can be TQString::null if
* not set.
*/
TQString homepage() const;
/**
* Returns the email address for bugs.
* @return the email address where to report bugs.
*/
TQString bugAddress() const;
/**
* @internal
*/
const char* internalBugAddress() const { return mBugEmailAddress; }
/**
* Returns a list of authors.
* @return author information (list of persons).
*/
const TQValueList<TDEAboutPerson> authors() const;
/**
* Returns a list of persons who contributed.
* @return credit information (list of persons).
*/
const TQValueList<TDEAboutPerson> credits() const;
/**
* Returns a list of translators.
* @return translators information (list of persons)
*/
const TQValueList<TDEAboutTranslator> translators() const;
/**
* Returns a message about the translation team.
* @return a message about the translation team
*/
static TQString aboutTranslationTeam();
/**
* Returns a translated, free form text.
* @return the free form text (translated). Can be TQString::null if not set.
*/
TQString otherText() const;
/**
* Returns the license. If the licenseType argument of the constructor has been
* used, any text defined by setLicenseText is ignored,
* and the standard text for the chosen license will be returned.
*
* @return The license text.
*/
TQString license() const;
/**
* Returns the copyright statement.
* @return the copyright statement. Can be TQString::null if not set.
*/
TQString copyrightStatement() const;
/**
* Returns the plain text displayed around the list of authors instead
* of the default message telling users to send bug reports to bugAddress().
*
* @return the plain text displayed around the list of authors instead
* of the default message. Can be TQString::null.
*/
TQString customAuthorPlainText() const;
/**
* Returns the rich text displayed around the list of authors instead
* of the default message telling users to send bug reports to bugAddress().
*
* @return the rich text displayed around the list of authors instead
* of the default message. Can be TQString::null.
*/
TQString customAuthorRichText() const;
/**
* Returns whether custom text should be displayed around the list of
* authors.
*
* @return whether custom text should be displayed around the list of
* authors.
*/
bool customAuthorTextEnabled() const;
/**
* Sets the custom text displayed around the list of authors instead
* of the default message telling users to send bug reports to bugAddress().
*
* @param plainText The plain text.
* @param richText The rich text.
*
* Both parameters can be TQString::null to not display any message at
* all. Call unsetCustomAuthorText() to revert to the default mesage.
*/
void setCustomAuthorText(const TQString &plainText, const TQString &richText);
/**
* Clears any custom text displayed around the list of authors and falls
* back to the default message telling users to send bug reports to
* bugAddress().
*/
void unsetCustomAuthorText();
private:
TQCString mAppName;
TQCString mProgramName;
TQCString mVersion;
TQCString mShortDescription;
int mLicenseKey;
TQCString mCopyrightStatement;
TQCString mOtherText;
TQCString mHomepageAddress;
TQCString mBugEmailAddress;
TQValueList<TDEAboutPerson> mAuthorList;
TQValueList<TDEAboutPerson> mCreditList;
TQCString mLicenseText;
static TQCString defaultBugTracker;
TDEAboutDataPrivate *d;
};
#endif
|