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 0000000..3c0da64 --- /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( QWidget *parent, const char *name ) + : QGrid( 3, Horizontal, parent, name ) +{ + setMargin( 10 ); + setSpacing( 10 ); + + skip(); + (void) new QPushButton( tr("&Up"), this ); + skip(); + (void) new QPushButton( tr("&Left"), this ); + skip(); + (void) new QPushButton( tr("&Right"), this ); + skip(); + (void) new QPushButton( tr("&Down"), this ); + skip(); +} + +void ArrowPad::skip() +{ + (void) new QWidget( this ); +} diff --git a/tools/linguist/tutorial/tt2/arrowpad.h b/tools/linguist/tutorial/tt2/arrowpad.h new file mode 100644 index 0000000..2fe75c2 --- /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 QGrid +{ + Q_OBJECT +public: + ArrowPad( QWidget *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 0000000..c0e8b01 --- /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 ) +{ + QApplication app( argc, argv ); + + QTranslator translator( 0 ); + translator.load( QString("tt2_") + QTextCodec::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 0000000..e9a1567 --- /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( QWidget *parent, const char *name ) + : QMainWindow( parent, name ) +{ + ArrowPad *ap = new ArrowPad( this, "arrow pad" ); + setCentralWidget( ap ); + + QPopupMenu *file = new QPopupMenu( this ); + file->insertItem( tr("E&xit"), qApp, SLOT(quit()), + tr("Ctrl+Q", "Quit") ); + menuBar()->insertItem( tr("&File"), file ); + menuBar()->setSeparator( QMenuBar::InWindowsStyle ); +} diff --git a/tools/linguist/tutorial/tt2/mainwindow.h b/tools/linguist/tutorial/tt2/mainwindow.h new file mode 100644 index 0000000..f021869 --- /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 QMainWindow +{ + Q_OBJECT +public: + MainWindow( QWidget *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 0000000..8c1ea6d --- /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 |