• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/gettext-0.17/gettext-tools/examples/hello-c++-kde/
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.
4
5#if HAVE_CONFIG_H
6# include <config.h>
7#endif
8
9/* Specification.  */
10#include "hellowindow.h"
11
12/* Declare i18n.  */
13#include <klocale.h>
14/* Declare KMainWindow.  */
15#include <kmainwindow.h>
16/* Declare QLabel.  */
17#include <qlabel.h>
18/* Declare QPushButton.  */
19#include <qpushbutton.h>
20/* Declare QString.  */
21#include <qstring.h>
22/* Declare QVBox.  */
23#include <qvbox.h>
24/* Declare QHBox.  */
25#include <qhbox.h>
26
27/* Get getpid() declaration.  */
28#if HAVE_UNISTD_H
29# include <unistd.h>
30#endif
31
32// The main window widget.
33
34HelloMainWindow::HelloMainWindow (QWidget * parent, const char * name)
35  : KMainWindow (parent, name)
36{
37  setCaption ("Hello example");
38
39  QVBox *panel = new QVBox (this);
40  panel->setSpacing (2);
41
42  QLabel *label1 = new QLabel (i18n ("Hello, world!"), panel);
43
44  QString label2text;
45  // NOT using QString::sprintf because it doesn't support reordering of
46  // arguments.
47  //label2text.sprintf (i18n ("This program is running as process number %d"),
48  //                    getpid ());
49  label2text = i18n ("This program is running as process number %1.").arg(getpid ());
50  QLabel *label2 = new QLabel (label2text, panel);
51
52  QHBox *buttonbar = new QHBox (panel);
53  QWidget *filler = new QWidget (buttonbar); // makes the button right-aligned
54  button = new QPushButton ("OK", buttonbar);
55  button->setMaximumWidth (button->sizeHint().width() + 20);
56
57  panel->resize (panel->sizeHint ());
58  resize (panel->frameSize ());
59}
60
61HelloMainWindow::~HelloMainWindow ()
62{
63}
64