diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:17:53 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:17:53 -0500 |
commit | dda8474928bd7276e1fad8fb7a601e7c83ff2bc2 (patch) | |
tree | 7f83910598b33b12730035f086df20b5a53ab99c /tqtinterface/qt4/tools/linguist/tutorial | |
parent | 6260b6178868c03aab1644bf93b0ef043654bdb0 (diff) | |
download | experimental-dda8474928bd7276e1fad8fb7a601e7c83ff2bc2.tar.gz experimental-dda8474928bd7276e1fad8fb7a601e7c83ff2bc2.zip |
Added TQt4 HEAD
Diffstat (limited to 'tqtinterface/qt4/tools/linguist/tutorial')
15 files changed, 388 insertions, 0 deletions
diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt1/main.cpp b/tqtinterface/qt4/tools/linguist/tutorial/tt1/main.cpp new file mode 100644 index 0000000..27373be --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt1/main.cpp @@ -0,0 +1,25 @@ +/**************************************************************** +** +** Translation tutorial 1 +** +****************************************************************/ + +#include <tqapplication.h> +#include <tqpushbutton.h> +#include <tqtranslator.h> + + +int main( int argc, char **argv ) +{ + TQApplication app( argc, argv ); + + TQTranslator translator( 0 ); + translator.load( "tt1_la", "." ); + app.installTranslator( &translator ); + + TQPushButton hello( TQPushButton::tr("Hello world!"), 0 ); + + app.setMainWidget( &hello ); + hello.show(); + return app.exec(); +} diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt1/tt1.pro b/tqtinterface/qt4/tools/linguist/tutorial/tt1/tt1.pro new file mode 100644 index 0000000..3b5249c --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt1/tt1.pro @@ -0,0 +1,4 @@ +TEMPLATE = app +CONFIG += qt warn_on +SOURCES = main.cpp +TRANSLATIONS = tt1_la.ts diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt2/arrowpad.cpp b/tqtinterface/qt4/tools/linguist/tutorial/tt2/arrowpad.cpp new file mode 100644 index 0000000..722320d --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt2/arrowpad.cpp @@ -0,0 +1,31 @@ +/**************************************************************** +** +** Implementation of ArrowPad class, translation tutorial 2 +** +****************************************************************/ + +#include "arrowpad.h" + +#include <tqpushbutton.h> + +ArrowPad::ArrowPad( TQWidget *tqparent, const char *name ) + : TQGrid( 3, Qt::Horizontal, tqparent, name ) +{ + setMargin( 10 ); + setSpacing( 10 ); + + skip(); + (void) new TQPushButton( tqtr("&Up"), this ); + skip(); + (void) new TQPushButton( tqtr("&Left"), this ); + skip(); + (void) new TQPushButton( tqtr("&Right"), this ); + skip(); + (void) new TQPushButton( tqtr("&Down"), this ); + skip(); +} + +void ArrowPad::skip() +{ + (void) new TQWidget( this ); +} diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt2/arrowpad.h b/tqtinterface/qt4/tools/linguist/tutorial/tt2/arrowpad.h new file mode 100644 index 0000000..b273791 --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt2/arrowpad.h @@ -0,0 +1,22 @@ +/**************************************************************** +** +** Definition of ArrowPad class, translation tutorial 2 +** +****************************************************************/ + +#ifndef ARROWPAD_H +#define ARROWPAD_H + +#include <tqgrid.h> + +class ArrowPad : public TQGrid +{ + TQ_OBJECT +public: + ArrowPad( TQWidget *tqparent = 0, const char *name = 0 ); + +private: + void skip(); +}; + +#endif diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt2/main.cpp b/tqtinterface/qt4/tools/linguist/tutorial/tt2/main.cpp new file mode 100644 index 0000000..f4cbea9 --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt2/main.cpp @@ -0,0 +1,26 @@ +/**************************************************************** +** +** Translation tutorial 2 +** +****************************************************************/ + +#include "mainwindow.h" + +#include <tqapplication.h> +#include <tqstring.h> +#include <tqtextcodec.h> +#include <tqtranslator.h> + +int main( int argc, char **argv ) +{ + TQApplication app( argc, argv ); + + TQTranslator translator( 0 ); + translator.load( TQString("tt2_") + TQTextCodec::locale(), "." ); + app.installTranslator( &translator ); + + MainWindow *mw = new MainWindow; + app.setMainWidget( mw ); + mw->show(); + return app.exec(); +} diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt2/mainwindow.cpp b/tqtinterface/qt4/tools/linguist/tutorial/tt2/mainwindow.cpp new file mode 100644 index 0000000..e91a4ce --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt2/mainwindow.cpp @@ -0,0 +1,26 @@ +/**************************************************************** +** +** Implementation of MainWindow class, translation tutorial 2 +** +****************************************************************/ + +#include "arrowpad.h" +#include "mainwindow.h" + +#include <tqaccel.h> +#include <tqapplication.h> +#include <tqmenubar.h> +#include <tqpopupmenu.h> + +MainWindow::MainWindow( TQWidget *tqparent, const char *name ) + : TQMainWindow( tqparent, name ) +{ + ArrowPad *ap = new ArrowPad( this, "arrow pad" ); + setCentralWidget( ap ); + + TQPopupMenu *file = new TQPopupMenu( this ); + file->insertItem( tqtr("E&xit"), tqApp, TQT_SLOT(quit()), + tqtr("Ctrl+Q", "Quit") ); + menuBar()->insertItem( tqtr("&File"), file ); + menuBar()->setSeparator( TQMenuBar::InWindowsStyle ); +} diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt2/mainwindow.h b/tqtinterface/qt4/tools/linguist/tutorial/tt2/mainwindow.h new file mode 100644 index 0000000..46bdf50 --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt2/mainwindow.h @@ -0,0 +1,19 @@ +/**************************************************************** +** +** Definition of MainWindow class, translation tutorial 2 +** +****************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <tqmainwindow.h> + +class MainWindow : public TQMainWindow +{ + TQ_OBJECT +public: + MainWindow( TQWidget *tqparent = 0, const char *name = 0 ); +}; + +#endif diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt2/tt2.pro b/tqtinterface/qt4/tools/linguist/tutorial/tt2/tt2.pro new file mode 100644 index 0000000..8c1ea6d --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt2/tt2.pro @@ -0,0 +1,9 @@ +TEMPLATE = app +CONFIG += qt warn_on +HEADERS = arrowpad.h \ + mainwindow.h +SOURCES = arrowpad.cpp \ + main.cpp \ + mainwindow.cpp +TRANSLATIONS = tt2_fr.ts \ + tt2_nl.ts diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt3/main.cpp b/tqtinterface/qt4/tools/linguist/tutorial/tt3/main.cpp new file mode 100644 index 0000000..141b8c8 --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt3/main.cpp @@ -0,0 +1,26 @@ +/**************************************************************** +** +** Translation tutorial 3 +** +****************************************************************/ + +#include "mainwindow.h" + +#include <tqapplication.h> +#include <tqstring.h> +#include <tqtextcodec.h> +#include <tqtranslator.h> + +int main( int argc, char **argv ) +{ + TQApplication app( argc, argv ); + + TQTranslator translator( 0 ); + translator.load( TQString("tt3_") + TQTextCodec::locale(), "." ); + app.installTranslator( &translator ); + + MainWindow *mw = new MainWindow; + app.setMainWidget( mw ); + mw->show(); + return app.exec(); +} diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt3/mainwindow.cpp b/tqtinterface/qt4/tools/linguist/tutorial/tt3/mainwindow.cpp new file mode 100644 index 0000000..c533344 --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt3/mainwindow.cpp @@ -0,0 +1,47 @@ +/**************************************************************** +** +** Implementation of MainWindow class, translation tutorial 3 +** +****************************************************************/ + +#include "mainwindow.h" +#include "printpanel.h" + +#include <tqaccel.h> +#include <tqapplication.h> +#include <tqmenubar.h> +#include <tqmessagebox.h> +#include <tqpopupmenu.h> + +MainWindow::MainWindow( TQWidget *tqparent, const char *name ) + : TQMainWindow( tqparent, name ) +{ + setCaption( tqtr("Troll Print 1.0") ); + + PrintPanel *pp = new PrintPanel( this ); + setCentralWidget( pp ); + + TQPopupMenu *file = new TQPopupMenu( this ); + file->insertItem( tqtr("E&xit"), tqApp, TQT_SLOT(quit()), + tqtr("Ctrl+Q", "Quit") ); + TQPopupMenu *help = new TQPopupMenu( this ); + help->insertItem( tqtr("&About"), this, TQT_SLOT(about()), Qt::Key_F1 ); + help->insertItem( tqtr("About &TQt"), this, TQT_SLOT(aboutTQt()) ); + + menuBar()->insertItem( tqtr("&File"), file ); + menuBar()->insertSeparator(); + menuBar()->insertItem( tqtr("&Help"), help ); + menuBar()->setSeparator( TQMenuBar::InWindowsStyle ); +} + +void MainWindow::about() +{ + TQMessageBox::information( this, tqtr("About Troll Print 1.0"), + tqtr("Troll Print 1.0.\n\n" + "Copyright 1999 Macroshaft, Inc.") ); +} + +void MainWindow::aboutTQt() +{ + TQMessageBox::aboutTQt( this ); +} diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt3/mainwindow.h b/tqtinterface/qt4/tools/linguist/tutorial/tt3/mainwindow.h new file mode 100644 index 0000000..723072c --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt3/mainwindow.h @@ -0,0 +1,24 @@ +/**************************************************************** +** +** Definition of MainWindow class, translation tutorial 3 +** +****************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <tqmainwindow.h> + +class MainWindow : public TQMainWindow +{ + Q_OBJECT + TQ_OBJECT +public: + MainWindow( TQWidget *tqparent = 0, const char *name = 0 ); + +private Q_SLOTS: + void about(); + void aboutTQt(); +}; + +#endif diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt3/printpanel.cpp b/tqtinterface/qt4/tools/linguist/tutorial/tt3/printpanel.cpp new file mode 100644 index 0000000..85c507b --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt3/printpanel.cpp @@ -0,0 +1,37 @@ +/**************************************************************** +** +** Implementation of PrintPanel class, translation tutorial 3 +** +****************************************************************/ + +#include "printpanel.h" + +#include <tqlabel.h> +#include <tqradiobutton.h> +#include <tqhbuttongroup.h> + +PrintPanel::PrintPanel( TQWidget *tqparent, const char *name ) + : TQVBox( tqparent, name ) +{ + setMargin( 10 ); + setSpacing( 10 ); + +/* + TQLabel *lab = new TQLabel( tr("<b>TROLL PRINT</b>"), this ); + lab->tqsetAlignment( AlignCenter ); +*/ + + TQRadioButton *but; + + TQHButtonGroup *twoSided = new TQHButtonGroup( this ); + twoSided->setTitle( tr("2-sided") ); + but = new TQRadioButton( tr("Enabled"), twoSided ); + but = new TQRadioButton( tr("Disabled"), twoSided ); + but->toggle(); + + TQHButtonGroup *colors = new TQHButtonGroup( this ); + colors->setTitle( tr("Colors") ); + but = new TQRadioButton( tr("Enabled"), colors ); + but = new TQRadioButton( tr("Disabled"), colors ); + but->toggle(); +} diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt3/printpanel.h b/tqtinterface/qt4/tools/linguist/tutorial/tt3/printpanel.h new file mode 100644 index 0000000..07bd83f --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt3/printpanel.h @@ -0,0 +1,19 @@ +/**************************************************************** +** +** Definition of PrintPanel class, translation tutorial 3 +** +****************************************************************/ + +#ifndef PRINTPANEL_H +#define PRINTPANEL_H + +#include <tqvbox.h> + +class PrintPanel : public TQVBox +{ + TQ_OBJECT +public: + PrintPanel( TQWidget *tqparent = 0, const char *name = 0 ); +}; + +#endif diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt3/tt3.pro b/tqtinterface/qt4/tools/linguist/tutorial/tt3/tt3.pro new file mode 100644 index 0000000..c219d1e --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt3/tt3.pro @@ -0,0 +1,8 @@ +TEMPLATE = app +CONFIG += qt warn_on +HEADERS = mainwindow.h \ + printpanel.h +SOURCES = main.cpp \ + mainwindow.cpp \ + printpanel.cpp +TRANSLATIONS = tt3_pt.ts diff --git a/tqtinterface/qt4/tools/linguist/tutorial/tt3/tt3_pt.ts b/tqtinterface/qt4/tools/linguist/tutorial/tt3/tt3_pt.ts new file mode 100644 index 0000000..cf8ff4f --- /dev/null +++ b/tqtinterface/qt4/tools/linguist/tutorial/tt3/tt3_pt.ts @@ -0,0 +1,65 @@ +<!DOCTYPE TS><TS> +<context> + <name>MainWindow</name> + <message> + <source>Troll Print 1.0</source> + <translation>Troll Imprimir 1.0</translation> + </message> + <message> + <source>E&xit</source> + <translation>&Sair</translation> + </message> + <message> + <source>&About</source> + <translation>&Sobre</translation> + </message> + <message> + <source>About &Qt</source> + <translation>Sobre &Qt</translation> + </message> + <message> + <source>&File</source> + <translation>&Arquivo</translation> + </message> + <message> + <source>&Help</source> + <translation>A&juda</translation> + </message> + <message> + <source>About Troll Print 1.0</source> + <translation>Sobre Troll Imprimir 1.0</translation> + </message> + <message> + <source>Troll Print 1.0. + +Copyright 1999 Macroshaft, Inc.</source> + <translation>Troll Imprimir 1.0 + +Copyright 1999 Macroshaft, Inc.</translation> + </message> + <message> + <source>Ctrl+Q</source> + <comment>Quit</comment> + <translation>Ctrl+Q</translation> + </message> +</context> +<context> + <name>PrintPanel</name> + <message> + <source>2-sided</source> + <translation>2-lados</translation> + </message> + <message> + <source>Enabled</source> + <translation>Ativado</translation> + </message> + <message> + <source>Disabled</source> + <translation>Desativado</translation> + </message> + <message> + <source>Colors</source> + <translation>Cores</translation> + </message> +</context> +</TS> |