summaryrefslogtreecommitdiffstats
path: root/main/dependencies/qt3/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
commit7d523fac5a54f8e695e56f4877fa852608465bc7 (patch)
treef74237f64a396d91997032df9bdf674492529c94 /main/dependencies/qt3/tutorial
parent37e3f157c7d76f13de807fa66e36df209e1005fb (diff)
downloadtde-7d523fac5a54f8e695e56f4877fa852608465bc7.tar.gz
tde-7d523fac5a54f8e695e56f4877fa852608465bc7.zip
Add Qt3 development HEAD version
Diffstat (limited to 'main/dependencies/qt3/tutorial')
-rw-r--r--main/dependencies/qt3/tutorial/README8
-rw-r--r--main/dependencies/qt3/tutorial/t1/main.cpp21
-rw-r--r--main/dependencies/qt3/tutorial/t1/t1.pro6
-rw-r--r--main/dependencies/qt3/tutorial/t10/cannon.cpp80
-rw-r--r--main/dependencies/qt3/tutorial/t10/cannon.h43
-rw-r--r--main/dependencies/qt3/tutorial/t10/lcdrange.cpp47
-rw-r--r--main/dependencies/qt3/tutorial/t10/lcdrange.h35
-rw-r--r--main/dependencies/qt3/tutorial/t10/main.cpp75
-rw-r--r--main/dependencies/qt3/tutorial/t10/t10.pro9
-rw-r--r--main/dependencies/qt3/tutorial/t11/cannon.cpp156
-rw-r--r--main/dependencies/qt3/tutorial/t11/cannon.h57
-rw-r--r--main/dependencies/qt3/tutorial/t11/lcdrange.cpp47
-rw-r--r--main/dependencies/qt3/tutorial/t11/lcdrange.h35
-rw-r--r--main/dependencies/qt3/tutorial/t11/main.cpp85
-rw-r--r--main/dependencies/qt3/tutorial/t11/t11.pro11
-rw-r--r--main/dependencies/qt3/tutorial/t12/cannon.cpp199
-rw-r--r--main/dependencies/qt3/tutorial/t12/cannon.h64
-rw-r--r--main/dependencies/qt3/tutorial/t12/lcdrange.cpp83
-rw-r--r--main/dependencies/qt3/tutorial/t12/lcdrange.h43
-rw-r--r--main/dependencies/qt3/tutorial/t12/main.cpp85
-rw-r--r--main/dependencies/qt3/tutorial/t12/t12.pro10
-rw-r--r--main/dependencies/qt3/tutorial/t13/cannon.cpp231
-rw-r--r--main/dependencies/qt3/tutorial/t13/cannon.h71
-rw-r--r--main/dependencies/qt3/tutorial/t13/gamebrd.cpp129
-rw-r--r--main/dependencies/qt3/tutorial/t13/gamebrd.h40
-rw-r--r--main/dependencies/qt3/tutorial/t13/lcdrange.cpp88
-rw-r--r--main/dependencies/qt3/tutorial/t13/lcdrange.h42
-rw-r--r--main/dependencies/qt3/tutorial/t13/main.cpp22
-rw-r--r--main/dependencies/qt3/tutorial/t13/t13.pro13
-rw-r--r--main/dependencies/qt3/tutorial/t14/cannon.cpp292
-rw-r--r--main/dependencies/qt3/tutorial/t14/cannon.h79
-rw-r--r--main/dependencies/qt3/tutorial/t14/gamebrd.cpp143
-rw-r--r--main/dependencies/qt3/tutorial/t14/gamebrd.h40
-rw-r--r--main/dependencies/qt3/tutorial/t14/lcdrange.cpp88
-rw-r--r--main/dependencies/qt3/tutorial/t14/lcdrange.h42
-rw-r--r--main/dependencies/qt3/tutorial/t14/main.cpp22
-rw-r--r--main/dependencies/qt3/tutorial/t14/t14.pro12
-rw-r--r--main/dependencies/qt3/tutorial/t2/main.cpp25
-rw-r--r--main/dependencies/qt3/tutorial/t2/t2.pro6
-rw-r--r--main/dependencies/qt3/tutorial/t3/main.cpp28
-rw-r--r--main/dependencies/qt3/tutorial/t3/t3.pro6
-rw-r--r--main/dependencies/qt3/tutorial/t4/main.cpp42
-rw-r--r--main/dependencies/qt3/tutorial/t4/t4.pro6
-rw-r--r--main/dependencies/qt3/tutorial/t5/main.cpp47
-rw-r--r--main/dependencies/qt3/tutorial/t5/t5.pro6
-rw-r--r--main/dependencies/qt3/tutorial/t6/main.cpp61
-rw-r--r--main/dependencies/qt3/tutorial/t6/t6.pro6
-rw-r--r--main/dependencies/qt3/tutorial/t7/lcdrange.cpp33
-rw-r--r--main/dependencies/qt3/tutorial/t7/lcdrange.h34
-rw-r--r--main/dependencies/qt3/tutorial/t7/main.cpp55
-rw-r--r--main/dependencies/qt3/tutorial/t7/t7.pro7
-rw-r--r--main/dependencies/qt3/tutorial/t8/cannon.cpp45
-rw-r--r--main/dependencies/qt3/tutorial/t8/cannon.h36
-rw-r--r--main/dependencies/qt3/tutorial/t8/lcdrange.cpp47
-rw-r--r--main/dependencies/qt3/tutorial/t8/lcdrange.h35
-rw-r--r--main/dependencies/qt3/tutorial/t8/main.cpp65
-rw-r--r--main/dependencies/qt3/tutorial/t8/t8.pro9
-rw-r--r--main/dependencies/qt3/tutorial/t9/cannon.cpp50
-rw-r--r--main/dependencies/qt3/tutorial/t9/cannon.h36
-rw-r--r--main/dependencies/qt3/tutorial/t9/lcdrange.cpp47
-rw-r--r--main/dependencies/qt3/tutorial/t9/lcdrange.h35
-rw-r--r--main/dependencies/qt3/tutorial/t9/main.cpp62
-rw-r--r--main/dependencies/qt3/tutorial/t9/t9.pro9
-rw-r--r--main/dependencies/qt3/tutorial/tutorial.pro2
64 files changed, 3393 insertions, 0 deletions
diff --git a/main/dependencies/qt3/tutorial/README b/main/dependencies/qt3/tutorial/README
new file mode 100644
index 000000000..156a3a8f4
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/README
@@ -0,0 +1,8 @@
+Here are the programs in the Qt tutorial. The tutorial itself is in
+../doc/html/tutorial.html (or http://doc.trolltech.com/3.0/tutorial.html).
+
+Typing 'make' in this directory builds all the programs (t1/t1,
+t2/t2, t3/t3 and so on). Typing 'make' in each subdirectory builds
+just that tutorial program.
+
+Feel free to send comments about the tutorial to qt-bugs@trolltech.com.
diff --git a/main/dependencies/qt3/tutorial/t1/main.cpp b/main/dependencies/qt3/tutorial/t1/main.cpp
new file mode 100644
index 000000000..0e50846ff
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t1/main.cpp
@@ -0,0 +1,21 @@
+/****************************************************************
+**
+** Qt tutorial 1
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+
+
+int main( int argc, char **argv )
+{
+ QApplication a( argc, argv );
+
+ QPushButton hello( "Hello world!", 0 );
+ hello.resize( 100, 30 );
+
+ a.setMainWidget( &hello );
+ hello.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t1/t1.pro b/main/dependencies/qt3/tutorial/t1/t1.pro
new file mode 100644
index 000000000..dede5b191
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t1/t1.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS =
+SOURCES = main.cpp
+TARGET = t1
+REQUIRES=small-config
diff --git a/main/dependencies/qt3/tutorial/t10/cannon.cpp b/main/dependencies/qt3/tutorial/t10/cannon.cpp
new file mode 100644
index 000000000..67e6f9a57
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t10/cannon.cpp
@@ -0,0 +1,80 @@
+/****************************************************************
+**
+** Implementation CannonField class, Qt tutorial 10
+**
+****************************************************************/
+
+#include "cannon.h"
+#include <qpainter.h>
+#include <qpixmap.h>
+
+
+CannonField::CannonField( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ ang = 45;
+ f = 0;
+ setPalette( QPalette( QColor( 250, 250, 200) ) );
+}
+
+
+void CannonField::setAngle( int degrees )
+{
+ if ( degrees < 5 )
+ degrees = 5;
+ if ( degrees > 70 )
+ degrees = 70;
+ if ( ang == degrees )
+ return;
+ ang = degrees;
+ repaint( cannonRect(), FALSE );
+ emit angleChanged( ang );
+}
+
+
+void CannonField::setForce( int newton )
+{
+ if ( newton < 0 )
+ newton = 0;
+ if ( f == newton )
+ return;
+ f = newton;
+ emit forceChanged( f );
+}
+
+
+void CannonField::paintEvent( QPaintEvent *e )
+{
+ if ( !e->rect().intersects( cannonRect() ) )
+ return;
+
+ QRect cr = cannonRect();
+ QPixmap pix( cr.size() );
+ pix.fill( this, cr.topLeft() );
+
+ QPainter p( &pix );
+ p.setBrush( blue );
+ p.setPen( NoPen );
+ p.translate( 0, pix.height() - 1 );
+ p.drawPie( QRect( -35,-35, 70, 70 ), 0, 90*16 );
+ p.rotate( -ang );
+ p.drawRect( QRect(33, -4, 15, 8) );
+ p.end();
+
+ p.begin( this );
+ p.drawPixmap( cr.topLeft(), pix );
+}
+
+
+QRect CannonField::cannonRect() const
+{
+ QRect r( 0, 0, 50, 50 );
+ r.moveBottomLeft( rect().bottomLeft() );
+ return r;
+}
+
+
+QSizePolicy CannonField::sizePolicy() const
+{
+ return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
+}
diff --git a/main/dependencies/qt3/tutorial/t10/cannon.h b/main/dependencies/qt3/tutorial/t10/cannon.h
new file mode 100644
index 000000000..5a317d1e5
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t10/cannon.h
@@ -0,0 +1,43 @@
+/****************************************************************
+**
+** Definition of CannonField class, Qt tutorial 10
+**
+****************************************************************/
+
+#ifndef CANNON_H
+#define CANNON_H
+
+#include <qwidget.h>
+
+
+class CannonField : public QWidget
+{
+ Q_OBJECT
+public:
+ CannonField( QWidget *parent=0, const char *name=0 );
+
+ QSizePolicy sizePolicy() const;
+
+ int angle() const { return ang; }
+ int force() const { return f; }
+
+public slots:
+ void setAngle( int degrees );
+ void setForce( int newton );
+
+signals:
+ void angleChanged( int );
+ void forceChanged( int );
+
+protected:
+ void paintEvent( QPaintEvent * );
+
+private:
+ QRect cannonRect() const;
+
+ int ang;
+ int f;
+};
+
+
+#endif // CANNON_H
diff --git a/main/dependencies/qt3/tutorial/t10/lcdrange.cpp b/main/dependencies/qt3/tutorial/t10/lcdrange.cpp
new file mode 100644
index 000000000..b62cfbbcf
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t10/lcdrange.cpp
@@ -0,0 +1,47 @@
+/****************************************************************
+**
+** Implementation of LCDRange class, Qt tutorial 8
+**
+****************************************************************/
+
+#include "lcdrange.h"
+
+#include <qslider.h>
+#include <qlcdnumber.h>
+
+LCDRange::LCDRange( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
+ slider = new QSlider( Horizontal, this, "slider" );
+ slider->setRange( 0, 99 );
+ slider->setValue( 0 );
+ connect( slider, SIGNAL(valueChanged(int)),
+ lcd, SLOT(display(int)) );
+ connect( slider, SIGNAL(valueChanged(int)),
+ SIGNAL(valueChanged(int)) );
+
+ setFocusProxy( slider );
+}
+
+int LCDRange::value() const
+{
+ return slider->value();
+}
+
+void LCDRange::setValue( int value )
+{
+ slider->setValue( value );
+}
+
+void LCDRange::setRange( int minVal, int maxVal )
+{
+ if ( minVal < 0 || maxVal > 99 || minVal > maxVal ) {
+ qWarning( "LCDRange::setRange(%d,%d)\n"
+ "\tRange must be 0..99\n"
+ "\tand minVal must not be greater than maxVal",
+ minVal, maxVal );
+ return;
+ }
+ slider->setRange( minVal, maxVal );
+}
diff --git a/main/dependencies/qt3/tutorial/t10/lcdrange.h b/main/dependencies/qt3/tutorial/t10/lcdrange.h
new file mode 100644
index 000000000..5fa2d2183
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t10/lcdrange.h
@@ -0,0 +1,35 @@
+/****************************************************************
+**
+** Definition of LCDRange class, Qt tutorial 8
+**
+****************************************************************/
+
+#ifndef LCDRANGE_H
+#define LCDRANGE_H
+
+#include <qvbox.h>
+
+class QSlider;
+
+
+class LCDRange : public QVBox
+{
+ Q_OBJECT
+public:
+ LCDRange( QWidget *parent=0, const char *name=0 );
+
+ int value() const;
+
+public slots:
+ void setValue( int );
+ void setRange( int minVal, int maxVal );
+
+signals:
+ void valueChanged( int );
+
+private:
+ QSlider *slider;
+};
+
+
+#endif // LCDRANGE_H
diff --git a/main/dependencies/qt3/tutorial/t10/main.cpp b/main/dependencies/qt3/tutorial/t10/main.cpp
new file mode 100644
index 000000000..6dd2bf5f2
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t10/main.cpp
@@ -0,0 +1,75 @@
+/****************************************************************
+**
+** Qt tutorial 10
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qlcdnumber.h>
+#include <qfont.h>
+#include <qlayout.h>
+
+#include "lcdrange.h"
+#include "cannon.h"
+
+
+class MyWidget: public QWidget
+{
+public:
+ MyWidget( QWidget *parent=0, const char *name=0 );
+};
+
+
+MyWidget::MyWidget( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ QPushButton *quit = new QPushButton( "&Quit", this, "quit" );
+ quit->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+
+ LCDRange *angle = new LCDRange( this, "angle" );
+ angle->setRange( 5, 70 );
+
+ LCDRange *force = new LCDRange( this, "force" );
+ force->setRange( 10, 50 );
+
+ CannonField *cannonField = new CannonField( this, "cannonField" );
+
+ connect( angle, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setAngle(int)) );
+ connect( cannonField, SIGNAL(angleChanged(int)),
+ angle, SLOT(setValue(int)) );
+
+ connect( force, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setForce(int)) );
+ connect( cannonField, SIGNAL(forceChanged(int)),
+ force, SLOT(setValue(int)) );
+
+ QGridLayout *grid = new QGridLayout( this, 2, 2, 10 );
+ grid->addWidget( quit, 0, 0 );
+ grid->addWidget( cannonField, 1, 1 );
+ grid->setColStretch( 1, 10 );
+
+ QVBoxLayout *leftBox = new QVBoxLayout;
+ grid->addLayout( leftBox, 1, 0 );
+ leftBox->addWidget( angle );
+ leftBox->addWidget( force );
+
+ angle->setValue( 60 );
+ force->setValue( 25 );
+ angle->setFocus();
+}
+
+int main( int argc, char **argv )
+{
+ QApplication::setColorSpec( QApplication::CustomColor );
+ QApplication a( argc, argv );
+
+ MyWidget w;
+ w.setGeometry( 100, 100, 500, 355 );
+ a.setMainWidget( &w );
+ w.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t10/t10.pro b/main/dependencies/qt3/tutorial/t10/t10.pro
new file mode 100644
index 000000000..202b939a6
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t10/t10.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS = cannon.h \
+ lcdrange.h
+SOURCES = cannon.cpp \
+ lcdrange.cpp \
+ main.cpp
+TARGET = t10
+REQUIRES=full-config
diff --git a/main/dependencies/qt3/tutorial/t11/cannon.cpp b/main/dependencies/qt3/tutorial/t11/cannon.cpp
new file mode 100644
index 000000000..bf44a6dce
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t11/cannon.cpp
@@ -0,0 +1,156 @@
+/****************************************************************
+**
+** Implementation CannonField class, Qt tutorial 11
+**
+****************************************************************/
+
+#include "cannon.h"
+#include <qtimer.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+
+#include <math.h>
+
+
+CannonField::CannonField( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ ang = 45;
+ f = 0;
+ timerCount = 0;
+ autoShootTimer = new QTimer( this, "movement handler" );
+ connect( autoShootTimer, SIGNAL(timeout()),
+ this, SLOT(moveShot()) );
+ shoot_ang = 0;
+ shoot_f = 0;
+ setPalette( QPalette( QColor( 250, 250, 200) ) );
+}
+
+
+void CannonField::setAngle( int degrees )
+{
+ if ( degrees < 5 )
+ degrees = 5;
+ if ( degrees > 70 )
+ degrees = 70;
+ if ( ang == degrees )
+ return;
+ ang = degrees;
+ repaint( cannonRect(), FALSE );
+ emit angleChanged( ang );
+}
+
+
+void CannonField::setForce( int newton )
+{
+ if ( newton < 0 )
+ newton = 0;
+ if ( f == newton )
+ return;
+ f = newton;
+ emit forceChanged( f );
+}
+
+
+void CannonField::shoot()
+{
+ if ( autoShootTimer->isActive() )
+ return;
+ timerCount = 0;
+ shoot_ang = ang;
+ shoot_f = f;
+ autoShootTimer->start( 50 );
+}
+
+
+void CannonField::moveShot()
+{
+ QRegion r( shotRect() );
+ timerCount++;
+
+ QRect shotR = shotRect();
+
+ if ( shotR.x() > width() || shotR.y() > height() )
+ autoShootTimer->stop();
+ else
+ r = r.unite( QRegion( shotR ) );
+ repaint( r );
+}
+
+
+void CannonField::paintEvent( QPaintEvent *e )
+{
+ QRect updateR = e->rect();
+ QPainter p( this );
+
+ if ( updateR.intersects( cannonRect() ) )
+ paintCannon( &p );
+ if ( autoShootTimer->isActive() &&
+ updateR.intersects( shotRect() ) )
+ paintShot( &p );
+}
+
+
+void CannonField::paintShot( QPainter *p )
+{
+ p->setBrush( black );
+ p->setPen( NoPen );
+ p->drawRect( shotRect() );
+}
+
+
+const QRect barrelRect(33, -4, 15, 8);
+
+void CannonField::paintCannon( QPainter *p )
+{
+ QRect cr = cannonRect();
+ QPixmap pix( cr.size() );
+ pix.fill( this, cr.topLeft() );
+
+ QPainter tmp( &pix );
+ tmp.setBrush( blue );
+ tmp.setPen( NoPen );
+
+ tmp.translate( 0, pix.height() - 1 );
+ tmp.drawPie( QRect( -35,-35, 70, 70 ), 0, 90*16 );
+ tmp.rotate( -ang );
+ tmp.drawRect( barrelRect );
+ tmp.end();
+
+ p->drawPixmap( cr.topLeft(), pix );
+}
+
+
+QRect CannonField::cannonRect() const
+{
+ QRect r( 0, 0, 50, 50 );
+ r.moveBottomLeft( rect().bottomLeft() );
+ return r;
+}
+
+
+QRect CannonField::shotRect() const
+{
+ const double gravity = 4;
+
+ double time = timerCount / 4.0;
+ double velocity = shoot_f;
+ double radians = shoot_ang*3.14159265/180;
+
+ double velx = velocity*cos( radians );
+ double vely = velocity*sin( radians );
+ double x0 = ( barrelRect.right() + 5 )*cos(radians);
+ double y0 = ( barrelRect.right() + 5 )*sin(radians);
+ double x = x0 + velx*time;
+ double y = y0 + vely*time - 0.5*gravity*time*time;
+
+ QRect r = QRect( 0, 0, 6, 6 );
+ r.moveCenter( QPoint( qRound(x), height() - 1 - qRound(y) ) );
+ return r;
+}
+
+
+QSizePolicy CannonField::sizePolicy() const
+{
+ return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
+}
diff --git a/main/dependencies/qt3/tutorial/t11/cannon.h b/main/dependencies/qt3/tutorial/t11/cannon.h
new file mode 100644
index 000000000..76f895dce
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t11/cannon.h
@@ -0,0 +1,57 @@
+/****************************************************************
+**
+** Definition of CannonField class, Qt tutorial 11
+**
+****************************************************************/
+
+#ifndef CANNON_H
+#define CANNON_H
+
+class QTimer;
+
+
+#include <qwidget.h>
+
+
+class CannonField : public QWidget
+{
+ Q_OBJECT
+public:
+ CannonField( QWidget *parent=0, const char *name=0 );
+
+ int angle() const { return ang; }
+ int force() const { return f; }
+ QSizePolicy sizePolicy() const;
+
+public slots:
+ void setAngle( int degrees );
+ void setForce( int newton );
+ void shoot();
+
+private slots:
+ void moveShot();
+
+signals:
+ void angleChanged( int );
+ void forceChanged( int );
+
+protected:
+ void paintEvent( QPaintEvent * );
+
+private:
+ void paintShot( QPainter * );
+ void paintCannon( QPainter * );
+ QRect cannonRect() const;
+ QRect shotRect() const;
+
+ int ang;
+ int f;
+
+ int timerCount;
+ QTimer * autoShootTimer;
+ float shoot_ang;
+ float shoot_f;
+};
+
+
+#endif // CANNON_H
diff --git a/main/dependencies/qt3/tutorial/t11/lcdrange.cpp b/main/dependencies/qt3/tutorial/t11/lcdrange.cpp
new file mode 100644
index 000000000..b62cfbbcf
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t11/lcdrange.cpp
@@ -0,0 +1,47 @@
+/****************************************************************
+**
+** Implementation of LCDRange class, Qt tutorial 8
+**
+****************************************************************/
+
+#include "lcdrange.h"
+
+#include <qslider.h>
+#include <qlcdnumber.h>
+
+LCDRange::LCDRange( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
+ slider = new QSlider( Horizontal, this, "slider" );
+ slider->setRange( 0, 99 );
+ slider->setValue( 0 );
+ connect( slider, SIGNAL(valueChanged(int)),
+ lcd, SLOT(display(int)) );
+ connect( slider, SIGNAL(valueChanged(int)),
+ SIGNAL(valueChanged(int)) );
+
+ setFocusProxy( slider );
+}
+
+int LCDRange::value() const
+{
+ return slider->value();
+}
+
+void LCDRange::setValue( int value )
+{
+ slider->setValue( value );
+}
+
+void LCDRange::setRange( int minVal, int maxVal )
+{
+ if ( minVal < 0 || maxVal > 99 || minVal > maxVal ) {
+ qWarning( "LCDRange::setRange(%d,%d)\n"
+ "\tRange must be 0..99\n"
+ "\tand minVal must not be greater than maxVal",
+ minVal, maxVal );
+ return;
+ }
+ slider->setRange( minVal, maxVal );
+}
diff --git a/main/dependencies/qt3/tutorial/t11/lcdrange.h b/main/dependencies/qt3/tutorial/t11/lcdrange.h
new file mode 100644
index 000000000..5fa2d2183
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t11/lcdrange.h
@@ -0,0 +1,35 @@
+/****************************************************************
+**
+** Definition of LCDRange class, Qt tutorial 8
+**
+****************************************************************/
+
+#ifndef LCDRANGE_H
+#define LCDRANGE_H
+
+#include <qvbox.h>
+
+class QSlider;
+
+
+class LCDRange : public QVBox
+{
+ Q_OBJECT
+public:
+ LCDRange( QWidget *parent=0, const char *name=0 );
+
+ int value() const;
+
+public slots:
+ void setValue( int );
+ void setRange( int minVal, int maxVal );
+
+signals:
+ void valueChanged( int );
+
+private:
+ QSlider *slider;
+};
+
+
+#endif // LCDRANGE_H
diff --git a/main/dependencies/qt3/tutorial/t11/main.cpp b/main/dependencies/qt3/tutorial/t11/main.cpp
new file mode 100644
index 000000000..899cdf6d4
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t11/main.cpp
@@ -0,0 +1,85 @@
+/****************************************************************
+**
+** Qt tutorial 11
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qlcdnumber.h>
+#include <qfont.h>
+#include <qlayout.h>
+
+#include "lcdrange.h"
+#include "cannon.h"
+
+
+class MyWidget: public QWidget
+{
+public:
+ MyWidget( QWidget *parent=0, const char *name=0 );
+};
+
+
+MyWidget::MyWidget( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ QPushButton *quit = new QPushButton( "&Quit", this, "quit" );
+ quit->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+
+ LCDRange *angle = new LCDRange( this, "angle" );
+ angle->setRange( 5, 70 );
+
+ LCDRange *force = new LCDRange( this, "force" );
+ force->setRange( 10, 50 );
+
+ CannonField *cannonField = new CannonField( this, "cannonField" );
+
+ connect( angle, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setAngle(int)) );
+ connect( cannonField, SIGNAL(angleChanged(int)),
+ angle, SLOT(setValue(int)) );
+
+ connect( force, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setForce(int)) );
+ connect( cannonField, SIGNAL(forceChanged(int)),
+ force, SLOT(setValue(int)) );
+
+ QPushButton *shoot = new QPushButton( "&Shoot", this, "shoot" );
+ shoot->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( shoot, SIGNAL(clicked()), cannonField, SLOT(shoot()) );
+
+ QGridLayout *grid = new QGridLayout( this, 2, 2, 10 );
+ grid->addWidget( quit, 0, 0 );
+ grid->addWidget( cannonField, 1, 1 );
+ grid->setColStretch( 1, 10 );
+
+ QVBoxLayout *leftBox = new QVBoxLayout;
+ grid->addLayout( leftBox, 1, 0 );
+ leftBox->addWidget( angle );
+ leftBox->addWidget( force );
+
+ QHBoxLayout *topBox = new QHBoxLayout;
+ grid->addLayout( topBox, 0, 1 );
+ topBox->addWidget( shoot );
+ topBox->addStretch( 1 );
+
+ angle->setValue( 60 );
+ force->setValue( 25 );
+ angle->setFocus();
+}
+
+int main( int argc, char **argv )
+{
+ QApplication::setColorSpec( QApplication::CustomColor );
+ QApplication a( argc, argv );
+
+ MyWidget w;
+ w.setGeometry( 100, 100, 500, 355 );
+ a.setMainWidget( &w );
+ w.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t11/t11.pro b/main/dependencies/qt3/tutorial/t11/t11.pro
new file mode 100644
index 000000000..63fc17e88
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t11/t11.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS = cannon.h \
+ lcdrange.h
+SOURCES = cannon.cpp \
+ lcdrange.cpp \
+ main.cpp
+TARGET = t11
+REQUIRES=full-config
+unix:LIBS += -lm
+
diff --git a/main/dependencies/qt3/tutorial/t12/cannon.cpp b/main/dependencies/qt3/tutorial/t12/cannon.cpp
new file mode 100644
index 000000000..530357183
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t12/cannon.cpp
@@ -0,0 +1,199 @@
+/****************************************************************
+**
+** Implementation CannonField class, Qt tutorial 12
+**
+****************************************************************/
+
+#include "cannon.h"
+#include <qtimer.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qdatetime.h>
+
+#include <math.h>
+#include <stdlib.h>
+
+
+CannonField::CannonField( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ ang = 45;
+ f = 0;
+ timerCount = 0;
+ autoShootTimer = new QTimer( this, "movement handler" );
+ connect( autoShootTimer, SIGNAL(timeout()),
+ this, SLOT(moveShot()) );
+ shoot_ang = 0;
+ shoot_f = 0;
+ target = QPoint( 0, 0 );
+ setPalette( QPalette( QColor( 250, 250, 200) ) );
+ newTarget();
+}
+
+
+void CannonField::setAngle( int degrees )
+{
+ if ( degrees < 5 )
+ degrees = 5;
+ if ( degrees > 70 )
+ degrees = 70;
+ if ( ang == degrees )
+ return;
+ ang = degrees;
+ repaint( cannonRect(), FALSE );
+ emit angleChanged( ang );
+}
+
+
+void CannonField::setForce( int newton )
+{
+ if ( newton < 0 )
+ newton = 0;
+ if ( f == newton )
+ return;
+ f = newton;
+ emit forceChanged( f );
+}
+
+
+void CannonField::shoot()
+{
+ if ( autoShootTimer->isActive() )
+ return;
+ timerCount = 0;
+ shoot_ang = ang;
+ shoot_f = f;
+ autoShootTimer->start( 50 );
+}
+
+
+void CannonField::newTarget()
+{
+ static bool first_time = TRUE;
+ if ( first_time ) {
+ first_time = FALSE;
+ QTime midnight( 0, 0, 0 );
+ srand( midnight.secsTo(QTime::currentTime()) );
+ }
+ QRegion r( targetRect() );
+ target = QPoint( 200 + rand() % 190,
+ 10 + rand() % 255 );
+ repaint( r.unite( targetRect() ) );
+}
+
+
+void CannonField::moveShot()
+{
+ QRegion r( shotRect() );
+ timerCount++;
+
+ QRect shotR = shotRect();
+
+ if ( shotR.intersects( targetRect() ) ) {
+ autoShootTimer->stop();
+ emit hit();
+ } else if ( shotR.x() > width() || shotR.y() > height() ) {
+ autoShootTimer->stop();
+ emit missed();
+ } else {
+ r = r.unite( QRegion( shotR ) );
+ }
+
+ repaint( r );
+}
+
+
+void CannonField::paintEvent( QPaintEvent *e )
+{
+ QRect updateR = e->rect();
+ QPainter p( this );
+
+ if ( updateR.intersects( cannonRect() ) )
+ paintCannon( &p );
+ if ( autoShootTimer->isActive() &&
+ updateR.intersects( shotRect() ) )
+ paintShot( &p );
+ if ( updateR.intersects( targetRect() ) )
+ paintTarget( &p );
+}
+
+
+void CannonField::paintShot( QPainter *p )
+{
+ p->setBrush( black );
+ p->setPen( NoPen );
+ p->drawRect( shotRect() );
+}
+
+
+void CannonField::paintTarget( QPainter *p )
+{
+ p->setBrush( red );
+ p->setPen( black );
+ p->drawRect( targetRect() );
+}
+
+
+const QRect barrelRect(33, -4, 15, 8);
+
+void CannonField::paintCannon( QPainter *p )
+{
+ QRect cr = cannonRect();
+ QPixmap pix( cr.size() );
+ pix.fill( this, cr.topLeft() );
+
+ QPainter tmp( &pix );
+ tmp.setBrush( blue );
+ tmp.setPen( NoPen );
+
+ tmp.translate( 0, pix.height() - 1 );
+ tmp.drawPie( QRect( -35,-35, 70, 70 ), 0, 90*16 );
+ tmp.rotate( -ang );
+ tmp.drawRect( barrelRect );
+ tmp.end();
+
+ p->drawPixmap( cr.topLeft(), pix );
+}
+
+
+QRect CannonField::cannonRect() const
+{
+ QRect r( 0, 0, 50, 50 );
+ r.moveBottomLeft( rect().bottomLeft() );
+ return r;
+}
+
+
+QRect CannonField::shotRect() const
+{
+ const double gravity = 4;
+
+ double time = timerCount / 4.0;
+ double velocity = shoot_f;
+ double radians = shoot_ang*3.14159265/180;
+
+ double velx = velocity*cos( radians );
+ double vely = velocity*sin( radians );
+ double x0 = ( barrelRect.right() + 5 )*cos(radians);
+ double y0 = ( barrelRect.right() + 5 )*sin(radians);
+ double x = x0 + velx*time;
+ double y = y0 + vely*time - 0.5*gravity*time*time;
+
+ QRect r = QRect( 0, 0, 6, 6 );
+ r.moveCenter( QPoint( qRound(x), height() - 1 - qRound(y) ) );
+ return r;
+}
+
+
+QRect CannonField::targetRect() const
+{
+ QRect r( 0, 0, 20, 10 );
+ r.moveCenter( QPoint(target.x(),height() - 1 - target.y()) );
+ return r;
+}
+
+
+QSizePolicy CannonField::sizePolicy() const
+{
+ return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
+}
diff --git a/main/dependencies/qt3/tutorial/t12/cannon.h b/main/dependencies/qt3/tutorial/t12/cannon.h
new file mode 100644
index 000000000..b8824b50f
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t12/cannon.h
@@ -0,0 +1,64 @@
+/****************************************************************
+**
+** Definition of CannonField class, Qt tutorial 12
+**
+****************************************************************/
+
+#ifndef CANNON_H
+#define CANNON_H
+
+class QTimer;
+
+
+#include <qwidget.h>
+
+
+class CannonField : public QWidget
+{
+ Q_OBJECT
+public:
+ CannonField( QWidget *parent=0, const char *name=0 );
+
+ int angle() const { return ang; }
+ int force() const { return f; }
+ QSizePolicy sizePolicy() const;
+
+public slots:
+ void setAngle( int degrees );
+ void setForce( int newton );
+ void shoot();
+ void newTarget();
+
+private slots:
+ void moveShot();
+
+signals:
+ void hit();
+ void missed();
+ void angleChanged( int );
+ void forceChanged( int );
+
+protected:
+ void paintEvent( QPaintEvent * );
+
+private:
+ void paintShot( QPainter * );
+ void paintTarget( QPainter * );
+ void paintCannon( QPainter * );
+ QRect cannonRect() const;
+ QRect shotRect() const;
+ QRect targetRect() const;
+
+ int ang;
+ int f;
+
+ int timerCount;
+ QTimer * autoShootTimer;
+ float shoot_ang;
+ float shoot_f;
+
+ QPoint target;
+};
+
+
+#endif // CANNON_H
diff --git a/main/dependencies/qt3/tutorial/t12/lcdrange.cpp b/main/dependencies/qt3/tutorial/t12/lcdrange.cpp
new file mode 100644
index 000000000..bdd722dc4
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t12/lcdrange.cpp
@@ -0,0 +1,83 @@
+/****************************************************************
+**
+** Implementation of LCDRange class, Qt tutorial 12
+**
+****************************************************************/
+
+#include "lcdrange.h"
+
+#include <qslider.h>
+#include <qlcdnumber.h>
+#include <qlabel.h>
+
+
+LCDRange::LCDRange( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ init();
+}
+
+
+LCDRange::LCDRange( const char *s, QWidget *parent,
+ const char *name )
+ : QVBox( parent, name )
+{
+ init();
+ setText( s );
+}
+
+
+void LCDRange::init()
+{
+ QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
+ slider = new QSlider( Horizontal, this, "slider" );
+ slider->setRange( 0, 99 );
+ slider->setValue( 0 );
+
+ label = new QLabel( " ", this, "label" );
+ label->setAlignment( AlignCenter );
+
+ connect( slider, SIGNAL(valueChanged(int)),
+ lcd, SLOT(display(int)) );
+ connect( slider, SIGNAL(valueChanged(int)),
+ SIGNAL(valueChanged(int)) );
+
+ setFocusProxy( slider );
+}
+
+
+int LCDRange::value() const
+{
+ return slider->value();
+}
+
+
+const char *LCDRange::text() const
+{
+ return label->text();
+}
+
+
+void LCDRange::setValue( int value )
+{
+ slider->setValue( value );
+}
+
+
+void LCDRange::setRange( int minVal, int maxVal )
+{
+ if ( minVal < 0 || maxVal > 99 || minVal > maxVal ) {
+ qWarning( "LCDRange::setRange(%d,%d)\n"
+ "\tRange must be 0..99\n"
+ "\tand minVal must not be greater than maxVal",
+ minVal, maxVal );
+ return;
+ }
+ slider->setRange( minVal, maxVal );
+}
+
+
+void LCDRange::setText( const char *s )
+{
+ label->setText( s );
+}
diff --git a/main/dependencies/qt3/tutorial/t12/lcdrange.h b/main/dependencies/qt3/tutorial/t12/lcdrange.h
new file mode 100644
index 000000000..9f93334bd
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t12/lcdrange.h
@@ -0,0 +1,43 @@
+/****************************************************************
+**
+** Definition of LCDRange class, Qt tutorial 12
+**
+****************************************************************/
+
+#ifndef LCDRANGE_H
+#define LCDRANGE_H
+
+#include <qvbox.h>
+
+class QSlider;
+class QLabel;
+
+
+class LCDRange : public QVBox
+{
+ Q_OBJECT
+public:
+ LCDRange( QWidget *parent=0, const char *name=0 );
+ LCDRange( const char *s, QWidget *parent=0,
+ const char *name=0 );
+
+ int value() const;
+ const char *text() const;
+
+public slots:
+ void setValue( int );
+ void setRange( int minVal, int maxVal );
+ void setText( const char * );
+
+signals:
+ void valueChanged( int );
+
+private:
+ void init();
+
+ QSlider *slider;
+ QLabel *label;
+};
+
+
+#endif // LCDRANGE_H
diff --git a/main/dependencies/qt3/tutorial/t12/main.cpp b/main/dependencies/qt3/tutorial/t12/main.cpp
new file mode 100644
index 000000000..550eb722b
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t12/main.cpp
@@ -0,0 +1,85 @@
+/****************************************************************
+**
+** Qt tutorial 12
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qlcdnumber.h>
+#include <qfont.h>
+#include <qlayout.h>
+
+#include "lcdrange.h"
+#include "cannon.h"
+
+
+class MyWidget: public QWidget
+{
+public:
+ MyWidget( QWidget *parent=0, const char *name=0 );
+};
+
+
+MyWidget::MyWidget( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ QPushButton *quit = new QPushButton( "&Quit", this, "quit" );
+ quit->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+
+ LCDRange *angle = new LCDRange( "ANGLE", this, "angle" );
+ angle->setRange( 5, 70 );
+
+ LCDRange *force = new LCDRange( "FORCE", this, "force" );
+ force->setRange( 10, 50 );
+
+ CannonField *cannonField = new CannonField( this, "cannonField" );
+
+ connect( angle, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setAngle(int)) );
+ connect( cannonField, SIGNAL(angleChanged(int)),
+ angle, SLOT(setValue(int)) );
+
+ connect( force, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setForce(int)) );
+ connect( cannonField, SIGNAL(forceChanged(int)),
+ force, SLOT(setValue(int)) );
+
+ QPushButton *shoot = new QPushButton( "&Shoot", this, "shoot" );
+ shoot->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( shoot, SIGNAL(clicked()), cannonField, SLOT(shoot()) );
+
+ QGridLayout *grid = new QGridLayout( this, 2, 2, 10 );
+ grid->addWidget( quit, 0, 0 );
+ grid->addWidget( cannonField, 1, 1 );
+ grid->setColStretch( 1, 10 );
+
+ QVBoxLayout *leftBox = new QVBoxLayout;
+ grid->addLayout( leftBox, 1, 0 );
+ leftBox->addWidget( angle );
+ leftBox->addWidget( force );
+
+ QHBoxLayout *topBox = new QHBoxLayout;
+ grid->addLayout( topBox, 0, 1 );
+ topBox->addWidget( shoot );
+ topBox->addStretch( 1 );
+
+ angle->setValue( 60 );
+ force->setValue( 25 );
+ angle->setFocus();
+}
+
+int main( int argc, char **argv )
+{
+ QApplication::setColorSpec( QApplication::CustomColor );
+ QApplication a( argc, argv );
+
+ MyWidget w;
+ w.setGeometry( 100, 100, 500, 355 );
+ a.setMainWidget( &w );
+ w.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t12/t12.pro b/main/dependencies/qt3/tutorial/t12/t12.pro
new file mode 100644
index 000000000..679890f78
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t12/t12.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS = cannon.h \
+ lcdrange.h
+SOURCES = cannon.cpp \
+ lcdrange.cpp \
+ main.cpp
+TARGET = t12
+REQUIRES=full-config
+unix:LIBS += -lm
diff --git a/main/dependencies/qt3/tutorial/t13/cannon.cpp b/main/dependencies/qt3/tutorial/t13/cannon.cpp
new file mode 100644
index 000000000..ac8f3d112
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t13/cannon.cpp
@@ -0,0 +1,231 @@
+/****************************************************************
+**
+** Implementation CannonField class, Qt tutorial 13
+**
+****************************************************************/
+
+#include "cannon.h"
+#include <qtimer.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qdatetime.h>
+
+#include <math.h>
+#include <stdlib.h>
+
+
+CannonField::CannonField( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ ang = 45;
+ f = 0;
+ timerCount = 0;
+ autoShootTimer = new QTimer( this, "movement handler" );
+ connect( autoShootTimer, SIGNAL(timeout()),
+ this, SLOT(moveShot()) );
+ shoot_ang = 0;
+ shoot_f = 0;
+ target = QPoint( 0, 0 );
+ gameEnded = FALSE;
+ setPalette( QPalette( QColor( 250, 250, 200) ) );
+ newTarget();
+}
+
+
+void CannonField::setAngle( int degrees )
+{
+ if ( degrees < 5 )
+ degrees = 5;
+ if ( degrees > 70 )
+ degrees = 70;
+ if ( ang == degrees )
+ return;
+ ang = degrees;
+ repaint( cannonRect(), FALSE );
+ emit angleChanged( ang );
+}
+
+
+void CannonField::setForce( int newton )
+{
+ if ( newton < 0 )
+ newton = 0;
+ if ( f == newton )
+ return;
+ f = newton;
+ emit forceChanged( f );
+}
+
+
+void CannonField::shoot()
+{
+ if ( isShooting() )
+ return;
+ timerCount = 0;
+ shoot_ang = ang;
+ shoot_f = f;
+ autoShootTimer->start( 50 );
+ emit canShoot( FALSE );
+}
+
+
+void CannonField::newTarget()
+{
+ static bool first_time = TRUE;
+ if ( first_time ) {
+ first_time = FALSE;
+ QTime midnight( 0, 0, 0 );
+ srand( midnight.secsTo(QTime::currentTime()) );
+ }
+ QRegion r( targetRect() );
+ target = QPoint( 200 + rand() % 190,
+ 10 + rand() % 255 );
+ repaint( r.unite( targetRect() ) );
+}
+
+void CannonField::setGameOver()
+{
+ if ( gameEnded )
+ return;
+ if ( isShooting() )
+ autoShootTimer->stop();
+ gameEnded = TRUE;
+ repaint();
+}
+
+void CannonField::restartGame()
+{
+ if ( isShooting() )
+ autoShootTimer->stop();
+ gameEnded = FALSE;
+ repaint();
+ emit canShoot( TRUE );
+}
+
+void CannonField::moveShot()
+{
+ QRegion r( shotRect() );
+ timerCount++;
+
+ QRect shotR = shotRect();
+
+ if ( shotR.intersects( targetRect() ) ) {
+ autoShootTimer->stop();
+ emit hit();
+ emit canShoot( TRUE );
+ } else if ( shotR.x() > width() || shotR.y() > height() ) {
+ autoShootTimer->stop();
+ emit missed();
+ emit canShoot( TRUE );
+ } else {
+ r = r.unite( QRegion( shotR ) );
+ }
+
+ repaint( r );
+}
+
+
+void CannonField::paintEvent( QPaintEvent *e )
+{
+ QRect updateR = e->rect();
+ QPainter p( this );
+
+ if ( gameEnded ) {
+ p.setPen( black );
+ p.setFont( QFont( "Courier", 48, QFont::Bold ) );
+ p.drawText( rect(), AlignCenter, "Game Over" );
+ }
+ if ( updateR.intersects( cannonRect() ) )
+ paintCannon( &p );
+ if ( isShooting() && updateR.intersects( shotRect() ) )
+ paintShot( &p );
+ if ( !gameEnded && updateR.intersects( targetRect() ) )
+ paintTarget( &p );
+}
+
+
+void CannonField::paintShot( QPainter *p )
+{
+ p->setBrush( black );
+ p->setPen( NoPen );
+ p->drawRect( shotRect() );
+}
+
+
+void CannonField::paintTarget( QPainter *p )
+{
+ p->setBrush( red );
+ p->setPen( black );
+ p->drawRect( targetRect() );
+}
+
+
+const QRect barrelRect(33, -4, 15, 8);
+
+void CannonField::paintCannon( QPainter *p )
+{
+ QRect cr = cannonRect();
+ QPixmap pix( cr.size() );
+ pix.fill( this, cr.topLeft() );
+
+ QPainter tmp( &pix );
+ tmp.setBrush( blue );
+ tmp.setPen( NoPen );
+
+ tmp.translate( 0, pix.height() - 1 );
+ tmp.drawPie( QRect( -35,-35, 70, 70 ), 0, 90*16 );
+ tmp.rotate( -ang );
+ tmp.drawRect( barrelRect );
+ tmp.end();
+
+ p->drawPixmap( cr.topLeft(), pix );
+}
+
+
+QRect CannonField::cannonRect() const
+{
+ QRect r( 0, 0, 50, 50 );
+ r.moveBottomLeft( rect().bottomLeft() );
+ return r;
+}
+
+
+QRect CannonField::shotRect() const
+{
+ const double gravity = 4;
+
+ double time = timerCount / 4.0;
+ double velocity = shoot_f;
+ double radians = shoot_ang*3.14159265/180;
+
+ double velx = velocity*cos( radians );
+ double vely = velocity*sin( radians );
+ double x0 = ( barrelRect.right() + 5 )*cos(radians);
+ double y0 = ( barrelRect.right() + 5 )*sin(radians);
+ double x = x0 + velx*time;
+ double y = y0 + vely*time - 0.5*gravity*time*time;
+
+ QRect r = QRect( 0, 0, 6, 6 );
+ r.moveCenter( QPoint( qRound(x), height() - 1 - qRound(y) ) );
+ return r;
+}
+
+
+QRect CannonField::targetRect() const
+{
+ QRect r( 0, 0, 20, 10 );
+ r.moveCenter( QPoint(target.x(),height() - 1 - target.y()) );
+ return r;
+}
+
+
+bool CannonField::isShooting() const
+{
+ return autoShootTimer->isActive();
+}
+
+
+QSizePolicy CannonField::sizePolicy() const
+{
+ return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
+}
diff --git a/main/dependencies/qt3/tutorial/t13/cannon.h b/main/dependencies/qt3/tutorial/t13/cannon.h
new file mode 100644
index 000000000..ff1ff8252
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t13/cannon.h
@@ -0,0 +1,71 @@
+/****************************************************************
+**
+** Definition of CannonField class, Qt tutorial 13
+**
+****************************************************************/
+
+#ifndef CANNON_H
+#define CANNON_H
+
+class QTimer;
+
+
+#include <qwidget.h>
+
+
+class CannonField : public QWidget
+{
+ Q_OBJECT
+public:
+ CannonField( QWidget *parent=0, const char *name=0 );
+
+ int angle() const { return ang; }
+ int force() const { return f; }
+ bool gameOver() const { return gameEnded; }
+ bool isShooting() const;
+ QSizePolicy sizePolicy() const;
+
+public slots:
+ void setAngle( int degrees );
+ void setForce( int newton );
+ void shoot();
+ void newTarget();
+ void setGameOver();
+ void restartGame();
+
+private slots:
+ void moveShot();
+
+signals:
+ void hit();
+ void missed();
+ void angleChanged( int );
+ void forceChanged( int );
+ void canShoot( bool );
+
+protected:
+ void paintEvent( QPaintEvent * );
+
+private:
+ void paintShot( QPainter * );
+ void paintTarget( QPainter * );
+ void paintCannon( QPainter * );
+ QRect cannonRect() const;
+ QRect shotRect() const;
+ QRect targetRect() const;
+
+ int ang;
+ int f;
+
+ int timerCount;
+ QTimer * autoShootTimer;
+ float shoot_ang;
+ float shoot_f;
+
+ QPoint target;
+
+ bool gameEnded;
+};
+
+
+#endif // CANNON_H
diff --git a/main/dependencies/qt3/tutorial/t13/gamebrd.cpp b/main/dependencies/qt3/tutorial/t13/gamebrd.cpp
new file mode 100644
index 000000000..ffb322866
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t13/gamebrd.cpp
@@ -0,0 +1,129 @@
+/****************************************************************
+**
+** Implementation of GameBoard class, Qt tutorial 13
+**
+****************************************************************/
+
+#include "gamebrd.h"
+
+#include <qfont.h>
+#include <qapplication.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlcdnumber.h>
+#include <qlayout.h>
+
+#include "lcdrange.h"
+#include "cannon.h"
+
+GameBoard::GameBoard( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ QPushButton *quit = new QPushButton( "&Quit", this, "quit" );
+ quit->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+
+ LCDRange *angle = new LCDRange( "ANGLE", this, "angle" );
+ angle->setRange( 5, 70 );
+
+ LCDRange *force = new LCDRange( "FORCE", this, "force" );
+ force->setRange( 10, 50 );
+
+ cannonField = new CannonField( this, "cannonField" );
+
+ connect( angle, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setAngle(int)) );
+ connect( cannonField, SIGNAL(angleChanged(int)),
+ angle, SLOT(setValue(int)) );
+
+ connect( force, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setForce(int)) );
+ connect( cannonField, SIGNAL(forceChanged(int)),
+ force, SLOT(setValue(int)) );
+
+ connect( cannonField, SIGNAL(hit()),
+ this, SLOT(hit()) );
+ connect( cannonField, SIGNAL(missed()),
+ this, SLOT(missed()) );
+
+ QPushButton *shoot = new QPushButton( "&Shoot", this, "shoot" );
+ shoot->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( shoot, SIGNAL(clicked()), SLOT(fire()) );
+ connect( cannonField, SIGNAL(canShoot(bool)),
+ shoot, SLOT(setEnabled(bool)) );
+
+ QPushButton *restart
+ = new QPushButton( "&New Game", this, "newgame" );
+ restart->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( restart, SIGNAL(clicked()), this, SLOT(newGame()) );
+
+ hits = new QLCDNumber( 2, this, "hits" );
+ shotsLeft = new QLCDNumber( 2, this, "shotsleft" );
+ QLabel *hitsL = new QLabel( "HITS", this, "hitsLabel" );
+ QLabel *shotsLeftL
+ = new QLabel( "SHOTS LEFT", this, "shotsleftLabel" );
+
+ QGridLayout *grid = new QGridLayout( this, 2, 2, 10 );
+ grid->addWidget( quit, 0, 0 );
+ grid->addWidget( cannonField, 1, 1 );
+ grid->setColStretch( 1, 10 );
+
+ QVBoxLayout *leftBox = new QVBoxLayout;
+ grid->addLayout( leftBox, 1, 0 );
+ leftBox->addWidget( angle );
+ leftBox->addWidget( force );
+
+ QHBoxLayout *topBox = new QHBoxLayout;
+ grid->addLayout( topBox, 0, 1 );
+ topBox->addWidget( shoot );
+ topBox->addWidget( hits );
+ topBox->addWidget( hitsL );
+ topBox->addWidget( shotsLeft );
+ topBox->addWidget( shotsLeftL );
+ topBox->addStretch( 1 );
+ topBox->addWidget( restart );
+
+ angle->setValue( 60 );
+ force->setValue( 25 );
+ angle->setFocus();
+
+ newGame();
+}
+
+
+void GameBoard::fire()
+{
+ if ( cannonField->gameOver() || cannonField->isShooting() )
+ return;
+ shotsLeft->display( shotsLeft->intValue() - 1 );
+ cannonField->shoot();
+}
+
+
+void GameBoard::hit()
+{
+ hits->display( hits->intValue() + 1 );
+ if ( shotsLeft->intValue() == 0 )
+ cannonField->setGameOver();
+ else
+ cannonField->newTarget();
+}
+
+
+void GameBoard::missed()
+{
+ if ( shotsLeft->intValue() == 0 )
+ cannonField->setGameOver();
+}
+
+
+void GameBoard::newGame()
+{
+ shotsLeft->display( 15 );
+ hits->display( 0 );
+ cannonField->restartGame();
+ cannonField->newTarget();
+}
diff --git a/main/dependencies/qt3/tutorial/t13/gamebrd.h b/main/dependencies/qt3/tutorial/t13/gamebrd.h
new file mode 100644
index 000000000..1c629a487
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t13/gamebrd.h
@@ -0,0 +1,40 @@
+/****************************************************************
+**
+** Definition of GameBoard class, Qt tutorial 13
+**
+****************************************************************/
+
+#ifndef GAMEBRD_H
+#define GAMEBRD_H
+
+#include <qwidget.h>
+
+class QPushButton;
+class LCDRange;
+class QLCDNumber;
+class CannonField;
+
+#include "lcdrange.h"
+#include "cannon.h"
+
+
+class GameBoard : public QWidget
+{
+ Q_OBJECT
+public:
+ GameBoard( QWidget *parent=0, const char *name=0 );
+
+protected slots:
+ void fire();
+ void hit();
+ void missed();
+ void newGame();
+
+private:
+ QLCDNumber *hits;
+ QLCDNumber *shotsLeft;
+ CannonField *cannonField;
+};
+
+
+#endif // GAMEBRD_H
diff --git a/main/dependencies/qt3/tutorial/t13/lcdrange.cpp b/main/dependencies/qt3/tutorial/t13/lcdrange.cpp
new file mode 100644
index 000000000..3c91b2790
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t13/lcdrange.cpp
@@ -0,0 +1,88 @@
+/****************************************************************
+**
+** Implementation of LCDRange class, Qt tutorial 12
+**
+****************************************************************/
+
+#include "lcdrange.h"
+
+#include <qslider.h>
+#include <qlcdnumber.h>
+#include <qlabel.h>
+#include <qlayout.h>
+
+
+LCDRange::LCDRange( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ init();
+}
+
+
+LCDRange::LCDRange( const char *s, QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ init();
+ setText( s );
+}
+
+
+void LCDRange::init()
+{
+ QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
+ slider = new QSlider( Horizontal, this, "slider" );
+ slider->setRange( 0, 99 );
+ slider->setValue( 0 );
+
+ label = new QLabel( " ", this, "label" );
+ label->setAlignment( AlignCenter );
+
+ connect( slider, SIGNAL(valueChanged(int)),
+ lcd, SLOT(display(int)) );
+ connect( slider, SIGNAL(valueChanged(int)),
+ SIGNAL(valueChanged(int)) );
+
+ setFocusProxy( slider );
+
+ QVBoxLayout * l = new QVBoxLayout( this );
+ l->addWidget( lcd, 1 );
+ l->addWidget( slider );
+ l->addWidget( label );
+}
+
+
+int LCDRange::value() const
+{
+ return slider->value();
+}
+
+
+const char *LCDRange::text() const
+{
+ return label->text();
+}
+
+
+void LCDRange::setValue( int value )
+{
+ slider->setValue( value );
+}
+
+
+void LCDRange::setRange( int minVal, int maxVal )
+{
+ if ( minVal < 0 || maxVal > 99 || minVal > maxVal ) {
+ qWarning( "LCDRange::setRange(%d,%d)\n"
+ "\tRange must be 0..99\n"
+ "\tand minVal must not be greater than maxVal",
+ minVal, maxVal );
+ return;
+ }
+ slider->setRange( minVal, maxVal );
+}
+
+
+void LCDRange::setText( const char *s )
+{
+ label->setText( s );
+}
diff --git a/main/dependencies/qt3/tutorial/t13/lcdrange.h b/main/dependencies/qt3/tutorial/t13/lcdrange.h
new file mode 100644
index 000000000..2df2686cc
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t13/lcdrange.h
@@ -0,0 +1,42 @@
+/****************************************************************
+**
+** Definition of LCDRange class, Qt tutorial 12
+**
+****************************************************************/
+
+#ifndef LCDRANGE_H
+#define LCDRANGE_H
+
+#include <qwidget.h>
+
+class QSlider;
+class QLabel;
+
+
+class LCDRange : public QWidget
+{
+ Q_OBJECT
+public:
+ LCDRange( QWidget *parent=0, const char *name=0 );
+ LCDRange( const char *s, QWidget *parent=0, const char *name=0 );
+
+ int value() const;
+ const char *text() const;
+
+public slots:
+ void setValue( int );
+ void setRange( int minVal, int maxVal );
+ void setText( const char * );
+
+signals:
+ void valueChanged( int );
+
+private:
+ void init();
+
+ QSlider *slider;
+ QLabel *label;
+};
+
+
+#endif // LCDRANGE_H
diff --git a/main/dependencies/qt3/tutorial/t13/main.cpp b/main/dependencies/qt3/tutorial/t13/main.cpp
new file mode 100644
index 000000000..63f4ea7c3
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t13/main.cpp
@@ -0,0 +1,22 @@
+/****************************************************************
+**
+** Qt tutorial 13
+**
+****************************************************************/
+
+#include <qapplication.h>
+
+#include "gamebrd.h"
+
+
+int main( int argc, char **argv )
+{
+ QApplication::setColorSpec( QApplication::CustomColor );
+ QApplication a( argc, argv );
+
+ GameBoard gb;
+ gb.setGeometry( 100, 100, 500, 355 );
+ a.setMainWidget( &gb );
+ gb.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t13/t13.pro b/main/dependencies/qt3/tutorial/t13/t13.pro
new file mode 100644
index 000000000..a670da605
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t13/t13.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS = cannon.h \
+ gamebrd.h \
+ lcdrange.h
+SOURCES = cannon.cpp \
+ gamebrd.cpp \
+ lcdrange.cpp \
+ main.cpp
+TARGET = t13
+REQUIRES=full-config
+unix:LIBS += -lm
+
diff --git a/main/dependencies/qt3/tutorial/t14/cannon.cpp b/main/dependencies/qt3/tutorial/t14/cannon.cpp
new file mode 100644
index 000000000..6757fdcba
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t14/cannon.cpp
@@ -0,0 +1,292 @@
+/****************************************************************
+**
+** Implementation CannonField class, Qt tutorial 14
+**
+****************************************************************/
+
+#include "cannon.h"
+#include <qtimer.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qdatetime.h>
+
+#include <math.h>
+#include <stdlib.h>
+
+
+CannonField::CannonField( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ ang = 45;
+ f = 0;
+ timerCount = 0;
+ autoShootTimer = new QTimer( this, "movement handler" );
+ connect( autoShootTimer, SIGNAL(timeout()),
+ this, SLOT(moveShot()) );
+ shoot_ang = 0;
+ shoot_f = 0;
+ target = QPoint( 0, 0 );
+ gameEnded = FALSE;
+ barrelPressed = FALSE;
+ setPalette( QPalette( QColor( 250, 250, 200) ) );
+ newTarget();
+}
+
+
+void CannonField::setAngle( int degrees )
+{
+ if ( degrees < 5 )
+ degrees = 5;
+ if ( degrees > 70 )
+ degrees = 70;
+ if ( ang == degrees )
+ return;
+ ang = degrees;
+ repaint( cannonRect(), FALSE );
+ emit angleChanged( ang );
+}
+
+
+void CannonField::setForce( int newton )
+{
+ if ( newton < 0 )
+ newton = 0;
+ if ( f == newton )
+ return;
+ f = newton;
+ emit forceChanged( f );
+}
+
+
+void CannonField::shoot()
+{
+ if ( isShooting() )
+ return;
+ timerCount = 0;
+ shoot_ang = ang;
+ shoot_f = f;
+ autoShootTimer->start( 50 );
+ emit canShoot( FALSE );
+}
+
+
+void CannonField::newTarget()
+{
+ static bool first_time = TRUE;
+ if ( first_time ) {
+ first_time = FALSE;
+ QTime midnight( 0, 0, 0 );
+ srand( midnight.secsTo(QTime::currentTime()) );
+ }
+ QRegion r( targetRect() );
+ target = QPoint( 200 + rand() % 190,
+ 10 + rand() % 255 );
+ repaint( r.unite( targetRect() ) );
+}
+
+void CannonField::setGameOver()
+{
+ if ( gameEnded )
+ return;
+ if ( isShooting() )
+ autoShootTimer->stop();
+ gameEnded = TRUE;
+ repaint();
+}
+
+void CannonField::restartGame()
+{
+ if ( isShooting() )
+ autoShootTimer->stop();
+ gameEnded = FALSE;
+ repaint();
+ emit canShoot( TRUE );
+}
+
+void CannonField::moveShot()
+{
+ QRegion r( shotRect() );
+ timerCount++;
+
+ QRect shotR = shotRect();
+
+ if ( shotR.intersects( targetRect() ) ) {
+ autoShootTimer->stop();
+ emit hit();
+ emit canShoot( TRUE );
+ } else if ( shotR.x() > width() || shotR.y() > height() ||
+ shotR.intersects(barrierRect()) ) {
+ autoShootTimer->stop();
+ emit missed();
+ emit canShoot( TRUE );
+ } else {
+ r = r.unite( QRegion( shotR ) );
+ }
+
+ repaint( r );
+}
+
+
+void CannonField::mousePressEvent( QMouseEvent *e )
+{
+ if ( e->button() != LeftButton )
+ return;
+ if ( barrelHit( e->pos() ) )
+ barrelPressed = TRUE;
+}
+
+
+void CannonField::mouseMoveEvent( QMouseEvent *e )
+{
+ if ( !barrelPressed )
+ return;
+ QPoint pnt = e->pos();
+ if ( pnt.x() <= 0 )
+ pnt.setX( 1 );
+ if ( pnt.y() >= height() )
+ pnt.setY( height() - 1 );
+ double rad = atan(((double)rect().bottom()-pnt.y())/pnt.x());
+ setAngle( qRound ( rad*180/3.14159265 ) );
+}
+
+
+void CannonField::mouseReleaseEvent( QMouseEvent *e )
+{
+ if ( e->button() == LeftButton )
+ barrelPressed = FALSE;
+}
+
+
+void CannonField::paintEvent( QPaintEvent *e )
+{
+ QRect updateR = e->rect();
+ QPainter p( this );
+
+ if ( gameEnded ) {
+ p.setPen( black );
+ p.setFont( QFont( "Courier", 48, QFont::Bold ) );
+ p.drawText( rect(), AlignCenter, "Game Over" );
+ }
+ if ( updateR.intersects( cannonRect() ) )
+ paintCannon( &p );
+ if ( updateR.intersects( barrierRect() ) )
+ paintBarrier( &p );
+ if ( isShooting() && updateR.intersects( shotRect() ) )
+ paintShot( &p );
+ if ( !gameEnded && updateR.intersects( targetRect() ) )
+ paintTarget( &p );
+}
+
+void CannonField::paintShot( QPainter *p )
+{
+ p->setBrush( black );
+ p->setPen( NoPen );
+ p->drawRect( shotRect() );
+}
+
+
+void CannonField::paintTarget( QPainter *p )
+{
+ p->setBrush( red );
+ p->setPen( black );
+ p->drawRect( targetRect() );
+}
+
+void CannonField::paintBarrier( QPainter *p )
+{
+ p->setBrush( yellow );
+ p->setPen( black );
+ p->drawRect( barrierRect() );
+}
+
+const QRect barrelRect(33, -4, 15, 8);
+
+void CannonField::paintCannon( QPainter *p )
+{
+ QRect cr = cannonRect();
+ QPixmap pix( cr.size() );
+ pix.fill( this, cr.topLeft() );
+
+ QPainter tmp( &pix );
+ tmp.setBrush( blue );
+ tmp.setPen( NoPen );
+
+ tmp.translate( 0, pix.height() - 1 );
+ tmp.drawPie( QRect( -35,-35, 70, 70 ), 0, 90*16 );
+ tmp.rotate( -ang );
+ tmp.drawRect( barrelRect );
+ tmp.end();
+
+ p->drawPixmap( cr.topLeft(), pix );
+}
+
+
+QRect CannonField::cannonRect() const
+{
+ QRect r( 0, 0, 50, 50 );
+ r.moveBottomLeft( rect().bottomLeft() );
+ return r;
+}
+
+
+QRect CannonField::shotRect() const
+{
+ const double gravity = 4;
+
+ double time = timerCount / 4.0;
+ double velocity = shoot_f;
+ double radians = shoot_ang*3.14159265/180;
+
+ double velx = velocity*cos( radians );
+ double vely = velocity*sin( radians );
+ double x0 = ( barrelRect.right() + 5 )*cos(radians);
+ double y0 = ( barrelRect.right() + 5 )*sin(radians);
+ double x = x0 + velx*time;
+ double y = y0 + vely*time - 0.5*gravity*time*time;
+
+ QRect r = QRect( 0, 0, 6, 6 );
+ r.moveCenter( QPoint( qRound(x), height() - 1 - qRound(y) ) );
+ return r;
+}
+
+
+QRect CannonField::targetRect() const
+{
+ QRect r( 0, 0, 20, 10 );
+ r.moveCenter( QPoint(target.x(),height() - 1 - target.y()) );
+ return r;
+}
+
+
+QRect CannonField::barrierRect() const
+{
+ return QRect( 145, height() - 100, 15, 100 );
+}
+
+
+bool CannonField::barrelHit( const QPoint &p ) const
+{
+ QWMatrix mtx;
+ mtx.translate( 0, height() - 1 );
+ mtx.rotate( -ang );
+ mtx = mtx.invert();
+ return barrelRect.contains( mtx.map(p) );
+}
+
+
+bool CannonField::isShooting() const
+{
+ return autoShootTimer->isActive();
+}
+
+
+QSize CannonField::sizeHint() const
+{
+ return QSize( 400, 300 );
+}
+
+
+QSizePolicy CannonField::sizePolicy() const
+{
+ return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
+}
diff --git a/main/dependencies/qt3/tutorial/t14/cannon.h b/main/dependencies/qt3/tutorial/t14/cannon.h
new file mode 100644
index 000000000..1f46c7168
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t14/cannon.h
@@ -0,0 +1,79 @@
+/****************************************************************
+**
+** Definition of CannonField class, Qt tutorial 14
+**
+****************************************************************/
+
+#ifndef CANNON_H
+#define CANNON_H
+
+class QTimer;
+
+
+#include <qwidget.h>
+
+
+class CannonField : public QWidget
+{
+ Q_OBJECT
+public:
+ CannonField( QWidget *parent=0, const char *name=0 );
+
+ int angle() const { return ang; }
+ int force() const { return f; }
+ bool gameOver() const { return gameEnded; }
+ bool isShooting() const;
+ QSize sizeHint() const;
+ QSizePolicy sizePolicy() const;
+
+public slots:
+ void setAngle( int degrees );
+ void setForce( int newton );
+ void shoot();
+ void newTarget();
+ void setGameOver();
+ void restartGame();
+
+private slots:
+ void moveShot();
+
+signals:
+ void hit();
+ void missed();
+ void angleChanged( int );
+ void forceChanged( int );
+ void canShoot( bool );
+
+protected:
+ void paintEvent( QPaintEvent * );
+ void mousePressEvent( QMouseEvent * );
+ void mouseMoveEvent( QMouseEvent * );
+ void mouseReleaseEvent( QMouseEvent * );
+
+private:
+ void paintShot( QPainter * );
+ void paintTarget( QPainter * );
+ void paintBarrier( QPainter * );
+ void paintCannon( QPainter * );
+ QRect cannonRect() const;
+ QRect shotRect() const;
+ QRect targetRect() const;
+ QRect barrierRect() const;
+ bool barrelHit( const QPoint & ) const;
+
+ int ang;
+ int f;
+
+ int timerCount;
+ QTimer * autoShootTimer;
+ float shoot_ang;
+ float shoot_f;
+
+ QPoint target;
+
+ bool gameEnded;
+ bool barrelPressed;
+};
+
+
+#endif // CANNON_H
diff --git a/main/dependencies/qt3/tutorial/t14/gamebrd.cpp b/main/dependencies/qt3/tutorial/t14/gamebrd.cpp
new file mode 100644
index 000000000..6f613b2b7
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t14/gamebrd.cpp
@@ -0,0 +1,143 @@
+/****************************************************************
+**
+** Implementation of GameBoard class, Qt tutorial 14
+**
+****************************************************************/
+
+#include "gamebrd.h"
+
+#include <qfont.h>
+#include <qapplication.h>
+#include <qlabel.h>
+#include <qaccel.h>
+#include <qpushbutton.h>
+#include <qlcdnumber.h>
+#include <qlayout.h>
+#include <qvbox.h>
+
+#include "lcdrange.h"
+#include "cannon.h"
+
+GameBoard::GameBoard( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ QPushButton *quit = new QPushButton( "&Quit", this, "quit" );
+ quit->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+
+ LCDRange *angle = new LCDRange( "ANGLE", this, "angle" );
+ angle->setRange( 5, 70 );
+
+ LCDRange *force = new LCDRange( "FORCE", this, "force" );
+ force->setRange( 10, 50 );
+
+ QVBox *box = new QVBox( this, "cannonFrame" );
+ box->setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
+
+ cannonField = new CannonField( box, "cannonField" );
+
+ connect( angle, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setAngle(int)) );
+ connect( cannonField, SIGNAL(angleChanged(int)),
+ angle, SLOT(setValue(int)) );
+
+ connect( force, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setForce(int)) );
+ connect( cannonField, SIGNAL(forceChanged(int)),
+ force, SLOT(setValue(int)) );
+
+ connect( cannonField, SIGNAL(hit()),
+ this, SLOT(hit()) );
+ connect( cannonField, SIGNAL(missed()),
+ this, SLOT(missed()) );
+
+ QPushButton *shoot = new QPushButton( "&Shoot", this, "shoot" );
+ shoot->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( shoot, SIGNAL(clicked()), SLOT(fire()) );
+
+ connect( cannonField, SIGNAL(canShoot(bool)),
+ shoot, SLOT(setEnabled(bool)) );
+
+ QPushButton *restart
+ = new QPushButton( "&New Game", this, "newgame" );
+ restart->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( restart, SIGNAL(clicked()), this, SLOT(newGame()) );
+
+ hits = new QLCDNumber( 2, this, "hits" );
+ shotsLeft = new QLCDNumber( 2, this, "shotsleft" );
+ QLabel *hitsL = new QLabel( "HITS", this, "hitsLabel" );
+ QLabel *shotsLeftL
+ = new QLabel( "SHOTS LEFT", this, "shotsleftLabel" );
+
+ QAccel *accel = new QAccel( this );
+ accel->connectItem( accel->insertItem( Key_Enter ),
+ this, SLOT(fire()) );
+ accel->connectItem( accel->insertItem( Key_Return ),
+ this, SLOT(fire()) );
+ accel->connectItem( accel->insertItem( CTRL+Key_Q ),
+ qApp, SLOT(quit()) );
+
+ QGridLayout *grid = new QGridLayout( this, 2, 2, 10 );
+ grid->addWidget( quit, 0, 0 );
+ grid->addWidget( box, 1, 1 );
+ grid->setColStretch( 1, 10 );
+
+ QVBoxLayout *leftBox = new QVBoxLayout;
+ grid->addLayout( leftBox, 1, 0 );
+ leftBox->addWidget( angle );
+ leftBox->addWidget( force );
+
+ QHBoxLayout *topBox = new QHBoxLayout;
+ grid->addLayout( topBox, 0, 1 );
+ topBox->addWidget( shoot );
+ topBox->addWidget( hits );
+ topBox->addWidget( hitsL );
+ topBox->addWidget( shotsLeft );
+ topBox->addWidget( shotsLeftL );
+ topBox->addStretch( 1 );
+ topBox->addWidget( restart );
+
+ angle->setValue( 60 );
+ force->setValue( 25 );
+ angle->setFocus();
+
+ newGame();
+}
+
+
+void GameBoard::fire()
+{
+ if ( cannonField->gameOver() || cannonField->isShooting() )
+ return;
+ shotsLeft->display( shotsLeft->intValue() - 1 );
+ cannonField->shoot();
+}
+
+
+void GameBoard::hit()
+{
+ hits->display( hits->intValue() + 1 );
+ if ( shotsLeft->intValue() == 0 )
+ cannonField->setGameOver();
+ else
+ cannonField->newTarget();
+}
+
+
+void GameBoard::missed()
+{
+ if ( shotsLeft->intValue() == 0 )
+ cannonField->setGameOver();
+}
+
+
+void GameBoard::newGame()
+{
+ shotsLeft->display( 15 );
+ hits->display( 0 );
+ cannonField->restartGame();
+ cannonField->newTarget();
+}
diff --git a/main/dependencies/qt3/tutorial/t14/gamebrd.h b/main/dependencies/qt3/tutorial/t14/gamebrd.h
new file mode 100644
index 000000000..990263902
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t14/gamebrd.h
@@ -0,0 +1,40 @@
+/****************************************************************
+**
+** Definition of GameBoard class, Qt tutorial 14
+**
+****************************************************************/
+
+#ifndef GAMEBRD_H
+#define GAMEBRD_H
+
+#include <qwidget.h>
+
+class QPushButton;
+class LCDRange;
+class QLCDNumber;
+class CannonField;
+
+#include "lcdrange.h"
+#include "cannon.h"
+
+
+class GameBoard : public QWidget
+{
+ Q_OBJECT
+public:
+ GameBoard( QWidget *parent=0, const char *name=0 );
+
+protected slots:
+ void fire();
+ void hit();
+ void missed();
+ void newGame();
+
+private:
+ QLCDNumber *hits;
+ QLCDNumber *shotsLeft;
+ CannonField *cannonField;
+};
+
+
+#endif // GAMEBRD_H
diff --git a/main/dependencies/qt3/tutorial/t14/lcdrange.cpp b/main/dependencies/qt3/tutorial/t14/lcdrange.cpp
new file mode 100644
index 000000000..3c91b2790
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t14/lcdrange.cpp
@@ -0,0 +1,88 @@
+/****************************************************************
+**
+** Implementation of LCDRange class, Qt tutorial 12
+**
+****************************************************************/
+
+#include "lcdrange.h"
+
+#include <qslider.h>
+#include <qlcdnumber.h>
+#include <qlabel.h>
+#include <qlayout.h>
+
+
+LCDRange::LCDRange( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ init();
+}
+
+
+LCDRange::LCDRange( const char *s, QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ init();
+ setText( s );
+}
+
+
+void LCDRange::init()
+{
+ QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
+ slider = new QSlider( Horizontal, this, "slider" );
+ slider->setRange( 0, 99 );
+ slider->setValue( 0 );
+
+ label = new QLabel( " ", this, "label" );
+ label->setAlignment( AlignCenter );
+
+ connect( slider, SIGNAL(valueChanged(int)),
+ lcd, SLOT(display(int)) );
+ connect( slider, SIGNAL(valueChanged(int)),
+ SIGNAL(valueChanged(int)) );
+
+ setFocusProxy( slider );
+
+ QVBoxLayout * l = new QVBoxLayout( this );
+ l->addWidget( lcd, 1 );
+ l->addWidget( slider );
+ l->addWidget( label );
+}
+
+
+int LCDRange::value() const
+{
+ return slider->value();
+}
+
+
+const char *LCDRange::text() const
+{
+ return label->text();
+}
+
+
+void LCDRange::setValue( int value )
+{
+ slider->setValue( value );
+}
+
+
+void LCDRange::setRange( int minVal, int maxVal )
+{
+ if ( minVal < 0 || maxVal > 99 || minVal > maxVal ) {
+ qWarning( "LCDRange::setRange(%d,%d)\n"
+ "\tRange must be 0..99\n"
+ "\tand minVal must not be greater than maxVal",
+ minVal, maxVal );
+ return;
+ }
+ slider->setRange( minVal, maxVal );
+}
+
+
+void LCDRange::setText( const char *s )
+{
+ label->setText( s );
+}
diff --git a/main/dependencies/qt3/tutorial/t14/lcdrange.h b/main/dependencies/qt3/tutorial/t14/lcdrange.h
new file mode 100644
index 000000000..2df2686cc
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t14/lcdrange.h
@@ -0,0 +1,42 @@
+/****************************************************************
+**
+** Definition of LCDRange class, Qt tutorial 12
+**
+****************************************************************/
+
+#ifndef LCDRANGE_H
+#define LCDRANGE_H
+
+#include <qwidget.h>
+
+class QSlider;
+class QLabel;
+
+
+class LCDRange : public QWidget
+{
+ Q_OBJECT
+public:
+ LCDRange( QWidget *parent=0, const char *name=0 );
+ LCDRange( const char *s, QWidget *parent=0, const char *name=0 );
+
+ int value() const;
+ const char *text() const;
+
+public slots:
+ void setValue( int );
+ void setRange( int minVal, int maxVal );
+ void setText( const char * );
+
+signals:
+ void valueChanged( int );
+
+private:
+ void init();
+
+ QSlider *slider;
+ QLabel *label;
+};
+
+
+#endif // LCDRANGE_H
diff --git a/main/dependencies/qt3/tutorial/t14/main.cpp b/main/dependencies/qt3/tutorial/t14/main.cpp
new file mode 100644
index 000000000..8434413d7
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t14/main.cpp
@@ -0,0 +1,22 @@
+/****************************************************************
+**
+** Qt tutorial 14
+**
+****************************************************************/
+
+#include <qapplication.h>
+
+#include "gamebrd.h"
+
+
+int main( int argc, char **argv )
+{
+ QApplication::setColorSpec( QApplication::CustomColor );
+ QApplication a( argc, argv );
+
+ GameBoard gb;
+ gb.setGeometry( 100, 100, 500, 355 );
+ a.setMainWidget( &gb );
+ gb.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t14/t14.pro b/main/dependencies/qt3/tutorial/t14/t14.pro
new file mode 100644
index 000000000..665b7844f
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t14/t14.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS = cannon.h \
+ gamebrd.h \
+ lcdrange.h
+SOURCES = cannon.cpp \
+ gamebrd.cpp \
+ lcdrange.cpp \
+ main.cpp
+TARGET = t14
+REQUIRES=full-config
+unix:LIBS += -lm
diff --git a/main/dependencies/qt3/tutorial/t2/main.cpp b/main/dependencies/qt3/tutorial/t2/main.cpp
new file mode 100644
index 000000000..b1a2bb1ef
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t2/main.cpp
@@ -0,0 +1,25 @@
+/****************************************************************
+**
+** Qt tutorial 2
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qfont.h>
+
+
+int main( int argc, char **argv )
+{
+ QApplication a( argc, argv );
+
+ QPushButton quit( "Quit", 0 );
+ quit.resize( 75, 30 );
+ quit.setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ QObject::connect( &quit, SIGNAL(clicked()), &a, SLOT(quit()) );
+
+ a.setMainWidget( &quit );
+ quit.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t2/t2.pro b/main/dependencies/qt3/tutorial/t2/t2.pro
new file mode 100644
index 000000000..bf4781b5f
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t2/t2.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS =
+SOURCES = main.cpp
+TARGET = t2
+REQUIRES=small-config
diff --git a/main/dependencies/qt3/tutorial/t3/main.cpp b/main/dependencies/qt3/tutorial/t3/main.cpp
new file mode 100644
index 000000000..5a02240f4
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t3/main.cpp
@@ -0,0 +1,28 @@
+/****************************************************************
+**
+** Qt tutorial 3
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qfont.h>
+#include <qvbox.h>
+
+int main( int argc, char **argv )
+{
+ QApplication a( argc, argv );
+
+ QVBox box;
+ box.resize( 200, 120 );
+
+ QPushButton quit( "Quit", &box );
+ quit.setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ QObject::connect( &quit, SIGNAL(clicked()), &a, SLOT(quit()) );
+
+ a.setMainWidget( &box );
+ box.show();
+
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t3/t3.pro b/main/dependencies/qt3/tutorial/t3/t3.pro
new file mode 100644
index 000000000..8d1f69407
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t3/t3.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS =
+SOURCES = main.cpp
+TARGET = t3
+REQUIRES=small-config
diff --git a/main/dependencies/qt3/tutorial/t4/main.cpp b/main/dependencies/qt3/tutorial/t4/main.cpp
new file mode 100644
index 000000000..3a39c0001
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t4/main.cpp
@@ -0,0 +1,42 @@
+/****************************************************************
+**
+** Qt tutorial 4
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qfont.h>
+
+
+class MyWidget : public QWidget
+{
+public:
+ MyWidget( QWidget *parent=0, const char *name=0 );
+};
+
+
+MyWidget::MyWidget( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ setMinimumSize( 200, 120 );
+ setMaximumSize( 200, 120 );
+
+ QPushButton *quit = new QPushButton( "Quit", this, "quit" );
+ quit->setGeometry( 62, 40, 75, 30 );
+ quit->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+}
+
+
+int main( int argc, char **argv )
+{
+ QApplication a( argc, argv );
+
+ MyWidget w;
+ w.setGeometry( 100, 100, 200, 120 );
+ a.setMainWidget( &w );
+ w.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t4/t4.pro b/main/dependencies/qt3/tutorial/t4/t4.pro
new file mode 100644
index 000000000..4688fe411
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t4/t4.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS =
+SOURCES = main.cpp
+TARGET = t4
+REQUIRES=small-config
diff --git a/main/dependencies/qt3/tutorial/t5/main.cpp b/main/dependencies/qt3/tutorial/t5/main.cpp
new file mode 100644
index 000000000..a538a8265
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t5/main.cpp
@@ -0,0 +1,47 @@
+/****************************************************************
+**
+** Qt tutorial 5
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qslider.h>
+#include <qlcdnumber.h>
+#include <qfont.h>
+
+#include <qvbox.h>
+
+class MyWidget : public QVBox
+{
+public:
+ MyWidget( QWidget *parent=0, const char *name=0 );
+};
+
+
+MyWidget::MyWidget( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ QPushButton *quit = new QPushButton( "Quit", this, "quit" );
+ quit->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+
+ QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
+
+ QSlider * slider = new QSlider( Horizontal, this, "slider" );
+ slider->setRange( 0, 99 );
+ slider->setValue( 0 );
+
+ connect( slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)) );
+}
+
+int main( int argc, char **argv )
+{
+ QApplication a( argc, argv );
+
+ MyWidget w;
+ a.setMainWidget( &w );
+ w.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t5/t5.pro b/main/dependencies/qt3/tutorial/t5/t5.pro
new file mode 100644
index 000000000..3ddf02c88
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t5/t5.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS =
+SOURCES = main.cpp
+TARGET = t5
+REQUIRES=large-config
diff --git a/main/dependencies/qt3/tutorial/t6/main.cpp b/main/dependencies/qt3/tutorial/t6/main.cpp
new file mode 100644
index 000000000..a649893ab
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t6/main.cpp
@@ -0,0 +1,61 @@
+/****************************************************************
+**
+** Qt tutorial 6
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qslider.h>
+#include <qlcdnumber.h>
+#include <qfont.h>
+#include <qvbox.h>
+#include <qgrid.h>
+
+class LCDRange : public QVBox
+{
+public:
+ LCDRange( QWidget *parent=0, const char *name=0 );
+};
+
+LCDRange::LCDRange( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
+ QSlider * slider = new QSlider( Horizontal, this, "slider" );
+ slider->setRange( 0, 99 );
+ slider->setValue( 0 );
+ connect( slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)) );
+}
+
+class MyWidget : public QVBox
+{
+public:
+ MyWidget( QWidget *parent=0, const char *name=0 );
+};
+
+
+MyWidget::MyWidget( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ QPushButton *quit = new QPushButton( "Quit", this, "quit" );
+ quit->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+
+ QGrid *grid = new QGrid( 4, this );
+
+ for( int r = 0 ; r < 4 ; r++ )
+ for( int c = 0 ; c < 4 ; c++ )
+ (void)new LCDRange( grid );
+}
+
+int main( int argc, char **argv )
+{
+ QApplication a( argc, argv );
+
+ MyWidget w;
+ a.setMainWidget( &w );
+ w.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t6/t6.pro b/main/dependencies/qt3/tutorial/t6/t6.pro
new file mode 100644
index 000000000..19dba8e91
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t6/t6.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS =
+SOURCES = main.cpp
+TARGET = t6
+REQUIRES=large-config
diff --git a/main/dependencies/qt3/tutorial/t7/lcdrange.cpp b/main/dependencies/qt3/tutorial/t7/lcdrange.cpp
new file mode 100644
index 000000000..defa1335e
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t7/lcdrange.cpp
@@ -0,0 +1,33 @@
+/****************************************************************
+**
+** Implementation of LCDRange class, Qt tutorial 7
+**
+****************************************************************/
+
+#include "lcdrange.h"
+
+#include <qslider.h>
+#include <qlcdnumber.h>
+
+LCDRange::LCDRange( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
+ slider = new QSlider( Horizontal, this, "slider" );
+ slider->setRange( 0, 99 );
+ slider->setValue( 0 );
+ connect( slider, SIGNAL(valueChanged(int)),
+ lcd, SLOT(display(int)) );
+ connect( slider, SIGNAL(valueChanged(int)),
+ SIGNAL(valueChanged(int)) );
+}
+
+int LCDRange::value() const
+{
+ return slider->value();
+}
+
+void LCDRange::setValue( int value )
+{
+ slider->setValue( value );
+}
diff --git a/main/dependencies/qt3/tutorial/t7/lcdrange.h b/main/dependencies/qt3/tutorial/t7/lcdrange.h
new file mode 100644
index 000000000..0c0219b1b
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t7/lcdrange.h
@@ -0,0 +1,34 @@
+/****************************************************************
+**
+** Definition of LCDRange class, Qt tutorial 7
+**
+****************************************************************/
+
+#ifndef LCDRANGE_H
+#define LCDRANGE_H
+
+#include <qvbox.h>
+
+class QSlider;
+
+
+class LCDRange : public QVBox
+{
+ Q_OBJECT
+public:
+ LCDRange( QWidget *parent=0, const char *name=0 );
+
+ int value() const;
+
+public slots:
+ void setValue( int );
+
+signals:
+ void valueChanged( int );
+
+private:
+ QSlider *slider;
+};
+
+
+#endif // LCDRANGE_H
diff --git a/main/dependencies/qt3/tutorial/t7/main.cpp b/main/dependencies/qt3/tutorial/t7/main.cpp
new file mode 100644
index 000000000..385fd3b8d
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t7/main.cpp
@@ -0,0 +1,55 @@
+/****************************************************************
+**
+** Qt tutorial 7
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qlcdnumber.h>
+#include <qfont.h>
+#include <qvbox.h>
+#include <qgrid.h>
+
+#include "lcdrange.h"
+
+
+class MyWidget : public QVBox
+{
+public:
+ MyWidget( QWidget *parent=0, const char *name=0 );
+};
+
+
+MyWidget::MyWidget( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ QPushButton *quit = new QPushButton( "Quit", this, "quit" );
+ quit->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+
+ QGrid *grid = new QGrid( 4, this );
+
+ LCDRange *previous = 0;
+ for( int r = 0 ; r < 4 ; r++ ) {
+ for( int c = 0 ; c < 4 ; c++ ) {
+ LCDRange* lr = new LCDRange( grid );
+ if ( previous )
+ connect( lr, SIGNAL(valueChanged(int)),
+ previous, SLOT(setValue(int)) );
+ previous = lr;
+ }
+ }
+}
+
+
+int main( int argc, char **argv )
+{
+ QApplication a( argc, argv );
+
+ MyWidget w;
+ a.setMainWidget( &w );
+ w.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t7/t7.pro b/main/dependencies/qt3/tutorial/t7/t7.pro
new file mode 100644
index 000000000..f83e7cd9c
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t7/t7.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS = lcdrange.h
+SOURCES = lcdrange.cpp \
+ main.cpp
+TARGET = t7
+REQUIRES=large-config
diff --git a/main/dependencies/qt3/tutorial/t8/cannon.cpp b/main/dependencies/qt3/tutorial/t8/cannon.cpp
new file mode 100644
index 000000000..fd9d2032e
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t8/cannon.cpp
@@ -0,0 +1,45 @@
+/****************************************************************
+**
+** Implementation CannonField class, Qt tutorial 8
+**
+****************************************************************/
+
+#include "cannon.h"
+#include <qpainter.h>
+
+
+CannonField::CannonField( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ ang = 45;
+ setPalette( QPalette( QColor( 250, 250, 200) ) );
+}
+
+
+void CannonField::setAngle( int degrees )
+{
+ if ( degrees < 5 )
+ degrees = 5;
+ if ( degrees > 70 )
+ degrees = 70;
+ if ( ang == degrees )
+ return;
+ ang = degrees;
+ repaint();
+ emit angleChanged( ang );
+}
+
+
+void CannonField::paintEvent( QPaintEvent * )
+{
+ QString s = "Angle = " + QString::number( ang );
+ QPainter p( this );
+ p.drawText( 200, 200, s );
+}
+
+
+QSizePolicy CannonField::sizePolicy() const
+{
+ return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
+}
+
diff --git a/main/dependencies/qt3/tutorial/t8/cannon.h b/main/dependencies/qt3/tutorial/t8/cannon.h
new file mode 100644
index 000000000..a0928cde1
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t8/cannon.h
@@ -0,0 +1,36 @@
+/****************************************************************
+**
+** Definition of CannonField class, Qt tutorial 8
+**
+****************************************************************/
+
+#ifndef CANNON_H
+#define CANNON_H
+
+#include <qwidget.h>
+
+
+class CannonField : public QWidget
+{
+ Q_OBJECT
+public:
+ CannonField( QWidget *parent=0, const char *name=0 );
+
+ int angle() const { return ang; }
+ QSizePolicy sizePolicy() const;
+
+public slots:
+ void setAngle( int degrees );
+
+signals:
+ void angleChanged( int );
+
+protected:
+ void paintEvent( QPaintEvent * );
+
+private:
+ int ang;
+};
+
+
+#endif // CANNON_H
diff --git a/main/dependencies/qt3/tutorial/t8/lcdrange.cpp b/main/dependencies/qt3/tutorial/t8/lcdrange.cpp
new file mode 100644
index 000000000..b62cfbbcf
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t8/lcdrange.cpp
@@ -0,0 +1,47 @@
+/****************************************************************
+**
+** Implementation of LCDRange class, Qt tutorial 8
+**
+****************************************************************/
+
+#include "lcdrange.h"
+
+#include <qslider.h>
+#include <qlcdnumber.h>
+
+LCDRange::LCDRange( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
+ slider = new QSlider( Horizontal, this, "slider" );
+ slider->setRange( 0, 99 );
+ slider->setValue( 0 );
+ connect( slider, SIGNAL(valueChanged(int)),
+ lcd, SLOT(display(int)) );
+ connect( slider, SIGNAL(valueChanged(int)),
+ SIGNAL(valueChanged(int)) );
+
+ setFocusProxy( slider );
+}
+
+int LCDRange::value() const
+{
+ return slider->value();
+}
+
+void LCDRange::setValue( int value )
+{
+ slider->setValue( value );
+}
+
+void LCDRange::setRange( int minVal, int maxVal )
+{
+ if ( minVal < 0 || maxVal > 99 || minVal > maxVal ) {
+ qWarning( "LCDRange::setRange(%d,%d)\n"
+ "\tRange must be 0..99\n"
+ "\tand minVal must not be greater than maxVal",
+ minVal, maxVal );
+ return;
+ }
+ slider->setRange( minVal, maxVal );
+}
diff --git a/main/dependencies/qt3/tutorial/t8/lcdrange.h b/main/dependencies/qt3/tutorial/t8/lcdrange.h
new file mode 100644
index 000000000..5fa2d2183
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t8/lcdrange.h
@@ -0,0 +1,35 @@
+/****************************************************************
+**
+** Definition of LCDRange class, Qt tutorial 8
+**
+****************************************************************/
+
+#ifndef LCDRANGE_H
+#define LCDRANGE_H
+
+#include <qvbox.h>
+
+class QSlider;
+
+
+class LCDRange : public QVBox
+{
+ Q_OBJECT
+public:
+ LCDRange( QWidget *parent=0, const char *name=0 );
+
+ int value() const;
+
+public slots:
+ void setValue( int );
+ void setRange( int minVal, int maxVal );
+
+signals:
+ void valueChanged( int );
+
+private:
+ QSlider *slider;
+};
+
+
+#endif // LCDRANGE_H
diff --git a/main/dependencies/qt3/tutorial/t8/main.cpp b/main/dependencies/qt3/tutorial/t8/main.cpp
new file mode 100644
index 000000000..598373540
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t8/main.cpp
@@ -0,0 +1,65 @@
+/****************************************************************
+**
+** Qt tutorial 8
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qlcdnumber.h>
+#include <qfont.h>
+#include <qlayout.h>
+
+#include "lcdrange.h"
+#include "cannon.h"
+
+
+class MyWidget: public QWidget
+{
+public:
+ MyWidget( QWidget *parent=0, const char *name=0 );
+};
+
+
+MyWidget::MyWidget( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ QPushButton *quit = new QPushButton( "Quit", this, "quit" );
+ quit->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+
+ LCDRange *angle = new LCDRange( this, "angle" );
+ angle->setRange( 5, 70 );
+
+ CannonField *cannonField
+ = new CannonField( this, "cannonField" );
+
+ connect( angle, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setAngle(int)) );
+ connect( cannonField, SIGNAL(angleChanged(int)),
+ angle, SLOT(setValue(int)) );
+
+ QGridLayout *grid = new QGridLayout( this, 2, 2, 10 );
+ //2x2, 10 pixel border
+
+ grid->addWidget( quit, 0, 0 );
+ grid->addWidget( angle, 1, 0, Qt::AlignTop );
+ grid->addWidget( cannonField, 1, 1 );
+ grid->setColStretch( 1, 10 );
+
+ angle->setValue( 60 );
+ angle->setFocus();
+}
+
+
+int main( int argc, char **argv )
+{
+ QApplication a( argc, argv );
+
+ MyWidget w;
+ w.setGeometry( 100, 100, 500, 355 );
+ a.setMainWidget( &w );
+ w.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t8/t8.pro b/main/dependencies/qt3/tutorial/t8/t8.pro
new file mode 100644
index 000000000..8eca4fa5c
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t8/t8.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS = cannon.h \
+ lcdrange.h
+SOURCES = cannon.cpp \
+ lcdrange.cpp \
+ main.cpp
+TARGET = t8
+REQUIRES=large-config
diff --git a/main/dependencies/qt3/tutorial/t9/cannon.cpp b/main/dependencies/qt3/tutorial/t9/cannon.cpp
new file mode 100644
index 000000000..2badb39eb
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t9/cannon.cpp
@@ -0,0 +1,50 @@
+/****************************************************************
+**
+** Implementation CannonField class, Qt tutorial 9
+**
+****************************************************************/
+
+#include "cannon.h"
+#include <qpainter.h>
+
+
+CannonField::CannonField( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ ang = 45;
+ setPalette( QPalette( QColor( 250, 250, 200) ) );
+}
+
+
+void CannonField::setAngle( int degrees )
+{
+ if ( degrees < 5 )
+ degrees = 5;
+ if ( degrees > 70 )
+ degrees = 70;
+ if ( ang == degrees )
+ return;
+ ang = degrees;
+ repaint();
+ emit angleChanged( ang );
+}
+
+
+void CannonField::paintEvent( QPaintEvent * )
+{
+ QPainter p( this );
+
+ p.setBrush( blue );
+ p.setPen( NoPen );
+
+ p.translate( 0, rect().bottom() );
+ p.drawPie( QRect(-35, -35, 70, 70), 0, 90*16 );
+ p.rotate( -ang );
+ p.drawRect( QRect(33, -4, 15, 8) );
+}
+
+
+QSizePolicy CannonField::sizePolicy() const
+{
+ return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
+}
diff --git a/main/dependencies/qt3/tutorial/t9/cannon.h b/main/dependencies/qt3/tutorial/t9/cannon.h
new file mode 100644
index 000000000..a0928cde1
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t9/cannon.h
@@ -0,0 +1,36 @@
+/****************************************************************
+**
+** Definition of CannonField class, Qt tutorial 8
+**
+****************************************************************/
+
+#ifndef CANNON_H
+#define CANNON_H
+
+#include <qwidget.h>
+
+
+class CannonField : public QWidget
+{
+ Q_OBJECT
+public:
+ CannonField( QWidget *parent=0, const char *name=0 );
+
+ int angle() const { return ang; }
+ QSizePolicy sizePolicy() const;
+
+public slots:
+ void setAngle( int degrees );
+
+signals:
+ void angleChanged( int );
+
+protected:
+ void paintEvent( QPaintEvent * );
+
+private:
+ int ang;
+};
+
+
+#endif // CANNON_H
diff --git a/main/dependencies/qt3/tutorial/t9/lcdrange.cpp b/main/dependencies/qt3/tutorial/t9/lcdrange.cpp
new file mode 100644
index 000000000..b62cfbbcf
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t9/lcdrange.cpp
@@ -0,0 +1,47 @@
+/****************************************************************
+**
+** Implementation of LCDRange class, Qt tutorial 8
+**
+****************************************************************/
+
+#include "lcdrange.h"
+
+#include <qslider.h>
+#include <qlcdnumber.h>
+
+LCDRange::LCDRange( QWidget *parent, const char *name )
+ : QVBox( parent, name )
+{
+ QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
+ slider = new QSlider( Horizontal, this, "slider" );
+ slider->setRange( 0, 99 );
+ slider->setValue( 0 );
+ connect( slider, SIGNAL(valueChanged(int)),
+ lcd, SLOT(display(int)) );
+ connect( slider, SIGNAL(valueChanged(int)),
+ SIGNAL(valueChanged(int)) );
+
+ setFocusProxy( slider );
+}
+
+int LCDRange::value() const
+{
+ return slider->value();
+}
+
+void LCDRange::setValue( int value )
+{
+ slider->setValue( value );
+}
+
+void LCDRange::setRange( int minVal, int maxVal )
+{
+ if ( minVal < 0 || maxVal > 99 || minVal > maxVal ) {
+ qWarning( "LCDRange::setRange(%d,%d)\n"
+ "\tRange must be 0..99\n"
+ "\tand minVal must not be greater than maxVal",
+ minVal, maxVal );
+ return;
+ }
+ slider->setRange( minVal, maxVal );
+}
diff --git a/main/dependencies/qt3/tutorial/t9/lcdrange.h b/main/dependencies/qt3/tutorial/t9/lcdrange.h
new file mode 100644
index 000000000..5fa2d2183
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t9/lcdrange.h
@@ -0,0 +1,35 @@
+/****************************************************************
+**
+** Definition of LCDRange class, Qt tutorial 8
+**
+****************************************************************/
+
+#ifndef LCDRANGE_H
+#define LCDRANGE_H
+
+#include <qvbox.h>
+
+class QSlider;
+
+
+class LCDRange : public QVBox
+{
+ Q_OBJECT
+public:
+ LCDRange( QWidget *parent=0, const char *name=0 );
+
+ int value() const;
+
+public slots:
+ void setValue( int );
+ void setRange( int minVal, int maxVal );
+
+signals:
+ void valueChanged( int );
+
+private:
+ QSlider *slider;
+};
+
+
+#endif // LCDRANGE_H
diff --git a/main/dependencies/qt3/tutorial/t9/main.cpp b/main/dependencies/qt3/tutorial/t9/main.cpp
new file mode 100644
index 000000000..ef1712e3c
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t9/main.cpp
@@ -0,0 +1,62 @@
+/****************************************************************
+**
+** Qt tutorial 9
+**
+****************************************************************/
+
+#include <qapplication.h>
+#include <qpushbutton.h>
+#include <qlcdnumber.h>
+#include <qfont.h>
+#include <qlayout.h>
+
+#include "lcdrange.h"
+#include "cannon.h"
+
+
+class MyWidget: public QWidget
+{
+public:
+ MyWidget( QWidget *parent=0, const char *name=0 );
+};
+
+
+MyWidget::MyWidget( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ QPushButton *quit = new QPushButton( "&Quit", this, "quit" );
+ quit->setFont( QFont( "Times", 18, QFont::Bold ) );
+
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+
+ LCDRange *angle = new LCDRange( this, "angle" );
+ angle->setRange( 5, 70 );
+
+ CannonField *cannonField = new CannonField( this, "cannonField" );
+
+ connect( angle, SIGNAL(valueChanged(int)),
+ cannonField, SLOT(setAngle(int)) );
+ connect( cannonField, SIGNAL(angleChanged(int)),
+ angle, SLOT(setValue(int)) );
+
+ QGridLayout *grid = new QGridLayout( this, 2, 2, 10 );
+ grid->addWidget( quit, 0, 0 );
+ grid->addWidget( angle, 1, 0, Qt::AlignTop );
+ grid->addWidget( cannonField, 1, 1 );
+ grid->setColStretch( 1, 10 );
+
+ angle->setValue( 60 );
+ angle->setFocus();
+}
+
+int main( int argc, char **argv )
+{
+ QApplication::setColorSpec( QApplication::CustomColor );
+ QApplication a( argc, argv );
+
+ MyWidget w;
+ w.setGeometry( 100, 100, 500, 355 );
+ a.setMainWidget( &w );
+ w.show();
+ return a.exec();
+}
diff --git a/main/dependencies/qt3/tutorial/t9/t9.pro b/main/dependencies/qt3/tutorial/t9/t9.pro
new file mode 100644
index 000000000..b9d995a33
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/t9/t9.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS = cannon.h \
+ lcdrange.h
+SOURCES = cannon.cpp \
+ lcdrange.cpp \
+ main.cpp
+TARGET = t9
+REQUIRES=full-config
diff --git a/main/dependencies/qt3/tutorial/tutorial.pro b/main/dependencies/qt3/tutorial/tutorial.pro
new file mode 100644
index 000000000..32b31d7b6
--- /dev/null
+++ b/main/dependencies/qt3/tutorial/tutorial.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS = t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14