diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:42:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:42:31 +0000 |
commit | 576eb4299a00bc053db35414406f46372a0f70f2 (patch) | |
tree | 4c030922d533821db464af566188e7d40cc8848c /kspaceduel | |
parent | 0718336b6017d1a4fc1d626544180a5a2a29ddec (diff) | |
download | tdegames-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 'kspaceduel')
-rw-r--r-- | kspaceduel/ai.cpp | 10 | ||||
-rw-r--r-- | kspaceduel/ai.h | 24 | ||||
-rw-r--r-- | kspaceduel/defines.h | 2 | ||||
-rw-r--r-- | kspaceduel/dialogs.cpp | 62 | ||||
-rw-r--r-- | kspaceduel/dialogs.h | 12 | ||||
-rw-r--r-- | kspaceduel/mainview.cpp | 80 | ||||
-rw-r--r-- | kspaceduel/mainview.h | 52 | ||||
-rw-r--r-- | kspaceduel/playerinfo.cpp | 30 | ||||
-rw-r--r-- | kspaceduel/playerinfo.h | 16 | ||||
-rw-r--r-- | kspaceduel/sprites.cpp | 32 | ||||
-rw-r--r-- | kspaceduel/sprites.h | 20 | ||||
-rw-r--r-- | kspaceduel/topwidget.cpp | 36 | ||||
-rw-r--r-- | kspaceduel/topwidget.h | 2 |
13 files changed, 189 insertions, 189 deletions
diff --git a/kspaceduel/ai.cpp b/kspaceduel/ai.cpp index 5a7bec20..828c5e35 100644 --- a/kspaceduel/ai.cpp +++ b/kspaceduel/ai.cpp @@ -10,8 +10,8 @@ int Ai::calcShotDirections[Options::EnumAiDifficulty::COUNT] = {4,7,10,12}; int Ai::calcCollisions[Options::EnumAiDifficulty::COUNT] = {30,15,10,10}; int Ai::calcNextShot[Options::EnumAiDifficulty::COUNT] = {300,200,90,60}; -Ai::Ai(int pn,ShipSprite* s[2],QPtrList<BulletSprite>* b[2], - QPtrList<MineSprite>* m[2],SConfig *c) +Ai::Ai(int pn,ShipSprite* s[2],TQPtrList<BulletSprite>* b[2], + TQPtrList<MineSprite>* m[2],SConfig *c) { int i; @@ -24,9 +24,9 @@ Ai::Ai(int pn,ShipSprite* s[2],QPtrList<BulletSprite>* b[2], ship[i]=s[i]; bullets[i]=b[i]; mines[i]=m[i]; - shipsNextPositions[i]=new QMemArray<AiSprite> + shipsNextPositions[i]=new TQMemArray<AiSprite> ((int)(calcPositionNumber[Options::aiDifficulty(playerNumber)]/cfg->gamespeed)); - aiMines[i]=new QMemArray<AiSprite>(cfg->maxMines); + aiMines[i]=new TQMemArray<AiSprite>(cfg->maxMines); mineNumber[i]=0; } myShots.setAutoDelete(true); @@ -158,7 +158,7 @@ AiSprite Ai::nextPosition(AiSprite sp,double mult) return sp; } -void Ai::nextPositions(AiSprite sp,QMemArray<AiSprite> *a,int frames) +void Ai::nextPositions(AiSprite sp,TQMemArray<AiSprite> *a,int frames) { int i,num; double fmult=cfg->gamespeed*frames; diff --git a/kspaceduel/ai.h b/kspaceduel/ai.h index 0369ea02..8e258d6a 100644 --- a/kspaceduel/ai.h +++ b/kspaceduel/ai.h @@ -3,8 +3,8 @@ #include <krandomsequence.h> -#include <qptrlist.h> -#include <qmemarray.h> +#include <tqptrlist.h> +#include <tqmemarray.h> #include "sprites.h" #include "dialogs.h" @@ -39,8 +39,8 @@ struct Shot class Ai { public: - Ai(int pn,ShipSprite* s[2],QPtrList<BulletSprite> *b[2], - QPtrList<MineSprite> *m[2],SConfig *c); + Ai(int pn,ShipSprite* s[2],TQPtrList<BulletSprite> *b[2], + TQPtrList<MineSprite> *m[2],SConfig *c); void newRound(); void think(); bool rotateLeft(){return rotation==RLEFT;} @@ -50,7 +50,7 @@ public: bool layMine(){return mine;} private: AiSprite nextPosition(AiSprite sp,double mult); - void nextPositions(AiSprite sp,QMemArray<AiSprite> *a,int frames); + void nextPositions(AiSprite sp,TQMemArray<AiSprite> *a,int frames); Hit firstObject(AiSprite shot,int shotframes,int frames); void shotScores(); void calculateNextPositions(); @@ -74,15 +74,15 @@ private: //sprites int playerNumber,opponentNumber; ShipSprite *ship[2]; - QPtrList<BulletSprite> *bullets[2]; - QPtrList<MineSprite> *mines[2]; - QMemArray<AiSprite> *shipsNextPositions[2]; - QMemArray<AiSprite> *aiMines[2]; + TQPtrList<BulletSprite> *bullets[2]; + TQPtrList<MineSprite> *mines[2]; + TQMemArray<AiSprite> *shipsNextPositions[2]; + TQMemArray<AiSprite> *aiMines[2]; int mineNumber[2]; //possible Hits - QPtrList<Shot> myShots; - QPtrList<Hit> objectsHitByShip; - QPtrList<Hit> minesHitByShot; + TQPtrList<Shot> myShots; + TQPtrList<Hit> objectsHitByShip; + TQPtrList<Hit> minesHitByShot; int borderTime; int sunTime; //SpriteField width and height diff --git a/kspaceduel/defines.h b/kspaceduel/defines.h index 81162d77..edd4835e 100644 --- a/kspaceduel/defines.h +++ b/kspaceduel/defines.h @@ -1,4 +1,4 @@ -#include <qnamespace.h> +#include <tqnamespace.h> #define IDS_PAUSE 1 diff --git a/kspaceduel/dialogs.cpp b/kspaceduel/dialogs.cpp index 9e5b4b7a..c8ec2632 100644 --- a/kspaceduel/dialogs.cpp +++ b/kspaceduel/dialogs.cpp @@ -1,9 +1,9 @@ -#include <qlabel.h> -#include <qcombobox.h> -#include <qtabwidget.h> -#include <qslider.h> -#include <qlcdnumber.h> -#include <qlayout.h> +#include <tqlabel.h> +#include <tqcombobox.h> +#include <tqtabwidget.h> +#include <tqslider.h> +#include <tqlcdnumber.h> +#include <tqlayout.h> #include <klocale.h> @@ -113,13 +113,13 @@ int ConfigSetup::Position[EditNum]= const int LCDLen=6; -ConfigSetup::ConfigSetup(SConfig *custom,QWidget *parent,const char *name) - :QWidget( parent, name ) +ConfigSetup::ConfigSetup(SConfig *custom,TQWidget *parent,const char *name) + :TQWidget( parent, name ) { - QLabel *label[EditNum]; - QGridLayout *stacklayout[TabNum]; - QWidget *configWidgets[TabNum]; - //QGroupBox *box; + TQLabel *label[EditNum]; + TQGridLayout *stacklayout[TabNum]; + TQWidget *configWidgets[TabNum]; + //TQGroupBox *box; int i; @@ -128,31 +128,31 @@ ConfigSetup::ConfigSetup(SConfig *custom,QWidget *parent,const char *name) //setHelp( "OptionsConfigurations" ); - //box=new QGroupBox(i18n("Config"),this); + //box=new TQGroupBox(i18n("Config"),this); //setMainWidget( box ); - QVBoxLayout *boxlayout = new QVBoxLayout( this, 6 ); + TQVBoxLayout *boxlayout = new TQVBoxLayout( this, 6 ); - tabs=new QTabWidget(this); + tabs=new TQTabWidget(this); for(i=0;i<TabNum;i++) { - configWidgets[i]=new QWidget(tabs); - stacklayout[i]=new QGridLayout(configWidgets[i],6,3,10); + configWidgets[i]=new TQWidget(tabs); + stacklayout[i]=new TQGridLayout(configWidgets[i],6,3,10); } for(i=0;i<EditNum;i++) { - label[i]=new QLabel(i18n(LabelName[i]),configWidgets[Parent[i]]); - slider[i]=new QSlider(EditVal[i][0]*EditDiv[i],EditVal[i][1]*EditDiv[i], + label[i]=new TQLabel(i18n(LabelName[i]),configWidgets[Parent[i]]); + slider[i]=new TQSlider(EditVal[i][0]*EditDiv[i],EditVal[i][1]*EditDiv[i], (EditVal[i][1]-EditVal[i][0])/10, EditVal[i][2]*EditDiv[i], - QSlider::Horizontal,configWidgets[Parent[i]]); - connect(slider[i],SIGNAL(valueChanged(int)),SLOT(sliderChanged(int))); - value[i]=new QLCDNumber(LCDLen,configWidgets[Parent[i]]); - value[i]->setFrameStyle(QFrame::NoFrame); + TQSlider::Horizontal,configWidgets[Parent[i]]); + connect(slider[i],TQT_SIGNAL(valueChanged(int)),TQT_SLOT(sliderChanged(int))); + value[i]=new TQLCDNumber(LCDLen,configWidgets[Parent[i]]); + value[i]->setFrameStyle(TQFrame::NoFrame); } - configCombo=new QComboBox(false,this); - connect(configCombo,SIGNAL(activated(int)),SLOT(configSelected(int))); + configCombo=new TQComboBox(false,this); + connect(configCombo,TQT_SIGNAL(activated(int)),TQT_SLOT(configSelected(int))); for(i=0;i<predefinedConfigNum;i++) configCombo->insertItem(i18n(predefinedConfigName[i])); configCombo->insertItem(i18n("Custom")); @@ -329,7 +329,7 @@ void ConfigSetup::displayConfig(SConfig cfg) void ConfigSetup::setValue(int ednum,int val) { - QString str; + TQString str; str.sprintf("%*i",LCDLen,val); value[ednum]->display(str); slider[ednum]->setValue(val); @@ -337,7 +337,7 @@ void ConfigSetup::setValue(int ednum,int val) void ConfigSetup::setValue(int ednum,double val) { - QString str; + TQString str; int hval=(int)(val*EditDiv[ednum]+0.5); int n,h; @@ -356,7 +356,7 @@ void ConfigSetup::setValue(int ednum,double val) void ConfigSetup::setValue(int ednum,unsigned val) { - QString str; + TQString str; str.sprintf("%*i",LCDLen,(int)val); value[ednum]->display(str); slider[ednum]->setValue((int)val); @@ -365,7 +365,7 @@ void ConfigSetup::setValue(int ednum,unsigned val) void ConfigSetup::sliderChanged(int val) { int i,n,h; - QString str; + TQString str; for(i=0;(i<EditNum)&&(slider[i]!=sender());i++); if(i<EditNum) @@ -388,7 +388,7 @@ void ConfigSetup::sliderChanged(int val) } -SettingsDialog::SettingsDialog(SConfig *customConfig, QWidget *parent, const char *name) +SettingsDialog::SettingsDialog(SConfig *customConfig, TQWidget *parent, const char *name) : KConfigDialog( parent, name, Options::self()) { General *general = new General(); @@ -396,7 +396,7 @@ SettingsDialog::SettingsDialog(SConfig *customConfig, QWidget *parent, const cha cs = new ConfigSetup(customConfig); addPage(cs, i18n("Game"), "kspaceduel", i18n("Game Settings")); - connect(cs, SIGNAL(changed()), this, SLOT(updateButtons())); + connect(cs, TQT_SIGNAL(changed()), this, TQT_SLOT(updateButtons())); // resize(600,400); } diff --git a/kspaceduel/dialogs.h b/kspaceduel/dialogs.h index 1a1ef6d2..2cfe08ba 100644 --- a/kspaceduel/dialogs.h +++ b/kspaceduel/dialogs.h @@ -19,7 +19,7 @@ class ConfigSetup:public QWidget { Q_OBJECT public: - ConfigSetup(SConfig *custom,QWidget *parent=0,const char* name=0); + ConfigSetup(SConfig *custom,TQWidget *parent=0,const char* name=0); bool hasChanged(); bool isDefault(); @@ -65,12 +65,12 @@ private: static int EditDiv[EditNum]; static Type VarType[EditNum]; - QTabWidget *tabs; + TQTabWidget *tabs; - QSlider *slider[EditNum]; - QLCDNumber *value[EditNum]; + TQSlider *slider[EditNum]; + TQLCDNumber *value[EditNum]; - QComboBox *configCombo; + TQComboBox *configCombo; SConfig *customConfig,config; int selectedConfig; @@ -80,7 +80,7 @@ class SettingsDialog : public KConfigDialog { Q_OBJECT public: - SettingsDialog(SConfig *customConfig, QWidget *parent=0, const char *name=0); + SettingsDialog(SConfig *customConfig, TQWidget *parent=0, const char *name=0); ~SettingsDialog(); signals: diff --git a/kspaceduel/mainview.cpp b/kspaceduel/mainview.cpp index 0d385a49..5448c1a3 100644 --- a/kspaceduel/mainview.cpp +++ b/kspaceduel/mainview.cpp @@ -1,9 +1,9 @@ #include "mainview.h" #include <math.h> -#include <qbitmap.h> -#include <qfile.h> -#include <qvbox.h> +#include <tqbitmap.h> +#include <tqfile.h> +#include <tqvbox.h> #include <kapplication.h> #include <kaction.h> @@ -18,20 +18,20 @@ KToggleAction *MyMainView::pauseAction = 0; -MyMainView::MyMainView(QWidget *parent) - :QWidget(parent), +MyMainView::MyMainView(TQWidget *parent) + :TQWidget(parent), field(DEF_WIDTH,DEF_HEIGHT), view(&field,this) { int i,p; setMinimumSize(600,400); random.setSeed(0); - QPixmap backgr(locate("appdata", MV_BACKGROUND)); + TQPixmap backgr(locate("appdata", MV_BACKGROUND)); field.setBackgroundPixmap(backgr); - view.setResizePolicy(QScrollView::AutoOne); - view.setHScrollBarMode(QScrollView::AlwaysOff); - view.setVScrollBarMode(QScrollView::AlwaysOff); + view.setResizePolicy(TQScrollView::AutoOne); + view.setHScrollBarMode(TQScrollView::AlwaysOff); + view.setVScrollBarMode(TQScrollView::AlwaysOff); for(p=0;p<2;p++) { @@ -41,9 +41,9 @@ MyMainView::MyMainView(QWidget *parent) minePut[p]=false; } - QString tmp = KGlobal::dirs()->findResourceDir("appdata", (QString)MV_BACKGROUND); + TQString tmp = KGlobal::dirs()->findResourceDir("appdata", (TQString)MV_BACKGROUND); - QCanvasPixmapArray *sunsequence + TQCanvasPixmapArray *sunsequence = loadOldPixmapSequence( tmp + MV_SUN_PPM, tmp + MV_SUN_PBM ); sun=new SunSprite(sunsequence, &field); sun->move(width()/2-1,height()/2-1); @@ -82,9 +82,9 @@ MyMainView::MyMainView(QWidget *parent) { // ship[i]->setBoundsAction(QwRealMobileSprite::Wrap); ship[i]->hide(); - bullets[i]=new QPtrList<BulletSprite>; + bullets[i]=new TQPtrList<BulletSprite>; bullets[i]->setAutoDelete(true); - mines[i]=new QPtrList<MineSprite>; + mines[i]=new TQPtrList<MineSprite>; mines[i]->setAutoDelete(true); } @@ -233,7 +233,7 @@ SConfig MyMainView::modifyConfig(SConfig conf) return newConfig; } -void MyMainView::keyPressEvent(QKeyEvent *ev) +void MyMainView::keyPressEvent(TQKeyEvent *ev) { if((gameEnd<=0.0)&&(gameEnd>-2.0)) { @@ -297,7 +297,7 @@ void MyMainView::keyPressEvent(QKeyEvent *ev) } } -void MyMainView::keyReleaseEvent(QKeyEvent *ev) +void MyMainView::keyReleaseEvent(TQKeyEvent *ev) { KKey key(ev); bool accept=true; @@ -387,7 +387,7 @@ void MyMainView::togglePause( ) pause( ); } -void MyMainView::resizeEvent(QResizeEvent *event) +void MyMainView::resizeEvent(TQResizeEvent *event) { double mx,my; MineSprite *mine; @@ -397,7 +397,7 @@ void MyMainView::resizeEvent(QResizeEvent *event) mx=(event->size().width()-event->oldSize().width())/2.0; my=(event->size().height()-event->oldSize().height())/2.0; - QWidget::resizeEvent(event); + TQWidget::resizeEvent(event); view.resize(width(),height()); field.resize(width(),height()); @@ -491,7 +491,7 @@ void MyMainView::newRound() } field.update(); - QString str = i18n("Press %1 to start") + TQString str = i18n("Press %1 to start") .arg(KShortcut(GAME_START_SHORTCUT).toString()); emit(setStatusText(str,IDS_MAIN)); emit( setStatusText( "", IDS_PAUSE ) ); @@ -509,7 +509,7 @@ void MyMainView::newGame() newRound(); } -void MyMainView::timerEvent(QTimerEvent *event) +void MyMainView::timerEvent(TQTimerEvent *event) { unsigned w; int i; @@ -531,11 +531,11 @@ void MyMainView::timerEvent(QTimerEvent *event) textSprite=0; } - textSprite=new QCanvasText(&field); + textSprite=new TQCanvasText(&field); textSprite->move(width()/2,height()/2-90); textSprite->setTextFlags(AlignCenter); textSprite->setColor(qRgb(255,160,0)); - textSprite->setFont(QFont(KGlobalSettings::generalFont().family(),14)); + textSprite->setFont(TQFont(KGlobalSettings::generalFont().family(),14)); textSprite->show( ); if(ship[0]->getHitPoints()==0) { @@ -556,7 +556,7 @@ void MyMainView::timerEvent(QTimerEvent *event) ship[0]->setWins(w); emit(wins(0,w)); } - QString str = i18n("Press %1 for new round") + TQString str = i18n("Press %1 for new round") .arg(KShortcut(GAME_START_SHORTCUT).toString()); emit(setStatusText(str,IDS_MAIN)); stop( ); @@ -789,17 +789,17 @@ void MyMainView::calculatePowerups() void MyMainView::collisions() { int pl,hp,op,oldhp[2],ohp; - QCanvasItemList unexact; - QCanvasItem *sprite; + TQCanvasItemList unexact; + TQCanvasItem *sprite; BulletSprite *bullet; MineSprite *mine; ExplosionSprite *expl; ShipSprite *s; PowerupSprite *power; - QCanvasItemList hitlist; + TQCanvasItemList hitlist; double ndx[2],ndy[2]; double en; - QCanvasItemList::Iterator it; + TQCanvasItemList::Iterator it; for(pl=0;pl<2;pl++) { @@ -990,7 +990,7 @@ void MyMainView::gameSetup() return; SettingsDialog *settings=new SettingsDialog(&customConfig,this,"settings"); - connect(settings, SIGNAL(settingsUpdated()),this,SLOT(closeSettings())); + connect(settings, TQT_SIGNAL(settingsUpdated()),this,TQT_SLOT(closeSettings())); settings->show(); } @@ -1001,17 +1001,17 @@ void MyMainView::closeSettings(){ config=modifyConfig(customConfig); } -QCanvasPixmapArray* MyMainView::loadOldPixmapSequence(const QString& datapattern, - const QString& maskpattern, int framecount) +TQCanvasPixmapArray* MyMainView::loadOldPixmapSequence(const TQString& datapattern, + const TQString& maskpattern, int framecount) { int image; - QPtrList<QPixmap> pixmaplist; - QPtrList<QPoint> pointlist; - QString dataname, maskname; - QPixmap *pix; - QBitmap *bitmap; + TQPtrList<TQPixmap> pixmaplist; + TQPtrList<TQPoint> pointlist; + TQString dataname, maskname; + TQPixmap *pix; + TQBitmap *bitmap; int hotx=0, hoty=0; - QPoint *point; + TQPoint *point; for( image=0; image < framecount; image++ ) { @@ -1019,7 +1019,7 @@ QCanvasPixmapArray* MyMainView::loadOldPixmapSequence(const QString& datapattern dataname.sprintf( datapattern.ascii(), image ); maskname.sprintf( maskpattern.ascii(), image ); - QFile file(dataname); + TQFile file(dataname); if( file.open( IO_ReadOnly ) ) { char line[128]; @@ -1034,18 +1034,18 @@ QCanvasPixmapArray* MyMainView::loadOldPixmapSequence(const QString& datapattern file.readLine( line, 128 ); } - point = new QPoint( hotx, hoty ); + point = new TQPoint( hotx, hoty ); pointlist.append( point ); } - pix = new QPixmap( dataname ); - bitmap = new QBitmap( maskname ); + pix = new TQPixmap( dataname ); + bitmap = new TQBitmap( maskname ); pix->setMask( *bitmap ); pixmaplist.append( pix ); } - QCanvasPixmapArray* newarray = new QCanvasPixmapArray( pixmaplist, pointlist ); + TQCanvasPixmapArray* newarray = new TQCanvasPixmapArray( pixmaplist, pointlist ); return newarray; } diff --git a/kspaceduel/mainview.h b/kspaceduel/mainview.h index 98dd8e15..c56a4f12 100644 --- a/kspaceduel/mainview.h +++ b/kspaceduel/mainview.h @@ -1,8 +1,8 @@ #ifndef __MY_MAIN_VIEW_H #define __MY_MAIN_VIEW_H -#include <qwidget.h> -#include <qimage.h> +#include <tqwidget.h> +#include <tqimage.h> class KToggleAction; class KActionCollection; @@ -20,7 +20,7 @@ class MyMainView:public QWidget { Q_OBJECT public: - MyMainView(QWidget *parent=0); + MyMainView(TQWidget *parent=0); ~MyMainView(); static KToggleAction *pauseAction; @@ -42,16 +42,16 @@ signals: void hitPoints(int pn,int hp); void energy(int pn,int en); void wins(int pn,int w); - void setStatusText(const QString & str,int id); + void setStatusText(const TQString & str,int id); protected: - virtual void resizeEvent(QResizeEvent *event); - virtual void timerEvent(QTimerEvent *event); - virtual void keyPressEvent(QKeyEvent *event); - virtual void keyReleaseEvent(QKeyEvent *event); + virtual void resizeEvent(TQResizeEvent *event); + virtual void timerEvent(TQTimerEvent *event); + virtual void keyPressEvent(TQKeyEvent *event); + virtual void keyReleaseEvent(TQKeyEvent *event); SConfig modifyConfig(SConfig conf); - QCanvasPixmapArray* loadOldPixmapSequence(const QString& datapattern, - const QString& maskpattern, int framecount=1); + TQCanvasPixmapArray* loadOldPixmapSequence(const TQString& datapattern, + const TQString& maskpattern, int framecount=1); void moveShips(); void moveBullets(); void moveMines(); @@ -61,8 +61,8 @@ protected: private: KActionCollection *actionCollection; - QCanvas field; - QCanvasView view; + TQCanvas field; + TQCanvasView view; SConfig customConfig,config; @@ -75,24 +75,24 @@ private: double timeToNextPowerup; // sprites - QPtrList<QImage> shipImages; - QPtrList<QPoint> points; - QImage bulletImage; - QCanvasPixmapArray *bulletsequence[2]; - QCanvasPixmapArray *shipsequence[2]; - QCanvasPixmapArray *explosionsequence; - QCanvasPixmapArray *minesequence[2]; - QCanvasPixmapArray *mineexplosionsequence; - QCanvasPixmapArray *powerupsequence[PowerupSprite::PowerupNum]; + TQPtrList<TQImage> shipImages; + TQPtrList<TQPoint> points; + TQImage bulletImage; + TQCanvasPixmapArray *bulletsequence[2]; + TQCanvasPixmapArray *shipsequence[2]; + TQCanvasPixmapArray *explosionsequence; + TQCanvasPixmapArray *minesequence[2]; + TQCanvasPixmapArray *mineexplosionsequence; + TQCanvasPixmapArray *powerupsequence[PowerupSprite::PowerupNum]; ShipSprite *ship[2]; SunSprite *sun; - QCanvasText *textSprite; - QPtrList<BulletSprite> *bullets[2]; - QPtrList<MineSprite> *mines[2]; - QPtrList<ExplosionSprite> explosions; - QPtrList<PowerupSprite> powerups; + TQCanvasText *textSprite; + TQPtrList<BulletSprite> *bullets[2]; + TQPtrList<MineSprite> *mines[2]; + TQPtrList<ExplosionSprite> explosions; + TQPtrList<PowerupSprite> powerups; KRandomSequence random; diff --git a/kspaceduel/playerinfo.cpp b/kspaceduel/playerinfo.cpp index 1cd2cd31..2e1ef91d 100644 --- a/kspaceduel/playerinfo.cpp +++ b/kspaceduel/playerinfo.cpp @@ -1,29 +1,29 @@ #include "playerinfo.h" -#include <qpixmap.h> -#include <qtooltip.h> +#include <tqpixmap.h> +#include <tqtooltip.h> #include <klocale.h> #include <kstandarddirs.h> -PlayerInfo::PlayerInfo(int pnr,QWidget *parent,const char *name) - :QFrame(parent,name), +PlayerInfo::PlayerInfo(int pnr,TQWidget *parent,const char *name) + :TQFrame(parent,name), lplayer(this),lenergy(this),lwins(this), hitpoints(2,this),energy(2,this),wins(2,this) { setFixedWidth(45); setFrameStyle(Panel|Raised); - QString str; + TQString str; int i; lplayer.setFrameStyle(Panel|Sunken); lplayer.setMargin(0); - QToolTip::add(&lplayer,i18n("Hit points")); + TQToolTip::add(&lplayer,i18n("Hit points")); lenergy.setFrameStyle(Panel|Sunken); lenergy.setMargin(0); - QToolTip::add(&lenergy,i18n("Energy")); + TQToolTip::add(&lenergy,i18n("Energy")); lwins.setFrameStyle(Panel|Sunken); lwins.setMargin(0); - QToolTip::add(&lwins,i18n("Wins")); + TQToolTip::add(&lwins,i18n("Wins")); lplayer.setGeometry(5,5,35,35); lplayer.setIndent(0); @@ -34,26 +34,26 @@ PlayerInfo::PlayerInfo(int pnr,QWidget *parent,const char *name) for(i=0;i<4;i++) { - str = QString::fromLatin1("sprites/playerinfo/ship%1%2.pnm") + str = TQString::fromLatin1("sprites/playerinfo/ship%1%2.pnm") .arg(pnr+1) .arg(i); - pix[i]=new QPixmap(locate("appdata", str)); + pix[i]=new TQPixmap(locate("appdata", str)); } lplayer.setPixmap(*pix[0]); currentPixmap=0; - lenergy.setPixmap(QPixmap(locate("appdata", "sprites/playerinfo/energy.pnm"))); - lwins.setPixmap(QPixmap(locate("appdata", "sprites/playerinfo/win.pnm"))); + lenergy.setPixmap(TQPixmap(locate("appdata", "sprites/playerinfo/energy.pnm"))); + lwins.setPixmap(TQPixmap(locate("appdata", "sprites/playerinfo/win.pnm"))); hitpoints.setGeometry(9,45,26,26); energy.setGeometry(9,120,26,26); wins.setGeometry(9,195,26,26); hitpoints.setFrameStyle(NoFrame); - QToolTip::add(&hitpoints,i18n("Hit points")); + TQToolTip::add(&hitpoints,i18n("Hit points")); energy.setFrameStyle(NoFrame); - QToolTip::add(&energy,i18n("Energy")); + TQToolTip::add(&energy,i18n("Energy")); wins.setFrameStyle(NoFrame); - QToolTip::add(&wins,i18n("Wins")); + TQToolTip::add(&wins,i18n("Wins")); } void PlayerInfo::setHitpoints(int h) diff --git a/kspaceduel/playerinfo.h b/kspaceduel/playerinfo.h index e172c982..42fc8158 100644 --- a/kspaceduel/playerinfo.h +++ b/kspaceduel/playerinfo.h @@ -1,26 +1,26 @@ #ifndef __PLAYER_INFO_H #define __PLAYER_INFO_H -#include <qframe.h> -#include <qlabel.h> +#include <tqframe.h> +#include <tqlabel.h> class QPixmap; -#include <qlcdnumber.h> -#include <qcolor.h> +#include <tqlcdnumber.h> +#include <tqcolor.h> class PlayerInfo:public QFrame { Q_OBJECT public: - PlayerInfo(int pnr,QWidget *parent=0,const char *name=0); + PlayerInfo(int pnr,TQWidget *parent=0,const char *name=0); public slots: void setHitpoints(int h); void setEnergy(int e); void setWins(int w); private: - QPixmap* pix[4]; + TQPixmap* pix[4]; int currentPixmap; - QLabel lplayer,lenergy,lwins; - QLCDNumber hitpoints,energy,wins; + TQLabel lplayer,lenergy,lwins; + TQLCDNumber hitpoints,energy,wins; }; #endif diff --git a/kspaceduel/sprites.cpp b/kspaceduel/sprites.cpp index 08eab3c7..ba163429 100644 --- a/kspaceduel/sprites.cpp +++ b/kspaceduel/sprites.cpp @@ -3,25 +3,25 @@ #include <math.h> -SunSprite::SunSprite(QCanvasPixmapArray *seq, QCanvas* canvas) - :QCanvasSprite(seq, canvas) +SunSprite::SunSprite(TQCanvasPixmapArray *seq, TQCanvas* canvas) + :TQCanvasSprite(seq, canvas) { // doesn't work with Qt 2.2.2 anymore // setZ(0); } -PowerupSprite::PowerupSprite(QCanvasPixmapArray* seq, QCanvas* canvas, int t, +PowerupSprite::PowerupSprite(TQCanvasPixmapArray* seq, TQCanvas* canvas, int t, double lifetime) - :QCanvasSprite(seq, canvas) + :TQCanvasSprite(seq, canvas) { time=lifetime; type=t; } -MobileSprite::MobileSprite(QCanvasPixmapArray* seq, QCanvas* canvas, int pn) - :QCanvasSprite(seq, canvas) +MobileSprite::MobileSprite(TQCanvasPixmapArray* seq, TQCanvas* canvas, int pn) + :TQCanvasSprite(seq, canvas) { stopped=false; playerNumber=pn; @@ -31,7 +31,7 @@ void MobileSprite::forward(double mult, int fr) { if(!stopped) { - QCanvasSprite::moveBy(xVelocity()*mult,yVelocity()*mult); + TQCanvasSprite::moveBy(xVelocity()*mult,yVelocity()*mult); checkBounds(); setFrame(fr); } @@ -43,7 +43,7 @@ void MobileSprite::forward(double mult) { if(!stopped) { - QCanvasSprite::moveBy(xVelocity()*mult,yVelocity()*mult); + TQCanvasSprite::moveBy(xVelocity()*mult,yVelocity()*mult); checkBounds(); } } @@ -107,7 +107,7 @@ AiSprite MobileSprite::toAiSprite() return as; } -ShipSprite::ShipSprite(QCanvasPixmapArray* seq, QCanvas* canvas, int pn) +ShipSprite::ShipSprite(TQCanvasPixmapArray* seq, TQCanvas* canvas, int pn) :MobileSprite(seq,canvas,pn) { hitpoints=99; @@ -215,7 +215,7 @@ void ShipSprite::rotateLeft(double rotationEnergyNeed,double rotationSpeed) } } -BulletSprite::BulletSprite(QCanvasPixmapArray* seq,QCanvas* canvas, int pn,double lifetime) +BulletSprite::BulletSprite(TQCanvasPixmapArray* seq,TQCanvas* canvas, int pn,double lifetime) :MobileSprite(seq,canvas,pn) { setZ(-10); @@ -234,7 +234,7 @@ void BulletSprite::forward(double mult,int fr) time-=mult; } -MineSprite::MineSprite(QCanvasPixmapArray* seq, QCanvas* canvas, int pn,double atime,double f) +MineSprite::MineSprite(TQCanvasPixmapArray* seq, TQCanvas* canvas, int pn,double atime,double f) :MobileSprite(seq,canvas,pn) { activateTime=atime; @@ -246,7 +246,7 @@ MineSprite::MineSprite(QCanvasPixmapArray* seq, QCanvas* canvas, int pn,double a active=false; } -void MineSprite::explode(QCanvasPixmapArray *seq) +void MineSprite::explode(TQCanvasPixmapArray *seq) { setSequence(seq); timeToGo=seq->count(); @@ -304,8 +304,8 @@ void MineSprite::calculateGravity(double gravity,double mult) } } -ExplosionSprite::ExplosionSprite(QCanvasPixmapArray* seq, QCanvas* canvas, MobileSprite *sp) - :QCanvasSprite(seq, canvas) +ExplosionSprite::ExplosionSprite(TQCanvasPixmapArray* seq, TQCanvas* canvas, MobileSprite *sp) + :TQCanvasSprite(seq, canvas) { over=false; setZ(-5); @@ -333,8 +333,8 @@ void ExplosionSprite::forward(double mult) } -void ExplosionSprite::setSequence(QCanvasPixmapArray *seq) +void ExplosionSprite::setSequence(TQCanvasPixmapArray *seq) { timeToGo=seq->count(); - QCanvasSprite::setSequence(seq); + TQCanvasSprite::setSequence(seq); } diff --git a/kspaceduel/sprites.h b/kspaceduel/sprites.h index 0d0b1fb3..8011301e 100644 --- a/kspaceduel/sprites.h +++ b/kspaceduel/sprites.h @@ -1,7 +1,7 @@ #ifndef __SPRITE_OBJECTS_H #define __SPRITE_OBJECTS_H -#include <qcanvas.h> +#include <tqcanvas.h> #include "defines.h" #ifdef sun @@ -17,7 +17,7 @@ struct AiSprite class SunSprite:public QCanvasSprite { public: - SunSprite(QCanvasPixmapArray* seq, QCanvas* canvas); + SunSprite(TQCanvasPixmapArray* seq, TQCanvas* canvas); virtual int rtti() const {return S_SUN;} }; @@ -27,7 +27,7 @@ class PowerupSprite:public QCanvasSprite public: enum {PowerupMine=0, PowerupBullet, PowerupShield, PowerupEnergy, PowerupNum}; - PowerupSprite(QCanvasPixmapArray* seq, QCanvas* canvas, int t, double lifetime); + PowerupSprite(TQCanvasPixmapArray* seq, TQCanvas* canvas, int t, double lifetime); virtual int rtti() const {return S_POWERUP;} double getLifetime() {return time;} @@ -41,7 +41,7 @@ private: class MobileSprite:public QCanvasSprite { public: - MobileSprite(QCanvasPixmapArray* array, QCanvas* canvas, int pn); + MobileSprite(TQCanvasPixmapArray* array, TQCanvas* canvas, int pn); virtual void forward(double mult,int frame); virtual void forward(double mult); @@ -63,7 +63,7 @@ protected: class ShipSprite:public MobileSprite { public: - ShipSprite(QCanvasPixmapArray* seq, QCanvas* canvas, int pn); + ShipSprite(TQCanvasPixmapArray* seq, TQCanvas* canvas, int pn); virtual int rtti() const {return S_SHIP;} int getHitPoints() {return hitpoints;} void setHitPoints(int hp) {hitpoints=(hp<0?0:hp);} @@ -99,7 +99,7 @@ private: class BulletSprite:public MobileSprite { public: - BulletSprite(QCanvasPixmapArray* seq, QCanvas* canvas, int pn,double lifetime); + BulletSprite(TQCanvasPixmapArray* seq, TQCanvas* canvas, int pn,double lifetime); virtual int rtti() const {return S_BULLET;} virtual void forward(double mult); virtual void forward(double mult,int fr); @@ -111,13 +111,13 @@ private: class MineSprite:public MobileSprite { public: - MineSprite(QCanvasPixmapArray* seq, QCanvas* canvas, int pn,double atime,double f); + MineSprite(TQCanvasPixmapArray* seq, TQCanvas* canvas, int pn,double atime,double f); virtual int rtti() const {return S_MINE;} bool isActive() {return active;} double getFuel() {return fuel;} void setFuel(double f) {fuel=(f<0.0?0.0:f);} virtual void forward(double mult); - void explode(QCanvasPixmapArray* s); + void explode(TQCanvasPixmapArray* s); bool explodes() {return expl;} bool over() {return (expl&&(explosiontime>(timeToGo-0.1)));} virtual void calculateGravity(double gravity,double mult); @@ -129,11 +129,11 @@ private: class ExplosionSprite:public QCanvasSprite { public: - ExplosionSprite(QCanvasPixmapArray *seq, QCanvas* field, MobileSprite *sp); + ExplosionSprite(TQCanvasPixmapArray *seq, TQCanvas* field, MobileSprite *sp); virtual int rtti() const {return S_EXPLOSION;} bool isOver() {return over;} virtual void forward(double mult); - void setSequence(QCanvasPixmapArray *seq); + void setSequence(TQCanvasPixmapArray *seq); private: double timeToGo,time; bool over; diff --git a/kspaceduel/topwidget.cpp b/kspaceduel/topwidget.cpp index 9f275848..510da675 100644 --- a/kspaceduel/topwidget.cpp +++ b/kspaceduel/topwidget.cpp @@ -3,7 +3,7 @@ #include <kkeydialog.h> #include <kaction.h> #include <kstdgameaction.h> -#include <qlayout.h> +#include <tqlayout.h> #include <kstatusbar.h> #include "topwidget.h" @@ -19,28 +19,28 @@ MyTopLevelWidget::MyTopLevelWidget() } void MyTopLevelWidget::initGameWidgets( ){ - QWidget *w = new QWidget(this); + TQWidget *w = new TQWidget(this); playerinfo[0]=new PlayerInfo(0,w); playerinfo[1]=new PlayerInfo(1,w); playfield=new MyMainView(w); - QBoxLayout *toplayout=new QHBoxLayout(w); + TQBoxLayout *toplayout=new TQHBoxLayout(w); toplayout->addWidget(playerinfo[0]); toplayout->addWidget(playfield); toplayout->addWidget(playerinfo[1]); toplayout->activate(); - playfield->setFocusPolicy(QWidget::StrongFocus); + playfield->setFocusPolicy(TQWidget::StrongFocus); playfield->setFocus(); - QObject::connect(playfield,SIGNAL(energy(int,int)), - SLOT(energy(int,int))); - QObject::connect(playfield,SIGNAL(hitPoints(int,int)), - SLOT(hitPoints(int,int))); - QObject::connect(playfield,SIGNAL(wins(int,int)),SLOT(wins(int,int))); - QObject::connect(playfield,SIGNAL(setStatusText(const QString &,int)), - SLOT(setStatusText(const QString &,int))); + TQObject::connect(playfield,TQT_SIGNAL(energy(int,int)), + TQT_SLOT(energy(int,int))); + TQObject::connect(playfield,TQT_SIGNAL(hitPoints(int,int)), + TQT_SLOT(hitPoints(int,int))); + TQObject::connect(playfield,TQT_SIGNAL(wins(int,int)),TQT_SLOT(wins(int,int))); + TQObject::connect(playfield,TQT_SIGNAL(setStatusText(const TQString &,int)), + TQT_SLOT(setStatusText(const TQString &,int))); setCentralWidget(w); } @@ -62,18 +62,18 @@ void MyTopLevelWidget::wins(int pn,int w) void MyTopLevelWidget::initActions( ) { - KStdGameAction::quit(this, SLOT(close()), actionCollection()); - KStdGameAction::gameNew(playfield, SLOT(newGame()), actionCollection()); + KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection()); + KStdGameAction::gameNew(playfield, TQT_SLOT(newGame()), actionCollection()); ( void )new KAction( i18n( "&New Round" ), "spnewround", - CTRL + Key_R, playfield, SLOT( newRound( ) ), + CTRL + Key_R, playfield, TQT_SLOT( newRound( ) ), actionCollection( ), "new_round" ); MyMainView::pauseAction = - KStdGameAction::pause(playfield, SLOT(togglePause()), actionCollection()); + KStdGameAction::pause(playfield, TQT_SLOT(togglePause()), actionCollection()); MyMainView::pauseAction->setChecked( false ); KAction* gameStart = new KAction( i18n( "Start" ), GAME_START_SHORTCUT, - playfield, SLOT( start( ) ), actionCollection( ), "game_start" ); + playfield, TQT_SLOT( start( ) ), actionCollection( ), "game_start" ); - KStdAction::preferences(playfield, SLOT(gameSetup()), actionCollection()); + KStdAction::preferences(playfield, TQT_SLOT(gameSetup()), actionCollection()); KAccel* acc = new KAccel(this); gameStart->plugAccel(acc); @@ -130,7 +130,7 @@ void MyTopLevelWidget::start() playfield->newRound(); } -void MyTopLevelWidget::setStatusText(const QString & str,int id) +void MyTopLevelWidget::setStatusText(const TQString & str,int id) { statusBar( )->changeItem(str,id); } diff --git a/kspaceduel/topwidget.h b/kspaceduel/topwidget.h index 39c0f5d3..7c86a39c 100644 --- a/kspaceduel/topwidget.h +++ b/kspaceduel/topwidget.h @@ -14,7 +14,7 @@ public: void start(); private slots: - void setStatusText(const QString & text,int id); + void setStatusText(const TQString & text,int id); void keySetup(); void energy(int pn,int en); void hitPoints(int pn,int hp); |