From 838baf3f99ec5ab81b063eb5449a3381d860f377 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 11 Jun 2011 04:58:26 +0000 Subject: 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 --- kblackbox/CHANGES | 2 +- kblackbox/kbbgame.cpp | 52 +++++++++++++++++++++++++-------------------------- kblackbox/kbbgame.h | 1 + kblackbox/kbbgfx.cpp | 20 ++++++++++---------- kblackbox/kbbgfx.h | 7 ++++--- 5 files changed, 42 insertions(+), 40 deletions(-) (limited to 'kblackbox') diff --git a/kblackbox/CHANGES b/kblackbox/CHANGES index 985fa5c9..50f44446 100644 --- a/kblackbox/CHANGES +++ b/kblackbox/CHANGES @@ -11,7 +11,7 @@ - the game is active after starting - fixed bad drawing after setting the board size - config. scripts from new kexample (KDE 1.0) - - moc dependencies in Makefile.am done by automoc to + - tqmoc dependencies in Makefile.am done by autotqmoc to avoid problems on Solaris (bug report by David Faure) - some string fixes for better translation 0.2.5 from 0.2.4 (19.3.1998) diff --git a/kblackbox/kbbgame.cpp b/kblackbox/kbbgame.cpp index c663e2eb..f13c0106 100644 --- a/kblackbox/kbbgame.cpp +++ b/kblackbox/kbbgame.cpp @@ -174,7 +174,7 @@ KBBGame::~KBBGame() kConf->writeEntry( "tutorial", (int) tutorial ); delete gameBoard; - // All the rest has "this" for parent so it doesn't need to be deleted. + // All the rest has "this" for tqparent so it doesn't need to be deleted. } @@ -266,7 +266,7 @@ void KBBGame::newGame() if (running) { bool cancel; cancel = KMessageBox::warningContinueCancel(0, - i18n("Do you really want to give up this game?"),TQString::null,i18n("Give Up")) + i18n("Do you really want to give up this game?"),TQString(),i18n("Give Up")) == KMessageBox::Cancel; if (cancel) return; @@ -298,7 +298,7 @@ void KBBGame::newGame() randomBalls( balls ); remap( gameBoard, gr->getGraphicBoard() ); - gr->repaint( TRUE ); + gr->tqrepaint( TRUE ); setScore( 0 ); detourCounter = -1; ballsPlaced = 0; @@ -326,12 +326,12 @@ void KBBGame::gameFinished() "I guess you need more practice."); KMessageBox::information(this, - s.arg(KGlobal::locale()->formatNumber(score, 0))); + s.tqarg(KGlobal::locale()->formatNumber(score, 0))); } else { s = i18n( "You should place %1 balls!\n" "You have placed %2.") - .arg(KGlobal::locale()->formatNumber(balls, 0)) - .arg(KGlobal::locale()->formatNumber(ballsPlaced, 0)); + .tqarg(KGlobal::locale()->formatNumber(balls, 0)) + .tqarg(KGlobal::locale()->formatNumber(ballsPlaced, 0)); KMessageBox::sorry(this, s); } @@ -388,7 +388,7 @@ void KBBGame::giveUp() bool stop; stop = KMessageBox::warningContinueCancel(0, i18n( - "Do you really want to give up this game?"),TQString::null,i18n("Give Up")) + "Do you really want to give up this game?"),TQString(),i18n("Give Up")) == KMessageBox::Continue; if (stop) { @@ -428,7 +428,7 @@ void KBBGame::updateStats() void KBBGame::setScore( int n ) { score = n; - statusBar()->changeItem( i18n("Score: %1").arg(n), SSCORE ); + statusBar()->changeItem( i18n("Score: %1").tqarg(n), SSCORE ); } /* @@ -442,7 +442,7 @@ bool KBBGame::setSize( int w, int h ) if (running) { ok = KMessageBox::warningContinueCancel(0, i18n( - "This will be the end of the current game!"),TQString::null,i18n("End Game")) + "This will be the end of the current game!"),TQString(),i18n("End Game")) == KMessageBox::Continue; } else ok = TRUE; @@ -454,7 +454,7 @@ bool KBBGame::setSize( int w, int h ) gameBoard = new RectOnArray( gr->numC(), gr->numR() ); if (running) abortGame(); newGame(); - // gr->repaint( TRUE ); + // gr->tqrepaint( TRUE ); } } return ok; @@ -470,7 +470,7 @@ bool KBBGame::setBalls( int n ) if (balls != n) { if (running) { ok = KMessageBox::warningContinueCancel(0, - i18n("This will be the end of the current game!"),TQString::null,i18n("End Game")) + i18n("This will be the end of the current game!"),TQString(),i18n("End Game")) == KMessageBox::Continue; } else ok = TRUE; if (ok) { @@ -622,7 +622,7 @@ void KBBGame::gotInputAt( int col, int row, int state ) int w = gameBoard->width() - 2; int h = gameBoard->height() - 2; - if (state & LeftButton) { + if (state & Qt::LeftButton) { switch (type) { case WBALLBBG: // because of the tutorial mode case INNERBBG: @@ -681,7 +681,7 @@ void KBBGame::gotInputAt( int col, int row, int state ) } break; } - } else if (state & RightButton) { + } else if (state & Qt::RightButton) { switch (type) { case INNERBBG: r->set( col, row, MARK1BBG ); @@ -698,37 +698,37 @@ void KBBGame::gotInputAt( int col, int row, int state ) void KBBGame::initKAction() { // game - KStdGameAction::gameNew(this, TQT_SLOT(newGame()), actionCollection()); - (void)new KAction( i18n("&Give Up"), SmallIcon("giveup"), 0, this, TQT_SLOT(giveUp()), actionCollection(), "game_giveup" ); - (void)new KAction( i18n("&Done"), SmallIcon("done"), 0, this, TQT_SLOT(gameFinished()), actionCollection(), "game_done" ); - (void)new KAction( i18n("&Resize"), 0, this, TQT_SLOT(slotResize()), actionCollection(), "game_resize" ); - KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection()); + KStdGameAction::gameNew(TQT_TQOBJECT(this), TQT_SLOT(newGame()), actionCollection()); + (void)new KAction( i18n("&Give Up"), SmallIcon("giveup"), 0, TQT_TQOBJECT(this), TQT_SLOT(giveUp()), actionCollection(), "game_giveup" ); + (void)new KAction( i18n("&Done"), SmallIcon("done"), 0, TQT_TQOBJECT(this), TQT_SLOT(gameFinished()), actionCollection(), "game_done" ); + (void)new KAction( i18n("&Resize"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotResize()), actionCollection(), "game_resize" ); + KStdGameAction::quit(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection()); // settings - sizeAction = new KSelectAction( i18n("&Size"), 0, this, TQT_SLOT(slotSize()), actionCollection(), "options_size"); + sizeAction = new KSelectAction( i18n("&Size"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotSize()), actionCollection(), "options_size"); TQStringList list; list.append(i18n(" 8 x 8 ")); list.append(i18n(" 10 x 10 ")); list.append(i18n(" 12 x 12 ")); sizeAction->setItems(list); - ballsAction = new KSelectAction( i18n("&Balls"), 0, this, TQT_SLOT(slotBalls()), actionCollection(), "options_balls"); + ballsAction = new KSelectAction( i18n("&Balls"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotBalls()), actionCollection(), "options_balls"); list.clear(); list.append(i18n(" 4 ")); list.append(i18n(" 6 ")); list.append(i18n(" 8 ")); ballsAction->setItems(list); - tutorialAction = new KToggleAction( i18n("&Tutorial"), 0, this, TQT_SLOT(tutorialSwitch()), actionCollection(), "options_tutorial" ); + tutorialAction = new KToggleAction( i18n("&Tutorial"), 0, TQT_TQOBJECT(this), TQT_SLOT(tutorialSwitch()), actionCollection(), "options_tutorial" ); // KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), //actionCollection()); // keyboard only - (void)new KAction( i18n("Move Down"), Qt::Key_Down, gr, TQT_SLOT(slotDown()), actionCollection(), "move_down" ); - (void)new KAction( i18n("Move Up"), Qt::Key_Up, gr, TQT_SLOT(slotUp()), actionCollection(), "move_up" ); - (void)new KAction( i18n("Move Left"), Qt::Key_Left, gr, TQT_SLOT(slotLeft()), actionCollection(), "move_left" ); - (void)new KAction( i18n("Move Right"), Qt::Key_Right, gr, TQT_SLOT(slotRight()), actionCollection(), "move_right" ); - (void)new KAction( i18n("Trigger Action"), Qt::Key_Return, gr, TQT_SLOT(slotInput()), actionCollection(), "move_trigger" ); + (void)new KAction( i18n("Move Down"), TQt::Key_Down, TQT_TQOBJECT(gr), TQT_SLOT(slotDown()), actionCollection(), "move_down" ); + (void)new KAction( i18n("Move Up"), TQt::Key_Up, TQT_TQOBJECT(gr), TQT_SLOT(slotUp()), actionCollection(), "move_up" ); + (void)new KAction( i18n("Move Left"), TQt::Key_Left, TQT_TQOBJECT(gr), TQT_SLOT(slotLeft()), actionCollection(), "move_left" ); + (void)new KAction( i18n("Move Right"), TQt::Key_Right, TQT_TQOBJECT(gr), TQT_SLOT(slotRight()), actionCollection(), "move_right" ); + (void)new KAction( i18n("Trigger Action"), TQt::Key_Return, TQT_TQOBJECT(gr), TQT_SLOT(slotInput()), actionCollection(), "move_trigger" ); } void KBBGame::slotResize() diff --git a/kblackbox/kbbgame.h b/kblackbox/kbbgame.h index 85b12e29..38b8a0fc 100644 --- a/kblackbox/kbbgame.h +++ b/kblackbox/kbbgame.h @@ -50,6 +50,7 @@ class KToggleAction; class KBBGame : public KMainWindow { Q_OBJECT + TQ_OBJECT public: KBBGame(); ~KBBGame(); diff --git a/kblackbox/kbbgfx.cpp b/kblackbox/kbbgfx.cpp index b38a2c9e..26d47952 100644 --- a/kblackbox/kbbgfx.cpp +++ b/kblackbox/kbbgfx.cpp @@ -22,13 +22,13 @@ Constructs a KBBGraphic widget. */ -KBBGraphic::KBBGraphic( TQPixmap **p, TQWidget* parent, const char* name ) - : TQWidget( parent, name ) +KBBGraphic::KBBGraphic( TQPixmap **p, TQWidget* tqparent, const char* name ) + : TQWidget( tqparent, name ) { int i; curRow = curCol = 0; - setFocusPolicy( NoFocus ); + setFocusPolicy( TQ_NoFocus ); setBackgroundColor( gray ); setCellWidth( CELLW ); // set width of cell in pixels setCellHeight( CELLH ); // set height of cell in pixels @@ -137,7 +137,7 @@ int KBBGraphic::width() { return cellW * numRows; } int KBBGraphic::height() { return cellH * numCols; } int KBBGraphic::wHint() const { return minW; } int KBBGraphic::hHint() const { return minH; } -TQSize KBBGraphic::sizeHint() const { return TQSize(wHint(), hHint()); } +TQSize KBBGraphic::tqsizeHint() const { return TQSize(wHint(), hHint()); } /* Returns a pointer to graphicBoard @@ -342,7 +342,7 @@ void KBBGraphic::mousePressEvent( TQMouseEvent* e ) /* * Middle click finishes the game. */ - if (e->button() == MidButton) { + if (e->button() == Qt::MidButton) { emit endMouseClicked(); return; } @@ -413,7 +413,7 @@ void KBBGraphic::slotInput() if ( !inputAccepted ) { return; } - emit inputAt( curCol, curRow, LeftButton ); + emit inputAt( curCol, curRow, Qt::LeftButton ); // updateElement( curCol, curRow ); } @@ -434,7 +434,7 @@ void KBBGraphic::moveSelection(int drow, int dcol) void KBBGraphic::focusInEvent( TQFocusEvent* ) { - repaint( FALSE ); + tqrepaint( FALSE ); } @@ -444,7 +444,7 @@ void KBBGraphic::focusInEvent( TQFocusEvent* ) void KBBGraphic::focusOutEvent( TQFocusEvent* ) { - repaint( FALSE ); + tqrepaint( FALSE ); } /* @@ -454,8 +454,8 @@ void KBBGraphic::focusOutEvent( TQFocusEvent* ) void KBBGraphic::setInputAccepted( bool b ) { inputAccepted = b; - if (b) setFocusPolicy( StrongFocus ); - else setFocusPolicy( NoFocus ); + if (b) setFocusPolicy( TQ_StrongFocus ); + else setFocusPolicy( TQ_NoFocus ); } /* diff --git a/kblackbox/kbbgfx.h b/kblackbox/kbbgfx.h index 16d97298..5eca56c9 100644 --- a/kblackbox/kbbgfx.h +++ b/kblackbox/kbbgfx.h @@ -50,11 +50,12 @@ Negative numbers are deflected lasers... */ -class KBBGraphic : public QWidget +class KBBGraphic : public TQWidget { Q_OBJECT + TQ_OBJECT public: - KBBGraphic( TQPixmap** p=0, TQWidget* parent=0, const char* name=0 ); + KBBGraphic( TQPixmap** p=0, TQWidget* tqparent=0, const char* name=0 ); ~KBBGraphic(); friend class KBBGame; @@ -87,7 +88,7 @@ signals: void endMouseClicked(); protected: - virtual TQSize sizeHint() const; + virtual TQSize tqsizeHint() const; void paintEvent( TQPaintEvent* ); void mousePressEvent( TQMouseEvent* ); void mouseMoveEvent( TQMouseEvent* ); -- cgit v1.2.1