From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/i18n-example.html | 202 ++++++++++++++++++++++----------------------- 1 file changed, 101 insertions(+), 101 deletions(-) (limited to 'doc/html/i18n-example.html') diff --git a/doc/html/i18n-example.html b/doc/html/i18n-example.html index b4f469e8f..1cd12b0d7 100644 --- a/doc/html/i18n-example.html +++ b/doc/html/i18n-example.html @@ -52,15 +52,15 @@ This example shows how to internationalize applications. Start it with #ifndef MYWIDGET_H #define MYWIDGET_H -#include <qmainwindow.h> -#include <qstring.h> +#include <ntqmainwindow.h> +#include <ntqstring.h> -class MyWidget : public TQMainWindow +class MyWidget : public TQMainWindow { Q_OBJECT public: - MyWidget( TQWidget* parent=0, const char* name = 0 ); + MyWidget( TQWidget* parent=0, const char* name = 0 ); signals: void closed(); @@ -87,47 +87,47 @@ private: ** *****************************************************************************/ -#include <qbuttongroup.h> -#include <qradiobutton.h> -#include <qlabel.h> -#include <qlistbox.h> -#include <qcombobox.h> -#include <qlabel.h> -#include <qhbox.h> -#include <qvbox.h> -#include <qaccel.h> -#include <qpopupmenu.h> -#include <qmenubar.h> -#include <qstatusbar.h> -#include <qapplication.h> +#include <ntqbuttongroup.h> +#include <ntqradiobutton.h> +#include <ntqlabel.h> +#include <ntqlistbox.h> +#include <ntqcombobox.h> +#include <ntqlabel.h> +#include <ntqhbox.h> +#include <ntqvbox.h> +#include <ntqaccel.h> +#include <ntqpopupmenu.h> +#include <ntqmenubar.h> +#include <ntqstatusbar.h> +#include <ntqapplication.h> #include "mywidget.h" -MyWidget::MyWidget( TQWidget* parent, const char* name ) - : TQMainWindow( parent, name ) +MyWidget::MyWidget( TQWidget* parent, const char* name ) + : TQMainWindow( parent, name ) { - TQVBox* central = new TQVBox(this); - central->setMargin( 5 ); - central->setSpacing( 5 ); - setCentralWidget(central); + TQVBox* central = new TQVBox(this); + central->setMargin( 5 ); + central->setSpacing( 5 ); + setCentralWidget(central); - TQPopupMenu* file = new TQPopupMenu(this); - file->insertItem( tr("E&xit"), qApp, SLOT(quit()), - TQAccel::stringToKey(tr("Ctrl+Q")) ); - menuBar()->insertItem( tr("&File"), file ); + TQPopupMenu* file = new TQPopupMenu(this); + file->insertItem( tr("E&xit"), qApp, SLOT(quit()), + TQAccel::stringToKey(tr("Ctrl+Q")) ); + menuBar()->insertItem( tr("&File"), file ); - setCaption( tr( "Internationalization Example" ) ); + setCaption( tr( "Internationalization Example" ) ); - TQString l; - statusBar()->message( tr("Language: English") ); + TQString l; + statusBar()->message( tr("Language: English") ); - ( void )new TQLabel( tr( "The Main Window" ), central ); + ( void )new TQLabel( tr( "The Main Window" ), central ); - TQButtonGroup* gbox = new TQButtonGroup( 1, TQGroupBox::Horizontal, - tr( "View" ), central ); - (void)new TQRadioButton( tr( "Perspective" ), gbox ); - (void)new TQRadioButton( tr( "Isometric" ), gbox ); - (void)new TQRadioButton( tr( "Oblique" ), gbox ); + TQButtonGroup* gbox = new TQButtonGroup( 1, TQGroupBox::Horizontal, + tr( "View" ), central ); + (void)new TQRadioButton( tr( "Perspective" ), gbox ); + (void)new TQRadioButton( tr( "Isometric" ), gbox ); + (void)new TQRadioButton( tr( "Oblique" ), gbox ); initChoices(central); } @@ -141,14 +141,14 @@ static const char* choices[] = { void MyWidget::initChoices(TQWidget* parent) { - TQListBox* lb = new TQListBox( parent ); + TQListBox* lb = new TQListBox( parent ); for ( int i = 0; choices[i]; i++ ) - lb->insertItem( tr( choices[i] ) ); + lb->insertItem( tr( choices[i] ) ); } -void MyWidget::closeEvent(TQCloseEvent* e) +void MyWidget::closeEvent(TQCloseEvent* e) { - TQWidget::closeEvent(e); + TQWidget::closeEvent(e); emit closed(); } @@ -165,17 +165,17 @@ void MyWidget::initChoices(TQWidget* parent) ** *****************************************************************************/ -#include <qapplication.h> -#include <qtranslator.h> -#include <qfileinfo.h> -#include <qmessagebox.h> -#include <qcheckbox.h> -#include <qvbox.h> -#include <qlayout.h> -#include <qbuttongroup.h> -#include <qpushbutton.h> -#include <qsignalmapper.h> -#include <qtextcodec.h> +#include <ntqapplication.h> +#include <ntqtranslator.h> +#include <ntqfileinfo.h> +#include <ntqmessagebox.h> +#include <ntqcheckbox.h> +#include <ntqvbox.h> +#include <ntqlayout.h> +#include <ntqbuttongroup.h> +#include <ntqpushbutton.h> +#include <ntqsignalmapper.h> +#include <ntqtextcodec.h> #include <stdlib.h> #if defined(Q_OS_UNIX) @@ -186,42 +186,42 @@ void MyWidget::initChoices(TQWidget* parent) //#define USE_I18N_FONT -class TQVDialog : public TQDialog { +class TQVDialog : public TQDialog { public: TQVDialog(TQWidget *parent=0, const char *name=0, bool modal=FALSE, - WFlags f=0) : TQDialog(parent,name,modal,f) + WFlags f=0) : TQDialog(parent,name,modal,f) { TQVBoxLayout* vb = new TQVBoxLayout(this,8); - vb->setAutoAdd(TRUE); + vb->setAutoAdd(TRUE); hb = 0; - sm = new TQSignalMapper(this); - connect(sm,SIGNAL(mapped(int)),this,SLOT(done(int))); + sm = new TQSignalMapper(this); + connect(sm,SIGNAL(mapped(int)),this,SLOT(done(int))); } - void addButtons( const TQString& cancel=TQString::null, - const TQString& ok=TQString::null, - const TQString& mid1=TQString::null, - const TQString& mid2=TQString::null, - const TQString& mid3=TQString::null) + void addButtons( const TQString& cancel=TQString::null, + const TQString& ok=TQString::null, + const TQString& mid1=TQString::null, + const TQString& mid2=TQString::null, + const TQString& mid3=TQString::null) { - addButton(ok.isNull() ? TQObject::tr("OK") : ok, 1); - if ( !mid1.isNull() ) addButton(mid1,2); - if ( !mid2.isNull() ) addButton(mid2,3); - if ( !mid3.isNull() ) addButton(mid3,4); - addButton(cancel.isNull() ? TQObject::tr("Cancel") : cancel, 0); + addButton(ok.isNull() ? TQObject::tr("OK") : ok, 1); + if ( !mid1.isNull() ) addButton(mid1,2); + if ( !mid2.isNull() ) addButton(mid2,3); + if ( !mid3.isNull() ) addButton(mid3,4); + addButton(cancel.isNull() ? TQObject::tr("Cancel") : cancel, 0); } - void addButton( const TQString& text, int result ) + void addButton( const TQString& text, int result ) { if ( !hb ) - hb = new TQHBox(this); - TQPushButton *c = new TQPushButton(text, hb); - sm->setMapping(c,result); - connect(c,SIGNAL(clicked()),sm,SLOT(map())); + hb = new TQHBox(this); + TQPushButton *c = new TQPushButton(text, hb); + sm->setMapping(c,result); + connect(c,SIGNAL(clicked()),sm,SLOT(map())); } private: - TQSignalMapper *sm; - TQHBox *hb; + TQSignalMapper *sm; + TQHBox *hb; }; MyWidget* showLang(TQString lang) @@ -229,32 +229,32 @@ MyWidget* showLang(TQString lang) static TQTranslator *translator = 0; - qApp->setPalette(TQPalette(TQColor(220-rand()%64,220-rand()%64,220-rand()%64))); + qApp->setPalette(TQPalette(TQColor(220-rand()%64,220-rand()%64,220-rand()%64))); lang = "mywidget_" + lang + ".qm"; - TQFileInfo fi( lang ); + TQFileInfo fi( lang ); - if ( !fi.exists() ) { - TQMessageBox::warning( 0, "File error", + if ( !fi.exists() ) { + TQMessageBox::warning( 0, "File error", TQString("Cannot find translation for language: "+lang+ "\n(try eg. 'de', 'ko' or 'no')") ); return 0; } if ( translator ) { - qApp->removeTranslator( translator ); + qApp->removeTranslator( translator ); delete translator; } - translator = new TQTranslator( 0 ); - translator->load( lang, "." ); - qApp->installTranslator( translator ); + translator = new TQTranslator( 0 ); + translator->load( lang, "." ); + qApp->installTranslator( translator ); MyWidget *m = new MyWidget; - m->setCaption("TQt Example - i18n - " + m->caption() ); + m->setCaption("TQt Example - i18n - " + m->caption() ); return m; } int main( int argc, char** argv ) { - TQApplication app( argc, argv ); + TQApplication app( argc, argv ); const char* qm[]= { "ar", "cs", "de", "el", "en", "eo", "fr", "it", "jp", "ko", "no", "ru", "zh", 0 }; @@ -263,7 +263,7 @@ int main( int argc, char** argv ) srand( getpid() << 2 ); #endif - TQString lang; + TQString lang; if ( argc == 2 ) lang = argv[1]; @@ -274,28 +274,28 @@ int main( int argc, char** argv ) if ( lang == "all" ) { r = 2; } else { - TQButtonGroup *bg = new TQButtonGroup(4,TQt::Vertical,"Choose Locales",&dlg); - TQString loc = TQTextCodec::locale(); + TQButtonGroup *bg = new TQButtonGroup(4,TQt::Vertical,"Choose Locales",&dlg); + TQString loc = TQTextCodec::locale(); for ( int i=0; qm[i]; i++ ) { - qmb[i] = new TQCheckBox((const char*)qm[i],bg); + qmb[i] = new TQCheckBox((const char*)qm[i],bg); qmb[i]->setChecked( loc == qm[i] ); } dlg.addButtons("Cancel","OK","All"); - r = dlg.exec(); + r = dlg.exec(); } if ( r ) { - TQRect screen = qApp->desktop()->availableGeometry(); - bool tight = screen.width() < 1024; - int x=screen.left()+5; - int y=screen.top()+25; + TQRect screen = qApp->desktop()->availableGeometry(); + bool tight = screen.width() < 1024; + int x=screen.left()+5; + int y=screen.top()+25; for ( int i=0; qm[i]; i++ ) { if ( r == 2 || qmb[i]->isChecked() ) { MyWidget* w = showLang((const char*)qm[i]); if( w == 0 ) exit( 0 ); - TQObject::connect(w, SIGNAL(closed()), qApp, SLOT(quit())); - w->setGeometry(x,y,197,356); - w->show(); + TQObject::connect(w, SIGNAL(closed()), qApp, SLOT(quit())); + w->setGeometry(x,y,197,356); + w->show(); if ( tight ) { x += 8; y += 8; @@ -312,11 +312,11 @@ int main( int argc, char** argv ) exit( 0 ); } } else { - TQString lang = argv[1]; - TQWidget* m = showLang(lang); - app.setMainWidget( m ); - m->setCaption("TQt Example - i18n"); - m->show(); + TQString lang = argv[1]; + TQWidget* m = showLang(lang); + app.setMainWidget( m ); + m->setCaption("TQt Example - i18n"); + m->show(); } #ifdef USE_I18N_FONT @@ -324,7 +324,7 @@ int main( int argc, char** argv ) #endif // While we run "all", kill them all - return app.exec(); + return app.exec(); } -- cgit v1.2.3