summaryrefslogtreecommitdiffstats
path: root/kbounce
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
commit838baf3f99ec5ab81b063eb5449a3381d860f377 (patch)
treedd31abcfde08ca92e4623b8f50b3d762a87c997a /kbounce
parent2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff)
downloadtdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz
tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbounce')
-rw-r--r--kbounce/game.cpp34
-rw-r--r--kbounce/game.h22
-rw-r--r--kbounce/highscores.cpp2
-rw-r--r--kbounce/kbounce.cpp48
-rw-r--r--kbounce/kbounce.h1
5 files changed, 56 insertions, 51 deletions
diff --git a/kbounce/game.cpp b/kbounce/game.cpp
index 0c5f1e2d..84cfae2f 100644
--- a/kbounce/game.cpp
+++ b/kbounce/game.cpp
@@ -136,8 +136,8 @@ bool Ball::collide( double dx, double dy )
/*************************************************************************/
-Wall::Wall( JezzField *field, int x, int y, Direction dir, int tile, TQObject *parent, const char *name )
- : TQObject( parent, name ), m_dir( dir ), m_field( field ), m_startX( x ), m_startY( y ),
+Wall::Wall( JezzField *field, int x, int y, Direction dir, int tile, TQObject *tqparent, const char *name )
+ : TQObject( tqparent, name ), m_dir( dir ), m_field( field ), m_startX( x ), m_startY( y ),
m_tile( tile ), m_delay( MS2TICKS(WALL_DELAY)/2 ), m_active( true )
{
//kdDebug(12008) << "Wall::Wall" << endl;
@@ -236,8 +236,8 @@ void Wall::fill( bool black )
/*************************************************************************/
-JezzField::JezzField( const TQPixmap &tiles, const TQPixmap &background, TQObject* parent, const char* name )
- : TQCanvas( parent, name ), m_tiles( tiles )
+JezzField::JezzField( const TQPixmap &tiles, const TQPixmap &background, TQObject* tqparent, const char* name )
+ : TQCanvas( tqparent, name ), m_tiles( tiles )
{
setPixmaps( tiles, background );
}
@@ -314,8 +314,8 @@ void JezzField::setPixmaps( const TQPixmap &tiles, const TQPixmap &background )
/*************************************************************************/
-JezzView::JezzView(TQCanvas* viewing, TQWidget* parent, const char* name, WFlags f)
- : TQCanvasView( viewing, parent, name, f ), m_vertical( false )
+JezzView::JezzView(TQCanvas* viewing, TQWidget* tqparent, const char* name, WFlags f)
+ : TQCanvasView( viewing, tqparent, name, f ), m_vertical( false )
{
setResizePolicy( AutoOne );
setHScrollBarMode( AlwaysOff );
@@ -326,13 +326,13 @@ JezzView::JezzView(TQCanvas* viewing, TQWidget* parent, const char* name, WFlags
void JezzView::viewportMouseReleaseEvent( TQMouseEvent *ev )
{
- if ( ev->button() & RightButton )
+ if ( ev->button() & Qt::RightButton )
{
m_vertical = !m_vertical;
if ( m_vertical ) setCursor( sizeVerCursor ); else setCursor( sizeHorCursor );
}
- if ( ev->button() & LeftButton )
+ if ( ev->button() & Qt::LeftButton )
{
emit buildWall( ev->x()/TILE_SIZE, ev->y()/TILE_SIZE, m_vertical );
}
@@ -340,8 +340,8 @@ void JezzView::viewportMouseReleaseEvent( TQMouseEvent *ev )
/*************************************************************************/
-JezzGame::JezzGame( const TQPixmap &background, int ballNum, TQWidget *parent, const char *name )
- : TQWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ),
+JezzGame::JezzGame( const TQPixmap &background, int ballNum, TQWidget *tqparent, const char *name )
+ : TQWidget( tqparent, name ), m_wall1( 0 ), m_wall2( 0 ),
m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false )
{
TQString path = kapp->dirs()->findResourceDir( "data", "kbounce/pics/ball0000.png" ) + "kbounce/pics/";
@@ -363,7 +363,7 @@ JezzGame::JezzGame( const TQPixmap &background, int ballNum, TQWidget *parent, c
"kbounce/sounds/";
// create field
- m_field = new JezzField( tiles, background, this, "m_field" );
+ m_field = new JezzField( tiles, background, TQT_TQOBJECT(this), "m_field" );
m_field->resize( TILE_SIZE*FIELD_WIDTH, TILE_SIZE*FIELD_HEIGHT );
for ( int x=0; x<FIELD_WIDTH; x++ )
@@ -406,7 +406,7 @@ JezzGame::JezzGame( const TQPixmap &background, int ballNum, TQWidget *parent, c
connect( m_clock, TQT_SIGNAL(timeout()), this, TQT_SLOT(tick()) );
m_clock->start( GAME_DELAY );
- // setup geometry
+ // setup tqgeometry
setFixedSize( m_view->size() );
}
@@ -500,7 +500,7 @@ void JezzGame::makeBlack()
}
m_field->update();
- m_view->repaint();
+ m_view->tqrepaint();
// count percent value of occupied area
int p = percent();
@@ -586,7 +586,7 @@ void JezzGame::ballCollision( Ball */*ball*/, int /*x*/, int /*y*/, int tile )
// update view
m_field->update();
- m_view->repaint();
+ m_view->tqrepaint();
// send death msg
emit died();
@@ -617,7 +617,7 @@ void JezzGame::buildWall( int x, int y, bool vertical )
m_wall1 = new Wall( m_field, x, y,
vertical? Wall::Up : Wall::Left,
vertical? TILE_WALLUP : TILE_WALLLEFT,
- this, "m_wall1" );
+ TQT_TQOBJECT(this), "m_wall1" );
connect( m_wall1, TQT_SIGNAL(finished(Wall *, int)),
this, TQT_SLOT(wallFinished(Wall *, int)) ); }
@@ -626,7 +626,7 @@ void JezzGame::buildWall( int x, int y, bool vertical )
m_wall2 = new Wall( m_field, x, y,
vertical? Wall::Down: Wall::Right,
vertical? TILE_WALLDOWN : TILE_WALLRIGHT,
- this, "m_wall2" );
+ TQT_TQOBJECT(this), "m_wall2" );
connect( m_wall2, TQT_SIGNAL(finished(Wall *, int)),
this, TQT_SLOT(wallFinished(Wall *, int)) );
}
@@ -671,7 +671,7 @@ void JezzGame::wallFinished( Wall *wall, int tile )
}
m_field->update();
- m_view->repaint();
+ m_view->tqrepaint();
makeBlack();
}
diff --git a/kbounce/game.h b/kbounce/game.h
index 1f66c288..d07516de 100644
--- a/kbounce/game.h
+++ b/kbounce/game.h
@@ -35,7 +35,7 @@ class JezzField;
#define FIELD_WIDTH 32
#define FIELD_HEIGHT 20
-class Ball : public QCanvasSprite
+class Ball : public TQCanvasSprite
{
public:
Ball(TQCanvasPixmapArray* array, TQCanvas* canvas);
@@ -50,14 +50,15 @@ class Ball : public QCanvasSprite
};
-class Wall : public QObject
+class Wall : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
enum Direction { Up, Down, Left, Right };
Wall( JezzField *field, int x, int y, Direction dir, int tile,
- TQObject *parent=0, const char *name=0 );
+ TQObject *tqparent=0, const char *name=0 );
void finish();
void fill( bool black );
@@ -83,11 +84,12 @@ private:
};
-class JezzField : public QCanvas
+class JezzField : public TQCanvas
{
Q_OBJECT
+ TQ_OBJECT
public:
- JezzField( const TQPixmap &tiles, const TQPixmap &background, TQObject* parent = 0, const char* name = 0 );
+ JezzField( const TQPixmap &tiles, const TQPixmap &background, TQObject* tqparent = 0, const char* name = 0 );
void setGameTile( int x, int y, bool black );
void setBackground( const TQPixmap &background );
@@ -108,11 +110,12 @@ private:
};
-class JezzView : public QCanvasView
+class JezzView : public TQCanvasView
{
Q_OBJECT
+ TQ_OBJECT
public:
- JezzView(TQCanvas* viewing=0, TQWidget* parent=0, const char* name=0, WFlags f=0);
+ JezzView(TQCanvas* viewing=0, TQWidget* tqparent=0, const char* name=0, WFlags f=0);
signals:
void buildWall( int x, int y, bool vertical );
@@ -125,12 +128,13 @@ private:
};
-class JezzGame : public QWidget
+class JezzGame : public TQWidget
{
Q_OBJECT
+ TQ_OBJECT
public:
- JezzGame( const TQPixmap &background, int ballNum, TQWidget *parent=0, const char *name=0 );
+ JezzGame( const TQPixmap &background, int ballNum, TQWidget *tqparent=0, const char *name=0 );
~JezzGame();
int percent();
diff --git a/kbounce/highscores.cpp b/kbounce/highscores.cpp
index fec2d1e6..5dc3bf47 100644
--- a/kbounce/highscores.cpp
+++ b/kbounce/highscores.cpp
@@ -6,7 +6,7 @@ using namespace KExtHighscore;
ExtManager::ExtManager()
{
- Item *item = new Item((uint)0, i18n("Level"), Qt::AlignRight);
+ Item *item = new Item((uint)0, i18n("Level"), TQt::AlignRight);
addScoreItem("level", item);
}
diff --git a/kbounce/kbounce.cpp b/kbounce/kbounce.cpp
index 5bfcc320..2d4fe887 100644
--- a/kbounce/kbounce.cpp
+++ b/kbounce/kbounce.cpp
@@ -89,21 +89,21 @@ KJezzball::KJezzball()
// create timers
m_nextLevelTimer = new TQTimer( this, "m_nextLevelTimer" );
- connect( m_nextLevelTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(switchLevel()) );
+ connect( m_nextLevelTimer, TQT_SIGNAL(timeout()), TQT_TQOBJECT(this), TQT_SLOT(switchLevel()) );
m_gameOverTimer = new TQTimer( this, "m_gameOverTimer" );
- connect( m_gameOverTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(gameOverNow()) );
+ connect( m_gameOverTimer, TQT_SIGNAL(timeout()), TQT_TQOBJECT(this), TQT_SLOT(gameOverNow()) );
m_timer = new TQTimer( this, "m_timer" );
- connect( m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(second()) );
+ connect( m_timer, TQT_SIGNAL(timeout()), TQT_TQOBJECT(this), TQT_SLOT(second()) );
// create demo game
createLevel( 1 );
statusBar()->message( i18n("Press %1 to start a game!")
- .arg(m_newAction->shortcut().toString()) );
+ .tqarg(m_newAction->shortcut().toString()) );
//m_gameWidget->display( i18n("Press <Space> to start a game!") );
- setFocusPolicy(TQWidget::StrongFocus);
+ setFocusPolicy(TQ_StrongFocus);
setFocus();
setupGUI();
}
@@ -119,23 +119,23 @@ KJezzball::~KJezzball()
*/
void KJezzball::initXMLUI()
{
- m_newAction = KStdGameAction::gameNew( this, TQT_SLOT(newGame()), actionCollection() );
+ m_newAction = KStdGameAction::gameNew( TQT_TQOBJECT(this), TQT_SLOT(newGame()), actionCollection() );
// AB: originally KBounce/KJezzball used Space for new game - but Ctrl+N is
// default. We solve this by providing space as an alternative key
KShortcut s = m_newAction->shortcut();
s.append(KKeySequence(TQKeySequence(Key_Space)));
m_newAction->setShortcut(s);
- KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection() );
- KStdGameAction::highscores(this, TQT_SLOT(showHighscore()), actionCollection() );
- m_pauseButton = KStdGameAction::pause(this, TQT_SLOT(pauseGame()), actionCollection());
- KStdGameAction::end(this, TQT_SLOT(closeGame()), actionCollection());
- KStdGameAction::configureHighscores(this, TQT_SLOT(configureHighscores()),actionCollection());
+ KStdGameAction::quit(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection() );
+ KStdGameAction::highscores(TQT_TQOBJECT(this), TQT_SLOT(showHighscore()), actionCollection() );
+ m_pauseButton = KStdGameAction::pause(TQT_TQOBJECT(this), TQT_SLOT(pauseGame()), actionCollection());
+ KStdGameAction::end(TQT_TQOBJECT(this), TQT_SLOT(closeGame()), actionCollection());
+ KStdGameAction::configureHighscores(TQT_TQOBJECT(this), TQT_SLOT(configureHighscores()),actionCollection());
- new KAction( i18n("&Select Background Folder..."), 0, this, TQT_SLOT(selectBackground()),
+ new KAction( i18n("&Select Background Folder..."), 0, TQT_TQOBJECT(this), TQT_SLOT(selectBackground()),
actionCollection(), "background_select" );
m_backgroundShowAction =
- new KToggleAction( i18n("Show &Backgrounds"), 0, this, TQT_SLOT(showBackground()),
+ new KToggleAction( i18n("Show &Backgrounds"), 0, TQT_TQOBJECT(this), TQT_SLOT(showBackground()),
actionCollection(), "background_show" );
m_backgroundShowAction->setCheckedState(i18n("Hide &Backgrounds"));
m_backgroundShowAction->setEnabled( !m_backgroundDir.isEmpty() );
@@ -177,7 +177,7 @@ void KJezzball::closeGame()
int old_state = m_state;
if (old_state == Running)
pauseGame();
- int ret = KMessageBox::questionYesNo( this, i18n("Do you really want to close the running game?"), TQString::null, KStdGuiItem::close(), KStdGuiItem::cancel() );
+ int ret = KMessageBox::questionYesNo( this, i18n("Do you really want to close the running game?"), TQString(), KStdGuiItem::close(), KStdGuiItem::cancel() );
if ( ret==KMessageBox::Yes )
{
stopLevel();
@@ -206,7 +206,7 @@ void KJezzball::pauseGame()
case Suspend:
m_state = Running;
statusBar()->clear();
- //m_gameWidget->display( TQString::null );
+ //m_gameWidget->display( TQString() );
startLevel();
break;
@@ -228,7 +228,7 @@ void KJezzball::gameOverNow()
TQString score;
score.setNum( m_game.score );
- KMessageBox::information( this, i18n("Game Over! Score: %1").arg(score) );
+ KMessageBox::information( this, i18n("Game Over! Score: %1").tqarg(score) );
statusBar()->message( i18n("Game over. Press <Space> for a new game") );
//m_gameWidget->display( i18n("Game over. Press <Space> for a new game!") );
highscore();
@@ -347,7 +347,7 @@ void KJezzball::focusInEvent ( TQFocusEvent *ev )
m_state = Running;
statusBar()->clear();
m_pauseButton->setChecked(false);
- //m_gameWidget->display( TQString::null );
+ //m_gameWidget->display( TQString() );
}
KMainWindow::focusInEvent( ev );
@@ -400,8 +400,8 @@ void KJezzball::createLevel( int level )
m_gameWidget->show();
m_layout->addWidget( m_gameWidget, 0, 0 );
- connect( m_gameWidget, TQT_SIGNAL(died()), this, TQT_SLOT(died()) );
- connect( m_gameWidget, TQT_SIGNAL(newPercent(int)), this, TQT_SLOT(newPercent(int)) );
+ connect( m_gameWidget, TQT_SIGNAL(died()), TQT_TQOBJECT(this), TQT_SLOT(died()) );
+ connect( m_gameWidget, TQT_SIGNAL(newPercent(int)), TQT_TQOBJECT(this), TQT_SLOT(newPercent(int)) );
connect( m_soundAction, TQT_SIGNAL(toggled(bool)), m_gameWidget, TQT_SLOT(setSound(bool)) );
// update displays
@@ -461,16 +461,16 @@ void KJezzball::switchLevel()
TQString foo = TQString(
i18n("You have successfully cleared more than 75% of the board.\n") +
-i18n("%1 points: 15 points per remaining life\n").arg(m_level.lifes*15) +
-i18n("%1 points: Bonus\n").arg((m_gameWidget->percent()-75)*2*(m_game.level+5)) +
-i18n("%1 points: Total score for this level\n").arg(score) +
-i18n("On to level %1. Remember you get %2 lives this time!")).arg(m_game.level+1).arg(m_game.level+2);
+i18n("%1 points: 15 points per remaining life\n").tqarg(m_level.lifes*15) +
+i18n("%1 points: Bonus\n").tqarg((m_gameWidget->percent()-75)*2*(m_game.level+5)) +
+i18n("%1 points: Total score for this level\n").tqarg(score) +
+i18n("On to level %1. Remember you get %2 lives this time!")).tqarg(m_game.level+1).tqarg(m_game.level+2);
KMessageBox::information( this,foo );
// KMessageBox::information( this, i18n("You've completed level %1 with "
- // "a score of %2.\nGet ready for the next one!").arg(level).arg(score));
+ // "a score of %2.\nGet ready for the next one!").tqarg(level).tqarg(score));
m_game.level++;
m_levelLCD->display( m_game.level );
diff --git a/kbounce/kbounce.h b/kbounce/kbounce.h
index 60fd49bf..4ca84600 100644
--- a/kbounce/kbounce.h
+++ b/kbounce/kbounce.h
@@ -30,6 +30,7 @@ class KAction;
class KJezzball : public KMainWindow
{
Q_OBJECT
+ TQ_OBJECT
public:
KJezzball();