summaryrefslogtreecommitdiffstats
path: root/tools/linguist/tutorial
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-10 15:24:15 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-10 15:24:15 -0500
commitbd0f3345a938b35ce6a12f6150373b0955b8dd12 (patch)
tree7a520322212d48ebcb9fbe1087e7fca28b76185c /tools/linguist/tutorial
downloadqt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.tar.gz
qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.zip
Add Qt3 development HEAD version
Diffstat (limited to 'tools/linguist/tutorial')
-rw-r--r--tools/linguist/tutorial/tt1/main.cpp25
-rw-r--r--tools/linguist/tutorial/tt1/tt1.pro4
-rw-r--r--tools/linguist/tutorial/tt2/arrowpad.cpp31
-rw-r--r--tools/linguist/tutorial/tt2/arrowpad.h22
-rw-r--r--tools/linguist/tutorial/tt2/main.cpp26
-rw-r--r--tools/linguist/tutorial/tt2/mainwindow.cpp26
-rw-r--r--tools/linguist/tutorial/tt2/mainwindow.h19
-rw-r--r--tools/linguist/tutorial/tt2/tt2.pro9
-rw-r--r--tools/linguist/tutorial/tt3/main.cpp26
-rw-r--r--tools/linguist/tutorial/tt3/mainwindow.cpp47
-rw-r--r--tools/linguist/tutorial/tt3/mainwindow.h23
-rw-r--r--tools/linguist/tutorial/tt3/printpanel.cpp37
-rw-r--r--tools/linguist/tutorial/tt3/printpanel.h19
-rw-r--r--tools/linguist/tutorial/tt3/tt3.pro8
-rw-r--r--tools/linguist/tutorial/tt3/tt3_pt.ts65
15 files changed, 387 insertions, 0 deletions
diff --git a/tools/linguist/tutorial/tt1/main.cpp b/tools/linguist/tutorial/tt1/main.cpp
new file mode 100644
index 0000000..7d10349
--- /dev/null
+++ b/tools/linguist/tutorial/tt1/main.cpp
@@ -0,0 +1,25 @@
+/****************************************************************
+**
+** Translation tutorial 1
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qtranslator.h>
+
+
+int main( int argc, char **argv )
+{
+ QApplication app( argc, argv );
+
+ QTranslator translator( 0 );
+ translator.load( "tt1_la", "." );
+ app.installTranslator( &translator );
+
+ QPushButton hello( QPushButton::tr("Hello world!"), 0 );
+
+ app.setMainWidget( &hello );
+ hello.show();
+ return app.exec();
+}
diff --git a/tools/linguist/tutorial/tt1/tt1.pro b/tools/linguist/tutorial/tt1/tt1.pro
new file mode 100644
index 0000000..3b5249c
--- /dev/null
+++ b/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/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
diff --git a/tools/linguist/tutorial/tt3/main.cpp b/tools/linguist/tutorial/tt3/main.cpp
new file mode 100644
index 0000000..e5abaf6
--- /dev/null
+++ b/tools/linguist/tutorial/tt3/main.cpp
@@ -0,0 +1,26 @@
+/****************************************************************
+**
+** Translation tutorial 3
+**
+****************************************************************/
+
+#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("tt3_") + QTextCodec::locale(), "." );
+ app.installTranslator( &translator );
+
+ MainWindow *mw = new MainWindow;
+ app.setMainWidget( mw );
+ mw->show();
+ return app.exec();
+}
diff --git a/tools/linguist/tutorial/tt3/mainwindow.cpp b/tools/linguist/tutorial/tt3/mainwindow.cpp
new file mode 100644
index 0000000..6b22bc4
--- /dev/null
+++ b/tools/linguist/tutorial/tt3/mainwindow.cpp
@@ -0,0 +1,47 @@
+/****************************************************************
+**
+** Implementation of MainWindow class, translation tutorial 3
+**
+****************************************************************/
+
+#include "mainwindow.h"
+#include "printpanel.h"
+
+#include <qaccel.h>
+#include <qapplication.h>
+#include <qmenubar.h>
+#include <qmessagebox.h>
+#include <qpopupmenu.h>
+
+MainWindow::MainWindow( QWidget *parent, const char *name )
+ : QMainWindow( parent, name )
+{
+ setCaption( tr("Troll Print 1.0") );
+
+ PrintPanel *pp = new PrintPanel( this );
+ setCentralWidget( pp );
+
+ QPopupMenu *file = new QPopupMenu( this );
+ file->insertItem( tr("E&xit"), qApp, SLOT(quit()),
+ tr("Ctrl+Q", "Quit") );
+ QPopupMenu *help = new QPopupMenu( this );
+ help->insertItem( tr("&About"), this, SLOT(about()), Key_F1 );
+ help->insertItem( tr("About &Qt"), this, SLOT(aboutQt()) );
+
+ menuBar()->insertItem( tr("&File"), file );
+ menuBar()->insertSeparator();
+ menuBar()->insertItem( tr("&Help"), help );
+ menuBar()->setSeparator( QMenuBar::InWindowsStyle );
+}
+
+void MainWindow::about()
+{
+ QMessageBox::information( this, tr("About Troll Print 1.0"),
+ tr("Troll Print 1.0.\n\n"
+ "Copyright 1999 Macroshaft, Inc.") );
+}
+
+void MainWindow::aboutQt()
+{
+ QMessageBox::aboutQt( this );
+}
diff --git a/tools/linguist/tutorial/tt3/mainwindow.h b/tools/linguist/tutorial/tt3/mainwindow.h
new file mode 100644
index 0000000..77f23f8
--- /dev/null
+++ b/tools/linguist/tutorial/tt3/mainwindow.h
@@ -0,0 +1,23 @@
+/****************************************************************
+**
+** Definition of MainWindow class, translation tutorial 3
+**
+****************************************************************/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <qmainwindow.h>
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+public:
+ MainWindow( QWidget *parent = 0, const char *name = 0 );
+
+private slots:
+ void about();
+ void aboutQt();
+};
+
+#endif
diff --git a/tools/linguist/tutorial/tt3/printpanel.cpp b/tools/linguist/tutorial/tt3/printpanel.cpp
new file mode 100644
index 0000000..5cbd468
--- /dev/null
+++ b/tools/linguist/tutorial/tt3/printpanel.cpp
@@ -0,0 +1,37 @@
+/****************************************************************
+**
+** Implementation of PrintPanel class, translation tutorial 3
+**
+****************************************************************/
+
+#include "printpanel.h"
+
+#include <qlabel.h>
+#include <qradiobutton.h>
+#include <qhbuttongroup.h>
+
+PrintPanel::PrintPanel( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ setMargin( 10 );
+ setSpacing( 10 );
+
+/*
+ QLabel *lab = new QLabel( tr("<b>TROLL PRINT</b>"), this );
+ lab->setAlignment( AlignCenter );
+*/
+
+ QRadioButton *but;
+
+ QHButtonGroup *twoSided = new QHButtonGroup( this );
+ twoSided->setTitle( tr("2-sided") );
+ but = new QRadioButton( tr("Enabled"), twoSided );
+ but = new QRadioButton( tr("Disabled"), twoSided );
+ but->toggle();
+
+ QHButtonGroup *colors = new QHButtonGroup( this );
+ colors->setTitle( tr("Colors") );
+ but = new QRadioButton( tr("Enabled"), colors );
+ but = new QRadioButton( tr("Disabled"), colors );
+ but->toggle();
+}
diff --git a/tools/linguist/tutorial/tt3/printpanel.h b/tools/linguist/tutorial/tt3/printpanel.h
new file mode 100644
index 0000000..0110c52
--- /dev/null
+++ b/tools/linguist/tutorial/tt3/printpanel.h
@@ -0,0 +1,19 @@
+/****************************************************************
+**
+** Definition of PrintPanel class, translation tutorial 3
+**
+****************************************************************/
+
+#ifndef PRINTPANEL_H
+#define PRINTPANEL_H
+
+#include <qvbox.h>
+
+class PrintPanel : public QVBox
+{
+ Q_OBJECT
+public:
+ PrintPanel( QWidget *parent = 0, const char *name = 0 );
+};
+
+#endif
diff --git a/tools/linguist/tutorial/tt3/tt3.pro b/tools/linguist/tutorial/tt3/tt3.pro
new file mode 100644
index 0000000..c219d1e
--- /dev/null
+++ b/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/tools/linguist/tutorial/tt3/tt3_pt.ts b/tools/linguist/tutorial/tt3/tt3_pt.ts
new file mode 100644
index 0000000..cf8ff4f
--- /dev/null
+++ b/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&amp;xit</source>
+ <translation>&amp;Sair</translation>
+ </message>
+ <message>
+ <source>&amp;About</source>
+ <translation>&amp;Sobre</translation>
+ </message>
+ <message>
+ <source>About &amp;Qt</source>
+ <translation>Sobre &amp;Qt</translation>
+ </message>
+ <message>
+ <source>&amp;File</source>
+ <translation>&amp;Arquivo</translation>
+ </message>
+ <message>
+ <source>&amp;Help</source>
+ <translation>A&amp;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>