summaryrefslogtreecommitdiffstats
path: root/kasteroids
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
commit576eb4299a00bc053db35414406f46372a0f70f2 (patch)
tree4c030922d533821db464af566188e7d40cc8848c /kasteroids
parent0718336b6017d1a4fc1d626544180a5a2a29ddec (diff)
downloadtdegames-576eb4299a00bc053db35414406f46372a0f70f2.tar.gz
tdegames-576eb4299a00bc053db35414406f46372a0f70f2.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kasteroids')
-rw-r--r--kasteroids/ledmeter.cpp18
-rw-r--r--kasteroids/ledmeter.h16
-rw-r--r--kasteroids/sprites.h16
-rw-r--r--kasteroids/toplevel.cpp184
-rw-r--r--kasteroids/toplevel.h36
-rw-r--r--kasteroids/view.cpp62
-rw-r--r--kasteroids/view.h44
7 files changed, 188 insertions, 188 deletions
diff --git a/kasteroids/ledmeter.cpp b/kasteroids/ledmeter.cpp
index 3df87b8f..1d807d18 100644
--- a/kasteroids/ledmeter.cpp
+++ b/kasteroids/ledmeter.cpp
@@ -4,11 +4,11 @@
* Part of the KDE project
*/
-#include <qpainter.h>
+#include <tqpainter.h>
#include "ledmeter.h"
#include "ledmeter.moc"
-KALedMeter::KALedMeter( QWidget *parent ) : QFrame( parent )
+KALedMeter::KALedMeter( TQWidget *parent ) : TQFrame( parent )
{
mCRanges.setAutoDelete( true );
mRange = 100;
@@ -53,7 +53,7 @@ void KALedMeter::setValue( int v )
}
}
-void KALedMeter::addColorRange( int pc, const QColor &c )
+void KALedMeter::addColorRange( int pc, const TQColor &c )
{
ColorRange *cr = new ColorRange;
cr->mPc = pc;
@@ -62,21 +62,21 @@ void KALedMeter::addColorRange( int pc, const QColor &c )
calcColorRanges();
}
-void KALedMeter::resizeEvent( QResizeEvent *e )
+void KALedMeter::resizeEvent( TQResizeEvent *e )
{
- QFrame::resizeEvent( e );
+ TQFrame::resizeEvent( e );
int w = ( width() - frameWidth() - 2 ) / mCount * mCount;
w += frameWidth() + 2;
- setFrameRect( QRect( 0, 0, w, height() ) );
+ setFrameRect( TQRect( 0, 0, w, height() ) );
}
-void KALedMeter::drawContents( QPainter *p )
+void KALedMeter::drawContents( TQPainter *p )
{
- QRect b = contentsRect();
+ TQRect b = contentsRect();
unsigned cidx = 0;
int ncol = mCount;
- QColor col = colorGroup().foreground();
+ TQColor col = colorGroup().foreground();
if ( !mCRanges.isEmpty() )
{
diff --git a/kasteroids/ledmeter.h b/kasteroids/ledmeter.h
index ea9b7e96..307b5bfc 100644
--- a/kasteroids/ledmeter.h
+++ b/kasteroids/ledmeter.h
@@ -7,15 +7,15 @@
#ifndef __LEDMETER_H__
#define __LEDMETER_H__
-#include <qframe.h>
-#include <qptrlist.h>
+#include <tqframe.h>
+#include <tqptrlist.h>
class KALedMeter : public QFrame
{
Q_OBJECT
public:
- KALedMeter( QWidget *parent );
+ KALedMeter( TQWidget *parent );
int range() const { return mRange; }
void setRange( int r );
@@ -25,14 +25,14 @@ public:
int value () const { return mValue; }
- void addColorRange( int pc, const QColor &c );
+ void addColorRange( int pc, const TQColor &c );
public slots:
void setValue( int v );
protected:
- virtual void resizeEvent( QResizeEvent * );
- virtual void drawContents( QPainter * );
+ virtual void resizeEvent( TQResizeEvent * );
+ virtual void drawContents( TQPainter * );
void calcColorRanges();
protected:
@@ -40,14 +40,14 @@ protected:
{
int mPc;
int mValue;
- QColor mColor;
+ TQColor mColor;
};
int mRange;
int mCount;
int mCurrentCount;
int mValue;
- QPtrList<ColorRange> mCRanges;
+ TQPtrList<ColorRange> mCRanges;
};
#endif
diff --git a/kasteroids/sprites.h b/kasteroids/sprites.h
index 0b0a718a..43dc34ea 100644
--- a/kasteroids/sprites.h
+++ b/kasteroids/sprites.h
@@ -7,7 +7,7 @@
#ifndef __SPRITES_H__
#define __SPRITES_H__
-#include <qcanvas.h>
+#include <tqcanvas.h>
#define ID_ROCK_LARGE 1024
#define ID_ROCK_MEDIUM 1025
@@ -34,7 +34,7 @@
class KMissile : public QCanvasSprite
{
public:
- KMissile( QCanvasPixmapArray *s, QCanvas *c ) : QCanvasSprite( s, c )
+ KMissile( TQCanvasPixmapArray *s, TQCanvas *c ) : TQCanvasSprite( s, c )
{ myAge = 0; }
virtual int rtti() const { return ID_MISSILE; }
@@ -49,7 +49,7 @@ private:
class KBit : public QCanvasSprite
{
public:
- KBit( QCanvasPixmapArray *s, QCanvas *c ) : QCanvasSprite( s, c )
+ KBit( TQCanvasPixmapArray *s, TQCanvas *c ) : TQCanvasSprite( s, c )
{ death = 7; }
virtual int rtti() const { return ID_BIT; }
@@ -65,7 +65,7 @@ private:
class KExhaust : public QCanvasSprite
{
public:
- KExhaust( QCanvasPixmapArray *s, QCanvas *c ) : QCanvasSprite( s, c )
+ KExhaust( TQCanvasPixmapArray *s, TQCanvas *c ) : TQCanvasSprite( s, c )
{ death = 1; }
virtual int rtti() const { return ID_EXHAUST; }
@@ -81,7 +81,7 @@ private:
class KPowerup : public QCanvasSprite
{
public:
- KPowerup( QCanvasPixmapArray *s, QCanvas *c, int t ) : QCanvasSprite( s, c ),
+ KPowerup( TQCanvasPixmapArray *s, TQCanvas *c, int t ) : TQCanvasSprite( s, c ),
myAge( 0 ), type(t) { }
virtual int rtti() const { return type; }
@@ -97,7 +97,7 @@ protected:
class KRock : public QCanvasSprite
{
public:
- KRock (QCanvasPixmapArray *s, QCanvas *c, int t, int sk, int st) : QCanvasSprite( s, c )
+ KRock (TQCanvasPixmapArray *s, TQCanvas *c, int t, int sk, int st) : TQCanvasSprite( s, c )
{ type = t; skip = cskip = sk; step = st; }
void nextFrame()
@@ -120,8 +120,8 @@ private:
class KShield : public QCanvasSprite
{
public:
- KShield( QCanvasPixmapArray *s, QCanvas *c )
- : QCanvasSprite( s, c ) {}
+ KShield( TQCanvasPixmapArray *s, TQCanvas *c )
+ : TQCanvasSprite( s, c ) {}
virtual int rtti() const { return ID_SHIELD; }
};
diff --git a/kasteroids/toplevel.cpp b/kasteroids/toplevel.cpp
index a4286d2f..256174b6 100644
--- a/kasteroids/toplevel.cpp
+++ b/kasteroids/toplevel.cpp
@@ -4,11 +4,11 @@
* Part of the KDE project
*/
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlcdnumber.h>
-#include <qspinbox.h>
-#include <qcheckbox.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqlcdnumber.h>
+#include <tqspinbox.h>
+#include <tqcheckbox.h>
#include <kdebug.h>
#include <kapplication.h>
@@ -75,76 +75,76 @@ Arts::SimpleSoundServer *soundServer = 0;
KAstTopLevel::KAstTopLevel()
{
- QWidget *mainWin = new QWidget( this );
+ TQWidget *mainWin = new TQWidget( this );
mainWin->setFixedSize(640, 480);
view = new KAsteroidsView( mainWin );
- connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) );
- connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) );
- connect( view, SIGNAL( rocksRemoved() ), SLOT( slotRocksRemoved() ) );
- connect( view, SIGNAL( updateVitals() ), SLOT( slotUpdateVitals() ) );
-
- QVBoxLayout *vb = new QVBoxLayout( mainWin );
- QHBoxLayout *hb = new QHBoxLayout;
- QHBoxLayout *hbd = new QHBoxLayout;
+ connect( view, TQT_SIGNAL( shipKilled() ), TQT_SLOT( slotShipKilled() ) );
+ connect( view, TQT_SIGNAL( rockHit(int) ), TQT_SLOT( slotRockHit(int) ) );
+ connect( view, TQT_SIGNAL( rocksRemoved() ), TQT_SLOT( slotRocksRemoved() ) );
+ connect( view, TQT_SIGNAL( updateVitals() ), TQT_SLOT( slotUpdateVitals() ) );
+
+ TQVBoxLayout *vb = new TQVBoxLayout( mainWin );
+ TQHBoxLayout *hb = new QHBoxLayout;
+ TQHBoxLayout *hbd = new QHBoxLayout;
vb->addLayout( hb );
- QFont labelFont( KGlobalSettings::generalFont().family(), 24 );
- QColorGroup grp( darkGreen, black, QColor( 128, 128, 128 ),
- QColor( 64, 64, 64 ), black, darkGreen, black );
- QPalette pal( grp, grp, grp );
+ TQFont labelFont( KGlobalSettings::generalFont().family(), 24 );
+ TQColorGroup grp( darkGreen, black, TQColor( 128, 128, 128 ),
+ TQColor( 64, 64, 64 ), black, darkGreen, black );
+ TQPalette pal( grp, grp, grp );
mainWin->setPalette( pal );
hb->addSpacing( 10 );
- QLabel *label;
- label = new QLabel( i18n("Score"), mainWin );
+ TQLabel *label;
+ label = new TQLabel( i18n("Score"), mainWin );
label->setFont( labelFont );
label->setPalette( pal );
label->setFixedWidth( label->sizeHint().width() );
hb->addWidget( label );
- scoreLCD = new QLCDNumber( 6, mainWin );
- scoreLCD->setFrameStyle( QFrame::NoFrame );
- scoreLCD->setSegmentStyle( QLCDNumber::Flat );
+ scoreLCD = new TQLCDNumber( 6, mainWin );
+ scoreLCD->setFrameStyle( TQFrame::NoFrame );
+ scoreLCD->setSegmentStyle( TQLCDNumber::Flat );
scoreLCD->setFixedWidth( 150 );
scoreLCD->setPalette( pal );
hb->addWidget( scoreLCD );
hb->addStretch( 10 );
- label = new QLabel( i18n("Level"), mainWin );
+ label = new TQLabel( i18n("Level"), mainWin );
label->setFont( labelFont );
label->setPalette( pal );
label->setFixedWidth( label->sizeHint().width() );
hb->addWidget( label );
- levelLCD = new QLCDNumber( 2, mainWin );
- levelLCD->setFrameStyle( QFrame::NoFrame );
- levelLCD->setSegmentStyle( QLCDNumber::Flat );
+ levelLCD = new TQLCDNumber( 2, mainWin );
+ levelLCD->setFrameStyle( TQFrame::NoFrame );
+ levelLCD->setSegmentStyle( TQLCDNumber::Flat );
levelLCD->setFixedWidth( 70 );
levelLCD->setPalette( pal );
hb->addWidget( levelLCD );
hb->addStretch( 10 );
- label = new QLabel( i18n("Ships"), mainWin );
+ label = new TQLabel( i18n("Ships"), mainWin );
label->setFont( labelFont );
label->setFixedWidth( label->sizeHint().width() );
label->setPalette( pal );
hb->addWidget( label );
- shipsLCD = new QLCDNumber( 1, mainWin );
- shipsLCD->setFrameStyle( QFrame::NoFrame );
- shipsLCD->setSegmentStyle( QLCDNumber::Flat );
+ shipsLCD = new TQLCDNumber( 1, mainWin );
+ shipsLCD->setFrameStyle( TQFrame::NoFrame );
+ shipsLCD->setSegmentStyle( TQLCDNumber::Flat );
shipsLCD->setFixedWidth( 40 );
shipsLCD->setPalette( pal );
hb->addWidget( shipsLCD );
hb->addStrut( 30 );
- QFrame *sep = new QFrame( mainWin );
+ TQFrame *sep = new TQFrame( mainWin );
sep->setMaximumHeight( 5 );
- sep->setFrameStyle( QFrame::HLine | QFrame::Raised );
+ sep->setFrameStyle( TQFrame::HLine | TQFrame::Raised );
sep->setPalette( pal );
vb->addWidget( sep );
@@ -152,45 +152,45 @@ KAstTopLevel::KAstTopLevel()
vb->addWidget( view, 10 );
// -- bottom layout:
- QFrame *sep2 = new QFrame( mainWin );
+ TQFrame *sep2 = new TQFrame( mainWin );
sep2->setMaximumHeight( 1 );
- sep2->setFrameStyle( QFrame::HLine | QFrame::Raised );
+ sep2->setFrameStyle( TQFrame::HLine | TQFrame::Raised );
sep2->setPalette( pal );
vb->addWidget( sep2, 1 );
vb->addLayout( hbd );
- QFont smallFont( KGlobalSettings::generalFont().family(), 14 );
+ TQFont smallFont( KGlobalSettings::generalFont().family(), 14 );
hbd->addSpacing( 10 );
- QString sprites_prefix =
+ TQString sprites_prefix =
KGlobal::dirs()->findResourceDir("sprite", "rock1/rock10000.png");
/*
- label = new QLabel( i18n( "T" ), mainWin );
+ label = new TQLabel( i18n( "T" ), mainWin );
label->setFont( smallFont );
label->setFixedWidth( label->sizeHint().width() );
label->setPalette( pal );
hbd->addWidget( label );
- teleportsLCD = new QLCDNumber( 1, mainWin );
- teleportsLCD->setFrameStyle( QFrame::NoFrame );
- teleportsLCD->setSegmentStyle( QLCDNumber::Flat );
+ teleportsLCD = new TQLCDNumber( 1, mainWin );
+ teleportsLCD->setFrameStyle( TQFrame::NoFrame );
+ teleportsLCD->setSegmentStyle( TQLCDNumber::Flat );
teleportsLCD->setPalette( pal );
teleportsLCD->setFixedHeight( 20 );
hbd->addWidget( teleportsLCD );
hbd->addSpacing( 10 );
*/
- QPixmap pm( sprites_prefix + "powerups/brake.png" );
- label = new QLabel( mainWin );
+ TQPixmap pm( sprites_prefix + "powerups/brake.png" );
+ label = new TQLabel( mainWin );
label->setPixmap( pm );
label->setFixedWidth( label->sizeHint().width() );
label->setPalette( pal );
hbd->addWidget( label );
- brakesLCD = new QLCDNumber( 1, mainWin );
- brakesLCD->setFrameStyle( QFrame::NoFrame );
- brakesLCD->setSegmentStyle( QLCDNumber::Flat );
+ brakesLCD = new TQLCDNumber( 1, mainWin );
+ brakesLCD->setFrameStyle( TQFrame::NoFrame );
+ brakesLCD->setSegmentStyle( TQLCDNumber::Flat );
brakesLCD->setPalette( pal );
brakesLCD->setFixedHeight( 20 );
hbd->addWidget( brakesLCD );
@@ -198,15 +198,15 @@ KAstTopLevel::KAstTopLevel()
hbd->addSpacing( 10 );
pm.load( sprites_prefix + "powerups/shield.png" );
- label = new QLabel( mainWin );
+ label = new TQLabel( mainWin );
label->setPixmap( pm );
label->setFixedWidth( label->sizeHint().width() );
label->setPalette( pal );
hbd->addWidget( label );
- shieldLCD = new QLCDNumber( 1, mainWin );
- shieldLCD->setFrameStyle( QFrame::NoFrame );
- shieldLCD->setSegmentStyle( QLCDNumber::Flat );
+ shieldLCD = new TQLCDNumber( 1, mainWin );
+ shieldLCD->setFrameStyle( TQFrame::NoFrame );
+ shieldLCD->setSegmentStyle( TQLCDNumber::Flat );
shieldLCD->setPalette( pal );
shieldLCD->setFixedHeight( 20 );
hbd->addWidget( shieldLCD );
@@ -214,32 +214,32 @@ KAstTopLevel::KAstTopLevel()
hbd->addSpacing( 10 );
pm.load( sprites_prefix + "powerups/shoot.png" );
- label = new QLabel( mainWin );
+ label = new TQLabel( mainWin );
label->setPixmap( pm );
label->setFixedWidth( label->sizeHint().width() );
label->setPalette( pal );
hbd->addWidget( label );
- shootLCD = new QLCDNumber( 1, mainWin );
- shootLCD->setFrameStyle( QFrame::NoFrame );
- shootLCD->setSegmentStyle( QLCDNumber::Flat );
+ shootLCD = new TQLCDNumber( 1, mainWin );
+ shootLCD->setFrameStyle( TQFrame::NoFrame );
+ shootLCD->setSegmentStyle( TQLCDNumber::Flat );
shootLCD->setPalette( pal );
shootLCD->setFixedHeight( 20 );
hbd->addWidget( shootLCD );
hbd->addStretch( 1 );
- label = new QLabel( i18n( "Fuel" ), mainWin );
+ label = new TQLabel( i18n( "Fuel" ), mainWin );
label->setFont( smallFont );
label->setFixedWidth( label->sizeHint().width() + 10 );
label->setPalette( pal );
hbd->addWidget( label );
powerMeter = new KALedMeter( mainWin );
- powerMeter->setFrameStyle( QFrame::Box | QFrame::Plain );
+ powerMeter->setFrameStyle( TQFrame::Box | TQFrame::Plain );
powerMeter->setRange( MAX_POWER_LEVEL );
powerMeter->addColorRange( 10, darkRed );
- powerMeter->addColorRange( 20, QColor(160, 96, 0) );
+ powerMeter->addColorRange( 20, TQColor(160, 96, 0) );
powerMeter->addColorRange( 70, darkGreen );
powerMeter->setCount( 40 );
powerMeter->setPalette( pal );
@@ -280,14 +280,14 @@ KAstTopLevel::~KAstTopLevel()
void KAstTopLevel::initKAction()
{
// game
- KStdGameAction::gameNew( this, SLOT( slotNewGame() ), actionCollection() );
- KStdGameAction::highscores( this, SLOT( slotShowHighscores() ), actionCollection() );
- KStdGameAction::pause( this, SLOT( slotPause() ), actionCollection() );
- KStdGameAction::quit(this, SLOT( close() ), actionCollection());
+ KStdGameAction::gameNew( this, TQT_SLOT( slotNewGame() ), actionCollection() );
+ KStdGameAction::highscores( this, TQT_SLOT( slotShowHighscores() ), actionCollection() );
+ KStdGameAction::pause( this, TQT_SLOT( slotPause() ), actionCollection() );
+ KStdGameAction::quit(this, TQT_SLOT( close() ), actionCollection());
// settings
- KStdAction::keyBindings(this, SLOT( slotKeyConfig() ), actionCollection());
- KStdAction::preferences(this, SLOT( slotPref() ), actionCollection());
+ KStdAction::keyBindings(this, TQT_SLOT( slotKeyConfig() ), actionCollection());
+ KStdAction::preferences(this, TQT_SLOT( slotPref() ), actionCollection());
// keyboard-only actions
keycodes.insert(Thrust, new KAction(i18n("Thrust"), Qt::Key_Up, 0, 0, actionCollection(), "Thrust"));
@@ -297,16 +297,16 @@ void KAstTopLevel::initKAction()
// keycodes.insert(Teleport, new KAction(i18n("Teleport"), Qt::Key_Z, 0, 0, actionCollection(), "Teleport"));
keycodes.insert(Brake, new KAction(i18n("Brake"), Qt::Key_X, 0, 0, actionCollection(), "Brake"));
keycodes.insert(Shield, new KAction(i18n("Shield"), Qt::Key_S, 0, 0, actionCollection(), "Shield"));
- launchAction = new KAction(i18n("Launch"), Qt::Key_L, this, SLOT(slotLaunch()), actionCollection(), "Launch");
+ launchAction = new KAction(i18n("Launch"), Qt::Key_L, this, TQT_SLOT(slotLaunch()), actionCollection(), "Launch");
}
void KAstTopLevel::loadSettings()
{
soundDict.insert("ShipDestroyed",
- new QString( locate("sounds", Settings::soundShipDestroyed())) );
+ new TQString( locate("sounds", Settings::soundShipDestroyed())) );
soundDict.insert("RockDestroyed",
- new QString( locate("sounds", Settings::soundRockDestroyed())) );
+ new TQString( locate("sounds", Settings::soundRockDestroyed())) );
shipsRemain = Settings::numShips();
}
@@ -319,14 +319,14 @@ void KAstTopLevel::playSound( const char *snd )
if (!Settings::playSounds())
return;
- QString *filename = soundDict[ snd ];
+ TQString *filename = soundDict[ snd ];
if (filename) {
KAudioPlayer::play(*filename);
}
return; // remove this and the above when the sound below is working correctly
#ifdef KA_ENABLE_SOUND
- QString *filename = soundDict[ snd ];
+ TQString *filename = soundDict[ snd ];
if (filename) {
kdDebug(12012)<< "playing " << *filename << endl;
if(!soundServer->isNull()) soundServer->play(filename->latin1());
@@ -334,15 +334,15 @@ return; // remove this and the above when the sound below is working correctly
#endif
}
-bool KAstTopLevel::eventFilter( QObject* /* object */, QEvent *event )
+bool KAstTopLevel::eventFilter( TQObject* /* object */, TQEvent *event )
{
- QKeyEvent *e = static_cast<QKeyEvent*>(event);
- if (event->type() == QEvent::AccelOverride)
+ TQKeyEvent *e = static_cast<TQKeyEvent*>(event);
+ if (event->type() == TQEvent::AccelOverride)
{
if (processKeyPress(e)) return true;
else return false;
}
- else if (event->type() == QEvent::KeyRelease)
+ else if (event->type() == TQEvent::KeyRelease)
{
if (processKeyRelease(e)) return true;
else return false;
@@ -350,11 +350,11 @@ bool KAstTopLevel::eventFilter( QObject* /* object */, QEvent *event )
return false;
}
-bool KAstTopLevel::processKeyPress( QKeyEvent *event )
+bool KAstTopLevel::processKeyPress( TQKeyEvent *event )
{
KKey key(event);
Action a = Invalid;
- QMap<Action, KAction*>::Iterator it = keycodes.begin();
+ TQMap<Action, KAction*>::Iterator it = keycodes.begin();
for (; it != keycodes.end(); ++it)
{
if ( (*it)->shortcut().contains(key) )
@@ -403,11 +403,11 @@ bool KAstTopLevel::processKeyPress( QKeyEvent *event )
return true;
}
-bool KAstTopLevel::processKeyRelease( QKeyEvent *event )
+bool KAstTopLevel::processKeyRelease( TQKeyEvent *event )
{
KKey key(event);
Action a = Invalid;
- QMap<Action, KAction*>::Iterator it = keycodes.begin();
+ TQMap<Action, KAction*>::Iterator it = keycodes.begin();
for (; it != keycodes.end(); ++it)
{
if ( (*it)->shortcut().contains(key) )
@@ -454,7 +454,7 @@ bool KAstTopLevel::processKeyRelease( QKeyEvent *event )
return true;
}
-void KAstTopLevel::focusInEvent( QFocusEvent *e )
+void KAstTopLevel::focusInEvent( TQFocusEvent *e )
{
view->pause( false );
#if defined Q_WS_X11 && ! defined K_WS_QTONLY
@@ -463,7 +463,7 @@ void KAstTopLevel::focusInEvent( QFocusEvent *e )
KMainWindow::focusInEvent(e);
}
-void KAstTopLevel::focusOutEvent( QFocusEvent *e )
+void KAstTopLevel::focusOutEvent( TQFocusEvent *e )
{
view->pause( true );
#if defined Q_WS_X11 && ! defined K_WS_QTONLY
@@ -529,7 +529,7 @@ void KAstTopLevel::slotShipKilled()
}
else
{
- QTimer::singleShot(1000, this, SLOT(slotGameOver()));
+ TQTimer::singleShot(1000, this, TQT_SLOT(slotGameOver()));
}
}
}
@@ -589,31 +589,31 @@ void KAstTopLevel::slotPref()
KConfigDialog *dialog = new KConfigDialog(this, "settings", Settings::self(), KDialogBase::Swallow);
/* Make widget */
- QWidget *w = new QWidget(0, "Settings");
- QVBoxLayout *page = new QVBoxLayout( w, 11 );
+ TQWidget *w = new TQWidget(0, "Settings");
+ TQVBoxLayout *page = new TQVBoxLayout( w, 11 );
- QHBoxLayout *hb = new QHBoxLayout( page, 11 );
- QLabel *label = new QLabel( i18n("Start new game with"), w );
- QSpinBox* sb = new QSpinBox( 1, 5, 1, w, "kcfg_numShips" );
+ TQHBoxLayout *hb = new TQHBoxLayout( page, 11 );
+ TQLabel *label = new TQLabel( i18n("Start new game with"), w );
+ TQSpinBox* sb = new TQSpinBox( 1, 5, 1, w, "kcfg_numShips" );
sb->setValue(3);
- QLabel *lb = new QLabel( i18n(" ships."), w );
- QSpacerItem* hspacer = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ TQLabel *lb = new TQLabel( i18n(" ships."), w );
+ TQSpacerItem* hspacer = new TQSpacerItem( 16, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
hb->addWidget(label);
hb->addWidget(sb);
hb->addWidget(lb);
hb->addItem(hspacer);
- QCheckBox *f1 = new QCheckBox(i18n("Show highscores on Game Over"), w, "kcfg_showHiscores");
- QCheckBox *f2 = new QCheckBox(i18n("Player can destroy Powerups"), w, "kcfg_canDestroyPowerups");
+ TQCheckBox *f1 = new TQCheckBox(i18n("Show highscores on Game Over"), w, "kcfg_showHiscores");
+ TQCheckBox *f2 = new TQCheckBox(i18n("Player can destroy Powerups"), w, "kcfg_canDestroyPowerups");
f2->setChecked(true);
page->addWidget(f1);
page->addWidget(f2);
- QSpacerItem* spacer = new QSpacerItem( 20, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ TQSpacerItem* spacer = new TQSpacerItem( 20, 16, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
page->addItem( spacer );
/* Done */
dialog->addPage(w, i18n("General"), "package_settings");
- connect(dialog, SIGNAL(settingsChanged()), this, SLOT(loadSettings()));
+ connect(dialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(loadSettings()));
dialog->show();
}
@@ -625,14 +625,14 @@ void KAstTopLevel::slotShowHighscores()
void KAstTopLevel::doStats()
{
- QString r;
+ TQString r;
if ( view->shots() )
r = KGlobal::locale()->formatNumber(( (float)view->hits() /
(float)view->shots() ) * 100, 2 );
else
r = KGlobal::locale()->formatNumber( 0.0, 2 );
- QString s = i18n( "Game Over\n\n"
+ TQString s = i18n( "Game Over\n\n"
"Shots fired:\t%1\n"
" Hit:\t%2\n"
" Missed:\t%3\n"
diff --git a/kasteroids/toplevel.h b/kasteroids/toplevel.h
index 70545f71..fb67cc14 100644
--- a/kasteroids/toplevel.h
+++ b/kasteroids/toplevel.h
@@ -9,8 +9,8 @@
#include <kmainwindow.h>
#include <kaccel.h>
-#include <qdict.h>
-#include <qmap.h>
+#include <tqdict.h>
+#include <tqmap.h>
#include "view.h"
@@ -33,13 +33,13 @@ private:
void readSoundMapping();
void doStats();
bool queryExit();
- bool processKeyPress( QKeyEvent *event );
- bool processKeyRelease( QKeyEvent *event );
+ bool processKeyPress( TQKeyEvent *event );
+ bool processKeyRelease( TQKeyEvent *event );
protected:
- virtual bool eventFilter( QObject *object, QEvent *event );
- virtual void focusInEvent( QFocusEvent *event );
- virtual void focusOutEvent( QFocusEvent *event );
+ virtual bool eventFilter( TQObject *object, TQEvent *event );
+ virtual void focusInEvent( TQFocusEvent *event );
+ virtual void focusOutEvent( TQFocusEvent *event );
private slots:
void loadSettings();
@@ -61,18 +61,18 @@ private slots:
private:
KAsteroidsView *view;
- QLCDNumber *scoreLCD;
- QLCDNumber *levelLCD;
- QLCDNumber *shipsLCD;
-
- QLCDNumber *teleportsLCD;
-// QLCDNumber *bombsLCD;
- QLCDNumber *brakesLCD;
- QLCDNumber *shieldLCD;
- QLCDNumber *shootLCD;
+ TQLCDNumber *scoreLCD;
+ TQLCDNumber *levelLCD;
+ TQLCDNumber *shipsLCD;
+
+ TQLCDNumber *teleportsLCD;
+// TQLCDNumber *bombsLCD;
+ TQLCDNumber *brakesLCD;
+ TQLCDNumber *shieldLCD;
+ TQLCDNumber *shootLCD;
KALedMeter *powerMeter;
- QDict<QString> soundDict;
+ TQDict<TQString> soundDict;
// waiting for user to press Enter to launch a ship
bool waitShip;
@@ -85,7 +85,7 @@ private:
enum Action { Invalid, Launch, Thrust, RotateLeft, RotateRight, Shoot,
Teleport, Brake, Shield };
- QMap<Action, KAction*> keycodes;
+ TQMap<Action, KAction*> keycodes;
KAction *launchAction;
};
diff --git a/kasteroids/view.cpp b/kasteroids/view.cpp
index 8ca358fd..e203ffb5 100644
--- a/kasteroids/view.cpp
+++ b/kasteroids/view.cpp
@@ -63,13 +63,13 @@ kas_animations [] =
-KAsteroidsView::KAsteroidsView( QWidget *parent, const char *name )
- : QWidget( parent, name ),
+KAsteroidsView::KAsteroidsView( TQWidget *parent, const char *name )
+ : TQWidget( parent, name ),
field(640, 440),
view(&field,this)
{
- view.setVScrollBarMode( QScrollView::AlwaysOff );
- view.setHScrollBarMode( QScrollView::AlwaysOff );
+ view.setVScrollBarMode( TQScrollView::AlwaysOff );
+ view.setHScrollBarMode( TQScrollView::AlwaysOff );
rocks.setAutoDelete( true );
missiles.setAutoDelete( true );
bits.setAutoDelete( true );
@@ -77,11 +77,11 @@ KAsteroidsView::KAsteroidsView( QWidget *parent, const char *name )
exhaust.setAutoDelete( true );
field.setBackgroundColor(black);
- QPixmap pm( locate("sprite", IMG_BACKGROUND) );
+ TQPixmap pm( locate("sprite", IMG_BACKGROUND) );
field.setBackgroundPixmap( pm );
- textSprite = new QCanvasText( &field );
- QFont font( KGlobalSettings::generalFont().family(), 18 );
+ textSprite = new TQCanvasText( &field );
+ TQFont font( KGlobalSettings::generalFont().family(), 18 );
textSprite->setFont( font );
shield = 0;
@@ -90,8 +90,8 @@ KAsteroidsView::KAsteroidsView( QWidget *parent, const char *name )
readSprites();
- shieldTimer = new QTimer( this );
- connect( shieldTimer, SIGNAL(timeout()), this, SLOT(hideShield()) );
+ shieldTimer = new TQTimer( this );
+ connect( shieldTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(hideShield()) );
mTimerId = -1;
shipPower = MAX_POWER_LEVEL;
@@ -229,19 +229,19 @@ void KAsteroidsView::brake( bool b )
void KAsteroidsView::readSprites()
{
- QString sprites_prefix =
+ TQString sprites_prefix =
KGlobal::dirs()->findResourceDir("sprite", "rock1/rock10000.png");
int i = 0;
while ( kas_animations[i].id )
{
animation.insert( kas_animations[i].id,
- new QCanvasPixmapArray( sprites_prefix + kas_animations[i].path,
+ new TQCanvasPixmapArray( sprites_prefix + kas_animations[i].path,
kas_animations[i].frames ) );
i++;
}
- ship = new QCanvasSprite( animation[ID_SHIP], &field );
+ ship = new TQCanvasSprite( animation[ID_SHIP], &field );
ship->hide();
shield = new KShield( animation[ID_SHIELD], &field );
@@ -282,7 +282,7 @@ void KAsteroidsView::addRocks( int num )
// - - -
-void KAsteroidsView::showText( const QString &text, const QColor &color, bool scroll )
+void KAsteroidsView::showText( const TQString &text, const TQColor &color, bool scroll )
{
// textSprite->setTextFlags( AlignHCenter | AlignVCenter );
textSprite->setText( text );
@@ -309,20 +309,20 @@ void KAsteroidsView::hideText()
// - - -
-void KAsteroidsView::resizeEvent(QResizeEvent* event)
+void KAsteroidsView::resizeEvent(TQResizeEvent* event)
{
- QWidget::resizeEvent(event);
+ TQWidget::resizeEvent(event);
field.resize(width()-4, height()-4);
view.resize(width(),height());
}
// - - -
-void KAsteroidsView::timerEvent( QTimerEvent * )
+void KAsteroidsView::timerEvent( TQTimerEvent * )
{
field.advance();
- QCanvasSprite *rock;
+ TQCanvasSprite *rock;
// move rocks forward
for ( rock = rocks.first(); rock; rock = rocks.next() ) {
@@ -380,7 +380,7 @@ void KAsteroidsView::timerEvent( QTimerEvent * )
mFrameNum++;
}
-void KAsteroidsView::wrapSprite( QCanvasItem *s )
+void KAsteroidsView::wrapSprite( TQCanvasItem *s )
{
int x = int(s->x() + s->boundingRect().width() / 2);
int y = int(s->y() + s->boundingRect().height() / 2);
@@ -398,7 +398,7 @@ void KAsteroidsView::wrapSprite( QCanvasItem *s )
// - - -
-void KAsteroidsView::rockHit( QCanvasItem *hit )
+void KAsteroidsView::rockHit( TQCanvasItem *hit )
{
KPowerup *nPup = 0;
int rnd = static_cast<int>(krandom.getDouble()*30.0) % 30;
@@ -455,7 +455,7 @@ void KAsteroidsView::rockHit( QCanvasItem *hit )
else if ( dy < -maxRockSpeed )
dy = -maxRockSpeed;
- QCanvasSprite *nrock;
+ TQCanvasSprite *nrock;
for ( int i = 0; i < 4; i++ )
{
@@ -484,7 +484,7 @@ void KAsteroidsView::rockHit( QCanvasItem *hit )
}
else if ( hit->rtti() == ID_ROCK_SMALL )
emit rockHit( 2 );
- rocks.removeRef( (QCanvasSprite *)hit );
+ rocks.removeRef( (TQCanvasSprite *)hit );
if ( rocks.count() == 0 )
emit rocksRemoved();
}
@@ -524,7 +524,7 @@ void KAsteroidsView::processMissiles()
// if a missile has hit a rock, remove missile and break rock into smaller
// rocks or remove completely.
- QPtrListIterator<KMissile> it(missiles);
+ TQPtrListIterator<KMissile> it(missiles);
for ( ; it.current(); ++it )
{
@@ -539,8 +539,8 @@ void KAsteroidsView::processMissiles()
wrapSprite( missile );
- QCanvasItemList hits = missile->collisions( true );
- QCanvasItemList::Iterator hit;
+ TQCanvasItemList hits = missile->collisions( true );
+ TQCanvasItemList::Iterator hit;
for ( hit = hits.begin(); hit != hits.end(); ++hit )
{
if ( (*hit)->rtti() >= ID_ROCK_LARGE &&
@@ -572,8 +572,8 @@ void KAsteroidsView::processShip()
shield->setFrame( (shield->frame()+1) % shield->frameCount() );
shield->move( ship->x() - 9, ship->y() - 9 );
- QCanvasItemList hits = shield->collisions( true );
- QCanvasItemList::Iterator it;
+ TQCanvasItemList hits = shield->collisions( true );
+ TQCanvasItemList::Iterator it;
for ( it = hits.begin(); it != hits.end(); ++it )
{
if ( (*it)->rtti() >= ID_ROCK_LARGE &&
@@ -610,8 +610,8 @@ void KAsteroidsView::processShip()
if ( !shieldOn )
{
shield->hide();
- QCanvasItemList hits = ship->collisions( true );
- QCanvasItemList::Iterator it;
+ TQCanvasItemList hits = ship->collisions( true );
+ TQCanvasItemList::Iterator it;
for ( it = hits.begin(); it != hits.end(); ++it )
{
if ( (*it)->rtti() >= ID_ROCK_LARGE &&
@@ -780,7 +780,7 @@ void KAsteroidsView::processPowerups()
// destroy it
KPowerup *pup;
- QPtrListIterator<KPowerup> it( powerups );
+ TQPtrListIterator<KPowerup> it( powerups );
for( ; (pup = it.current()); )
{
@@ -795,8 +795,8 @@ void KAsteroidsView::processPowerups()
wrapSprite( pup );
- QCanvasItemList hits = pup->collisions( true );
- QCanvasItemList::Iterator it;
+ TQCanvasItemList hits = pup->collisions( true );
+ TQCanvasItemList::Iterator it;
for ( it = hits.begin(); it != hits.end(); ++it )
{
if ( (*it) == ship || (*it) == shield )
diff --git a/kasteroids/view.h b/kasteroids/view.h
index 6807037a..5d62f640 100644
--- a/kasteroids/view.h
+++ b/kasteroids/view.h
@@ -7,11 +7,11 @@
#ifndef __AST_VIEW_H__
#define __AST_VIEW_H__
-#include <qwidget.h>
-#include <qptrlist.h>
-#include <qtimer.h>
-#include <qcanvas.h>
-#include <qintdict.h>
+#include <tqwidget.h>
+#include <tqptrlist.h>
+#include <tqtimer.h>
+#include <tqcanvas.h>
+#include <tqintdict.h>
#include "sprites.h"
#include <krandomsequence.h>
@@ -21,7 +21,7 @@ class KAsteroidsView : public QWidget
{
Q_OBJECT
public:
- KAsteroidsView( QWidget *parent = 0, const char *name = 0 );
+ KAsteroidsView( TQWidget *parent = 0, const char *name = 0 );
virtual ~KAsteroidsView();
int refreshRate;
@@ -42,7 +42,7 @@ public:
void brake( bool b );
void pause( bool p);
- void showText( const QString &text, const QColor &color, bool scroll=TRUE );
+ void showText( const TQString &text, const TQColor &color, bool scroll=TRUE );
void hideText();
int shots() const { return shotsFired; }
@@ -65,8 +65,8 @@ private slots:
protected:
void readSprites();
- void wrapSprite( QCanvasItem * );
- void rockHit( QCanvasItem * );
+ void wrapSprite( TQCanvasItem * );
+ void rockHit( TQCanvasItem * );
void reducePower( int val );
void addExhaust( double x, double y, double dx, double dy, int count );
void processMissiles();
@@ -74,21 +74,21 @@ protected:
void processPowerups();
void processShield();
- virtual void resizeEvent( QResizeEvent *event );
- virtual void timerEvent( QTimerEvent * );
+ virtual void resizeEvent( TQResizeEvent *event );
+ virtual void timerEvent( TQTimerEvent * );
private:
- QCanvas field;
- QCanvasView view;
- QIntDict<QCanvasPixmapArray> animation;
- QPtrList<QCanvasSprite> rocks;
- QPtrList<KMissile> missiles;
- QPtrList<KBit> bits;
- QPtrList<KExhaust> exhaust;
- QPtrList<KPowerup> powerups;
+ TQCanvas field;
+ TQCanvasView view;
+ TQIntDict<TQCanvasPixmapArray> animation;
+ TQPtrList<TQCanvasSprite> rocks;
+ TQPtrList<KMissile> missiles;
+ TQPtrList<KBit> bits;
+ TQPtrList<KExhaust> exhaust;
+ TQPtrList<KPowerup> powerups;
KShield *shield;
- QCanvasSprite *ship;
- QCanvasText *textSprite;
+ TQCanvasSprite *ship;
+ TQCanvasText *textSprite;
bool rotateL;
bool rotateR;
@@ -127,7 +127,7 @@ private:
double powerupSpeed;
KRandomSequence krandom;
- QTimer *shieldTimer;
+ TQTimer *shieldTimer;
};
#endif