diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:58:26 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:58:26 +0000 |
commit | 838baf3f99ec5ab81b063eb5449a3381d860f377 (patch) | |
tree | dd31abcfde08ca92e4623b8f50b3d762a87c997a /konquest/gameboard.cc | |
parent | 2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff) | |
download | tdegames-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 'konquest/gameboard.cc')
-rw-r--r-- | konquest/gameboard.cc | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/konquest/gameboard.cc b/konquest/gameboard.cc index 17b40272..96433e02 100644 --- a/konquest/gameboard.cc +++ b/konquest/gameboard.cc @@ -33,8 +33,8 @@ /********************************************************************* Game Board *********************************************************************/ -GameBoard::GameBoard( TQWidget *parent ) - : TQWidget( parent ), gameInProgress( false ), gameState( NONE ) +GameBoard::GameBoard( TQWidget *tqparent ) + : TQWidget( tqparent ), gameInProgress( false ), gameState( NONE ) { TQColorGroup cg( white, black, green.light(), green.dark(), green, green.dark(75), green.dark() ); TQPalette palette( cg, cg, cg ); @@ -53,17 +53,17 @@ GameBoard::GameBoard( TQWidget *parent ) msgWidget->setTextFormat(LogText); msgWidget->setMinimumHeight(100); msgWidget->setHScrollBarMode(TQScrollView::AlwaysOff); - msgWidget->setPaper(TQBrush(Qt::black)); + msgWidget->setPaper(TQBrush(TQt::black)); planetInfo = new PlanetInfo( this, palette ); gameMessage = new TQLabel( this ); gameMessage->setPalette( palette ); turnCounter = new TQLabel( this ); turnCounter->setPalette( palette ); turnCounter->setText( "Turn" ); - turnCounter->setMaximumHeight( turnCounter->sizeHint().height() ); + turnCounter->setMaximumHeight( turnCounter->tqsizeHint().height() ); endTurn = new TQPushButton( i18n("End Turn"), this ); - endTurn->setFixedSize( endTurn->sizeHint() ); + endTurn->setFixedSize( endTurn->tqsizeHint() ); endTurn->setPalette( palette ); shipCountEdit = new TQLineEdit( this ); @@ -82,39 +82,39 @@ GameBoard::GameBoard( TQWidget *parent ) setMinimumSize( 600, 600 ); setMouseTracking( true ); - setFocusPolicy( StrongFocus ); + setFocusPolicy( TQ_StrongFocus ); setFocus(); //******************************************************************** // Layout the main window //******************************************************************** - TQHBoxLayout *layout1 = new TQHBoxLayout( this ); - TQVBoxLayout *layout2 = new TQVBoxLayout; - TQHBoxLayout *layout3 = new TQHBoxLayout; - TQVBoxLayout *layout4 = new TQVBoxLayout; + TQHBoxLayout *tqlayout1 = new TQHBoxLayout( this ); + TQVBoxLayout *tqlayout2 = new TQVBoxLayout; + TQHBoxLayout *tqlayout3 = new TQHBoxLayout; + TQVBoxLayout *tqlayout4 = new TQVBoxLayout; - layout1->addLayout( layout2 ); - layout2->addLayout( layout3 ); + tqlayout1->addLayout( tqlayout2 ); + tqlayout2->addLayout( tqlayout3 ); - layout3->addSpacing( 5 ); - layout3->addWidget( gameMessage, 10 ); - layout3->addWidget( shipCountEdit, 1 ); - layout3->addWidget( endTurn, 1 ); + tqlayout3->addSpacing( 5 ); + tqlayout3->addWidget( gameMessage, 10 ); + tqlayout3->addWidget( shipCountEdit, 1 ); + tqlayout3->addWidget( endTurn, 1 ); - layout2->addSpacing( 5 ); - layout2->addWidget( mapWidget, 0, AlignTop ); - layout2->addWidget( msgWidget ); - layout2->addStretch( 1 ); + tqlayout2->addSpacing( 5 ); + tqlayout2->addWidget( mapWidget, 0, AlignTop ); + tqlayout2->addWidget( msgWidget ); + tqlayout2->addStretch( 1 ); - layout1->addSpacing( 5 ); - layout1->addLayout( layout4, 10 ); + tqlayout1->addSpacing( 5 ); + tqlayout1->addLayout( tqlayout4, 10 ); - layout4->addWidget( planetInfo, 1 ); - layout4->addSpacing( 10 ); - layout4->addWidget( turnCounter, 1 ); - layout4->addStretch( 1 ); + tqlayout4->addWidget( planetInfo, 1 ); + tqlayout4->addSpacing( 10 ); + tqlayout4->addWidget( turnCounter, 1 ); + tqlayout4->addStretch( 1 ); - layout1->addStretch( 1 ); + tqlayout1->addStretch( 1 ); //********************************************************************** // Set up signal/slot connections @@ -137,7 +137,7 @@ GameBoard::~GameBoard() } #if 0 -TQSize GameBoard::sizeHint() const +TQSize GameBoard::tqsizeHint() const { return TQSize( 600, 550 ); } @@ -187,7 +187,7 @@ GameBoard::keyPressEvent( TQKeyEvent *e ) } -QString +TQString GameBoard::playerString(Player *player) { if (!player) @@ -315,10 +315,10 @@ GameBoard::turn() TQString msg; msg = i18n("The distance from Planet %1 to Planet %2 is %3 light years.\n" "A ship leaving this turn will arrive on turn %4") - .arg(sourcePlanet->getName()) - .arg(destPlanet->getName()) - .arg(KGlobal::locale()->formatNumber( dist, 2 )) - .arg(KGlobal::locale()->formatNumber( turnNumber + (int)dist, 0 )); + .tqarg(sourcePlanet->getName()) + .tqarg(destPlanet->getName()) + .tqarg(KGlobal::locale()->formatNumber( dist, 2 )) + .tqarg(KGlobal::locale()->formatNumber( turnNumber + (int)dist, 0 )); KMessageBox::information( this, msg, i18n("Distance")); gameState = NONE; @@ -431,7 +431,7 @@ GameBoard::turn() } TQString turnStr; - turnStr = i18n("Turn #: %1 of %2").arg(turnNumber).arg(lastTurn); + turnStr = i18n("Turn #: %1 of %2").tqarg(turnNumber).tqarg(lastTurn); turnCounter->setText( turnStr ); @@ -470,15 +470,15 @@ GameBoard::nextTurn() Player *winner = findWinner(); if (winner) { - mapWidget->repaint(true); + mapWidget->tqrepaint(true); KMessageBox::information(this, - i18n("The mighty %1 has conquered the galaxy!").arg(winner->getName()), + i18n("The mighty %1 has conquered the galaxy!").tqarg(winner->getName()), i18n("Game Over")); } if( (turnNumber == lastTurn) && !winner ) { - mapWidget->repaint(true); + mapWidget->tqrepaint(true); GameEndDlg *dlg = new GameEndDlg( this ); if( dlg->exec() == KDialogBase::Yes ) { @@ -492,7 +492,7 @@ GameBoard::nextTurn() { // Game over, man! Game over. - mapWidget->repaint(true); + mapWidget->tqrepaint(true); gameOver(); }; @@ -565,8 +565,8 @@ GameBoard::gameMsg(const TQString &msg, Player *player, Planet *planet, Player * { if (!player->isAiPlayer()) isHumanInvolved = true; - colorMsg = colorMsg.arg(playerString(player)); - plainMsg = plainMsg.arg(player->getName()); + colorMsg = colorMsg.tqarg(playerString(player)); + plainMsg = plainMsg.tqarg(player->getName()); } if (planet) @@ -577,15 +577,15 @@ GameBoard::gameMsg(const TQString &msg, Player *player, Planet *planet, Player * isHumanInvolved = true; TQString color = planetPlayer->getColor().name(); - colorMsg = colorMsg.arg(TQString("<font color=\"%1\">%2</font>").arg(color, planet->getName())); - plainMsg = plainMsg.arg(planet->getName()); + colorMsg = colorMsg.tqarg(TQString("<font color=\"%1\">%2</font>").tqarg(color, planet->getName())); + plainMsg = plainMsg.tqarg(planet->getName()); } - msgWidget->append(("<qt><font color=\"white\">Turn %1:</font> <font color=\""+color+"\">").arg(turnNumber)+colorMsg+"</font></qt>"); + msgWidget->append(("<qt><font color=\"white\">Turn %1:</font> <font color=\""+color+"\">").tqarg(turnNumber)+colorMsg+"</font></qt>"); msgWidget->scrollToBottom(); if (isHumanInvolved) { - mapWidget->repaint(true); + mapWidget->tqrepaint(true); KMessageBox::information(this, plainMsg); } } @@ -660,7 +660,7 @@ GameBoard::doFleetArrival( AttackFleet *arrivingFleet ) TQString msg; msg = i18n("Reinforcements (%1 ships) have arrived for planet %2.") - .arg(arrivingFleet->getShipCount()); + .tqarg(arrivingFleet->getShipCount()); gameMsg(msg, 0, arrivingFleet->destination); } } else { @@ -717,7 +717,7 @@ GameBoard::doFleetArrival( AttackFleet *arrivingFleet ) } } - mapWidget->repaint(true); + mapWidget->tqrepaint(true); } //************************************************************************ |