Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / share / doc / gettext / examples / hello-c++-kde / hello.cc
blob5e091287d4f382828097f09e0dc41a2fe049272a
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.
7 #if HAVE_CONFIG_H
8 # include <config.h>
9 #endif
11 #include <stdlib.h>
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.
28 int
29 main (int argc, char *argv[])
31 // Initializations.
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 ())
39 kdedirs = PREFIX;
40 else
41 kdedirs = kdedirs + ":" + PREFIX;
42 setenv ("KDEDIRS", (const char *) kdedirs.local8Bit(), true);
45 KAboutData aboutData ("hello-c++-kde",
46 I18N_NOOP ("Hello example"),
47 VERSION,
48 I18N_NOOP ("Hello world example"),
49 KAboutData::License_GPL,
50 "(C) 2003 Free Software Foundation",
51 NULL,
52 NULL,
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.
68 window->show ();
70 // Start the event loop.
72 return application.exec ();