// Example for use of GNU gettext. // Copyright (C) 2003 Free Software Foundation, Inc. // This file is published under the GNU General Public License. #if HAVE_CONFIG_H # include #endif /* Specification. */ #include "hellowindow.h" /* Declare i18n. */ #include /* Declare KMainWindow. */ #include /* Declare QLabel. */ #include /* Declare QPushButton. */ #include /* Declare QString. */ #include /* Declare QVBox. */ #include /* Declare QHBox. */ #include /* Get getpid() declaration. */ #if HAVE_UNISTD_H # include #endif // The main window widget. HelloMainWindow::HelloMainWindow (QWidget * parent, const char * name) : KMainWindow (parent, name) { setCaption ("Hello example"); QVBox *panel = new QVBox (this); panel->setSpacing (2); QLabel *label1 = new QLabel (i18n ("Hello, world!"), panel); QString label2text; // NOT using QString::sprintf because it doesn't support reordering of // arguments. //label2text.sprintf (i18n ("This program is running as process number %d"), // getpid ()); label2text = i18n ("This program is running as process number %1.").arg(getpid ()); QLabel *label2 = new QLabel (label2text, panel); QHBox *buttonbar = new QHBox (panel); QWidget *filler = new QWidget (buttonbar); // makes the button right-aligned button = new QPushButton ("OK", buttonbar); button->setMaximumWidth (button->sizeHint().width() + 20); panel->resize (panel->sizeHint ()); resize (panel->frameSize ()); } HelloMainWindow::~HelloMainWindow () { }