diff options
Diffstat (limited to 'tools/linguist/tutorial/tt2')
-rw-r--r-- | tools/linguist/tutorial/tt2/arrowpad.cpp | 31 | ||||
-rw-r--r-- | tools/linguist/tutorial/tt2/arrowpad.h | 22 | ||||
-rw-r--r-- | tools/linguist/tutorial/tt2/main.cpp | 26 | ||||
-rw-r--r-- | tools/linguist/tutorial/tt2/mainwindow.cpp | 26 | ||||
-rw-r--r-- | tools/linguist/tutorial/tt2/mainwindow.h | 19 | ||||
-rw-r--r-- | tools/linguist/tutorial/tt2/tt2.pro | 9 |
6 files changed, 133 insertions, 0 deletions
diff --git a/tools/linguist/tutorial/tt2/arrowpad.cpp b/tools/linguist/tutorial/tt2/arrowpad.cpp new file mode 100644 index 000000000..8e23d931d --- /dev/null +++ b/tools/linguist/tutorial/tt2/arrowpad.cpp @@ -0,0 +1,31 @@ +/**************************************************************** +** +** Implementation of ArrowPad class, translation tutorial 2 +** +****************************************************************/ + +#include "arrowpad.h" + +#include <qpushbutton.h> + +ArrowPad::ArrowPad( TQWidget *parent, const char *name ) + : TQGrid( 3, Horizontal, parent, name ) +{ + setMargin( 10 ); + setSpacing( 10 ); + + skip(); + (void) new TQPushButton( tr("&Up"), this ); + skip(); + (void) new TQPushButton( tr("&Left"), this ); + skip(); + (void) new TQPushButton( tr("&Right"), this ); + skip(); + (void) new TQPushButton( tr("&Down"), this ); + skip(); +} + +void ArrowPad::skip() +{ + (void) new TQWidget( this ); +} diff --git a/tools/linguist/tutorial/tt2/arrowpad.h b/tools/linguist/tutorial/tt2/arrowpad.h new file mode 100644 index 000000000..06e11fa45 --- /dev/null +++ b/tools/linguist/tutorial/tt2/arrowpad.h @@ -0,0 +1,22 @@ +/**************************************************************** +** +** Definition of ArrowPad class, translation tutorial 2 +** +****************************************************************/ + +#ifndef ARROWPAD_H +#define ARROWPAD_H + +#include <qgrid.h> + +class ArrowPad : public TQGrid +{ + Q_OBJECT +public: + ArrowPad( TQWidget *parent = 0, const char *name = 0 ); + +private: + void skip(); +}; + +#endif diff --git a/tools/linguist/tutorial/tt2/main.cpp b/tools/linguist/tutorial/tt2/main.cpp new file mode 100644 index 000000000..132d4c49f --- /dev/null +++ b/tools/linguist/tutorial/tt2/main.cpp @@ -0,0 +1,26 @@ +/**************************************************************** +** +** Translation tutorial 2 +** +****************************************************************/ + +#include "mainwindow.h" + +#include <qapplication.h> +#include <qstring.h> +#include <qtextcodec.h> +#include <qtranslator.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/tools/linguist/tutorial/tt2/mainwindow.cpp b/tools/linguist/tutorial/tt2/mainwindow.cpp new file mode 100644 index 000000000..542846b49 --- /dev/null +++ b/tools/linguist/tutorial/tt2/mainwindow.cpp @@ -0,0 +1,26 @@ +/**************************************************************** +** +** Implementation of MainWindow class, translation tutorial 2 +** +****************************************************************/ + +#include "arrowpad.h" +#include "mainwindow.h" + +#include <qaccel.h> +#include <qapplication.h> +#include <qmenubar.h> +#include <qpopupmenu.h> + +MainWindow::MainWindow( TQWidget *parent, const char *name ) + : TQMainWindow( parent, name ) +{ + ArrowPad *ap = new ArrowPad( this, "arrow pad" ); + setCentralWidget( ap ); + + TQPopupMenu *file = new TQPopupMenu( this ); + file->insertItem( tr("E&xit"), qApp, SLOT(tquit()), + tr("Ctrl+Q", "Quit") ); + menuBar()->insertItem( tr("&File"), file ); + menuBar()->setSeparator( TQMenuBar::InWindowsStyle ); +} diff --git a/tools/linguist/tutorial/tt2/mainwindow.h b/tools/linguist/tutorial/tt2/mainwindow.h new file mode 100644 index 000000000..0d023bb6b --- /dev/null +++ b/tools/linguist/tutorial/tt2/mainwindow.h @@ -0,0 +1,19 @@ +/**************************************************************** +** +** Definition of MainWindow class, translation tutorial 2 +** +****************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <qmainwindow.h> + +class MainWindow : public TQMainWindow +{ + Q_OBJECT +public: + MainWindow( TQWidget *parent = 0, const char *name = 0 ); +}; + +#endif diff --git a/tools/linguist/tutorial/tt2/tt2.pro b/tools/linguist/tutorial/tt2/tt2.pro new file mode 100644 index 000000000..8c1ea6d4c --- /dev/null +++ b/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 |