1 // Example for use of GNU gettext.
2 // Copyright (C) 2003 Free Software Foundation, Inc.
3 // This file is published under the GNU General Public License.
5 // Source code of the C++ program.
12 /* Declare KCmdLineArgs, KCmdLineOptions. */
13 #include <kcmdlineargs.h>
14 /* Declare KApplication. */
15 #include <kapplication.h>
16 /* Declare KAboutData. */
17 #include <kaboutdata.h>
18 /* Declare main window widget. */
19 #include "hellowindow.h"
21 // Comment line options.
23 static KCmdLineOptions options
[] =
25 { 0, 0, 0 } // End of options.
29 main (int argc
, char *argv
[])
34 // Add our installation directory to KDE's search list for message
35 // catalogs. By default it looks only in $KDEHOME/share/locale and
36 // $KDEDIR/share/locale.
37 QString kdedirs
= getenv ("KDEDIRS");
38 if (kdedirs
.isEmpty ())
41 kdedirs
= kdedirs
+ ":" + PREFIX
;
42 setenv ("KDEDIRS", (const char *) kdedirs
.local8Bit(), true);
45 KAboutData
aboutData ("hello-c++-kde",
46 I18N_NOOP ("Hello example"),
48 I18N_NOOP ("Hello world example"),
49 KAboutData::License_GPL
,
50 "(C) 2003 Free Software Foundation",
53 "bug-gnu-gettext@gnu.org");
54 KCmdLineArgs::init (argc
, argv
, &aboutData
);
55 KCmdLineArgs::addCmdLineOptions (options
);
56 KApplication application
;
58 // Create the GUI elements.
60 HelloMainWindow
*window
= new HelloMainWindow ();
61 QObject::connect (window
->button
, SIGNAL (clicked ()),
62 &application
, SLOT (quit ()));
64 application
.setMainWidget (window
);
66 // Make the GUI elements visible.
70 // Start the event loop.
72 return application
.exec ();