diff options
Diffstat (limited to 'kbattleship/kbattleship/kbattleship.cpp')
-rw-r--r-- | kbattleship/kbattleship/kbattleship.cpp | 308 |
1 files changed, 154 insertions, 154 deletions
diff --git a/kbattleship/kbattleship/kbattleship.cpp b/kbattleship/kbattleship/kbattleship.cpp index b7d38891..32759e28 100644 --- a/kbattleship/kbattleship/kbattleship.cpp +++ b/kbattleship/kbattleship/kbattleship.cpp @@ -15,8 +15,8 @@ * * ***************************************************************************/ -#include <qlayout.h> -#include <qtimer.h> +#include <tqlayout.h> +#include <tqtimer.h> #include <kgamemisc.h> #include <kinputdialog.h> @@ -92,16 +92,16 @@ void KBattleshipWindow::initStatusBar() void KBattleshipWindow::initActions() { - KStdAction::configureNotifications(this, SLOT(slotConfigureNotifications()), actionCollection()); - m_gameServerConnect = new KAction(i18n("&Connect to Server..."), "connect_no", Key_F2, this, SLOT(slotServerConnect()), actionCollection(), "game_serverconnect"); - m_gameNewServer = new KAction(i18n("&Start Server..."), "network", Key_F3, this, SLOT(slotNewServer()), actionCollection(), "game_newserver"); - m_gameSingle = new KAction(i18n("S&ingle Player..."), "gear", Key_F4, this, SLOT(slotSinglePlayer()), actionCollection(), "game_singleplayer"); - m_gameQuit = KStdGameAction::quit(this, SLOT(close()), actionCollection()); - KStdGameAction::highscores(this, SLOT(slotHighscore()), actionCollection()); - m_gameEnemyInfo = new KAction(i18n("&Enemy Info"), "view_text", Key_F11, this, SLOT(slotEnemyClientInfo()), actionCollection(), "game_enemyinfo"); + KStdAction::configureNotifications(this, TQT_SLOT(slotConfigureNotifications()), actionCollection()); + m_gameServerConnect = new KAction(i18n("&Connect to Server..."), "connect_no", Key_F2, this, TQT_SLOT(slotServerConnect()), actionCollection(), "game_serverconnect"); + m_gameNewServer = new KAction(i18n("&Start Server..."), "network", Key_F3, this, TQT_SLOT(slotNewServer()), actionCollection(), "game_newserver"); + m_gameSingle = new KAction(i18n("S&ingle Player..."), "gear", Key_F4, this, TQT_SLOT(slotSinglePlayer()), actionCollection(), "game_singleplayer"); + m_gameQuit = KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection()); + KStdGameAction::highscores(this, TQT_SLOT(slotHighscore()), actionCollection()); + m_gameEnemyInfo = new KAction(i18n("&Enemy Info"), "view_text", Key_F11, this, TQT_SLOT(slotEnemyClientInfo()), actionCollection(), "game_enemyinfo"); m_configSound = new KToggleAction(i18n("&Play Sounds"), 0, actionCollection(), "options_configure_sound"); - m_configGrid = new KToggleAction(i18n("&Show Grid"), 0, this, SLOT(slotShowGrid()), actionCollection(), "options_show_grid"); + m_configGrid = new KToggleAction(i18n("&Show Grid"), 0, this, TQT_SLOT(slotShowGrid()), actionCollection(), "options_show_grid"); m_configGrid->setCheckedState(i18n("Hide Grid")); m_gameEnemyInfo->setEnabled(false); @@ -111,9 +111,9 @@ void KBattleshipWindow::initActions() void KBattleshipWindow::initChat() { - connect(m_chat, SIGNAL(sigSendMessage(const QString &)), this, SLOT(slotSendChatMessage(const QString &))); - connect(m_chat, SIGNAL(sigChangeEnemyNickname(const QString &)), this, SLOT(slotChangeEnemyPlayer(const QString &))); - connect(m_chat, SIGNAL(sigChangeOwnNickname(const QString &)), this, SLOT(slotChangedNickCommand(const QString &))); + connect(m_chat, TQT_SIGNAL(sigSendMessage(const TQString &)), this, TQT_SLOT(slotSendChatMessage(const TQString &))); + connect(m_chat, TQT_SIGNAL(sigChangeEnemyNickname(const TQString &)), this, TQT_SLOT(slotChangeEnemyPlayer(const TQString &))); + connect(m_chat, TQT_SIGNAL(sigChangeOwnNickname(const TQString &)), this, TQT_SLOT(slotChangedNickCommand(const TQString &))); } void KBattleshipWindow::changeShipPlacementDirection(){ @@ -122,16 +122,16 @@ void KBattleshipWindow::changeShipPlacementDirection(){ void KBattleshipWindow::initShipPlacing() { - connect(m_ownshiplist, SIGNAL(sigOwnFieldDataChanged(int, int, int)), this, SLOT(slotChangeOwnFieldData(int, int, int))); - connect(m_ownshiplist, SIGNAL(sigLastShipAdded()), this, SLOT(slotShipsReady())); + connect(m_ownshiplist, TQT_SIGNAL(sigOwnFieldDataChanged(int, int, int)), this, TQT_SLOT(slotChangeOwnFieldData(int, int, int))); + connect(m_ownshiplist, TQT_SIGNAL(sigLastShipAdded()), this, TQT_SLOT(slotShipsReady())); } void KBattleshipWindow::initView() { - QWidget *dummy = new QWidget(this, "dummy"); + TQWidget *dummy = new TQWidget(this, "dummy"); setCentralWidget(dummy); - QGridLayout *topLayout = new QGridLayout(dummy, 2, 2, 0, -1, "topLayout"); + TQGridLayout *topLayout = new TQGridLayout(dummy, 2, 2, 0, -1, "topLayout"); m_chat = new KChatWidget(dummy); m_view = new KBattleshipView(dummy, "", m_configGrid->isChecked()); @@ -148,10 +148,10 @@ void KBattleshipWindow::initView() m_view->startDrawing(); setFocusProxy(m_view); - connect(m_view, SIGNAL(sigEnemyFieldClicked(int, int)), this, SLOT(slotEnemyFieldClick(int, int))); - connect(m_view, SIGNAL(sigOwnFieldClicked(int, int)), this, SLOT(slotPlaceShip(int, int))); - connect(m_view, SIGNAL(sigMouseOverField(int, int)), this, SLOT(slotPlaceShipPreview(int, int))); - connect(m_view, SIGNAL(changeShipPlacementDirection()), this, SLOT(changeShipPlacementDirection())); + connect(m_view, TQT_SIGNAL(sigEnemyFieldClicked(int, int)), this, TQT_SLOT(slotEnemyFieldClick(int, int))); + connect(m_view, TQT_SIGNAL(sigOwnFieldClicked(int, int)), this, TQT_SLOT(slotPlaceShip(int, int))); + connect(m_view, TQT_SIGNAL(sigMouseOverField(int, int)), this, TQT_SLOT(slotPlaceShipPreview(int, int))); + connect(m_view, TQT_SIGNAL(changeShipPlacementDirection()), this, TQT_SLOT(changeShipPlacementDirection())); } void KBattleshipWindow::slotDeleteAI() @@ -186,8 +186,8 @@ void KBattleshipWindow::slotEnemyFieldClick(int fieldx, int fieldy) { slotStatusMsg(i18n("Sending Message...")); KMessage *msg = new KMessage(KMessage::SHOOT); - msg->addField("fieldx", QString::number(fieldx)); - msg->addField("fieldy", QString::number(fieldy)); + msg->addField("fieldx", TQString::number(fieldx)); + msg->addField("fieldy", TQString::number(fieldy)); slotSendMessage(msg); } @@ -213,7 +213,7 @@ void KBattleshipWindow::slotEnemyFieldClick(int fieldx, int fieldy) if(showstate == KBattleField::HIT) { KShip *ship = m_enemyshiplist->shipAt(fieldx, fieldy); - typedef QValueList<int> DeathValueList; + typedef TQValueList<int> DeathValueList; DeathValueList deathList; bool xokay = true, yokay = true; int tempy = 0, tempx = 0; @@ -314,14 +314,14 @@ void KBattleshipWindow::slotEnemyFieldClick(int fieldx, int fieldy) slotStatusMsg(i18n("You won the game :)")); m_stat->slotAddOwnWon(); slotUpdateHighscore(); - switch(KMessageBox::questionYesNo(this, i18n("Do you want to restart the game?"),QString::null,i18n("Restart"),i18n("Do Not Restart"))) + switch(KMessageBox::questionYesNo(this, i18n("Do you want to restart the game?"),TQString::null,i18n("Restart"),i18n("Do Not Restart"))) { case KMessageBox::Yes: - QTimer::singleShot(0, this, SLOT(slotRestartAI())); + TQTimer::singleShot(0, this, TQT_SLOT(slotRestartAI())); break; case KMessageBox::No: - QTimer::singleShot(0, this, SLOT(slotDeleteAI())); + TQTimer::singleShot(0, this, TQT_SLOT(slotDeleteAI())); break; } return; @@ -576,9 +576,9 @@ void KBattleshipWindow::slotSendMessage(int fieldx, int fieldy, int state) if(m_connection != 0) { KMessage *msg = new KMessage(KMessage::ANSWER_SHOOT); - msg->addField(QString("fieldx"), QString::number(fieldx)); - msg->addField(QString("fieldy"), QString::number(fieldy)); - msg->addField(QString("fieldstate"), QString::number(state)); + msg->addField(TQString("fieldx"), TQString::number(fieldx)); + msg->addField(TQString("fieldy"), TQString::number(fieldy)); + msg->addField(TQString("fieldstate"), TQString::number(state)); if(m_connection->type() == KonnectionHandling::SERVER) m_kbserver->sendMessage(msg); @@ -598,7 +598,7 @@ void KBattleshipWindow::slotSendMessage(KMessage *msg) } } -void KBattleshipWindow::slotSendChatMessage(const QString &text) +void KBattleshipWindow::slotSendChatMessage(const TQString &text) { if(m_connection != 0 && m_serverHasClient) { @@ -608,7 +608,7 @@ void KBattleshipWindow::slotSendChatMessage(const QString &text) } } -void KBattleshipWindow::slotChangedNickCommand(const QString &text) +void KBattleshipWindow::slotChangedNickCommand(const TQString &text) { m_ownNickname = text; slotChangeOwnPlayer(m_ownNickname); @@ -642,9 +642,9 @@ void KBattleshipWindow::slotUpdateHighscore() KScoreDialog::FieldInfo info; info[KScoreDialog::Name] = m_ownNickname; - info[KScoreDialog::Custom1] = QString::number(m_stat->shot()); - info[KScoreDialog::Custom2] = QString::number(m_stat->hit()); - info[KScoreDialog::Custom3] = QString::number(m_stat->water()); + info[KScoreDialog::Custom1] = TQString::number(m_stat->shot()); + info[KScoreDialog::Custom2] = TQString::number(m_stat->hit()); + info[KScoreDialog::Custom3] = TQString::number(m_stat->water()); scoreDialog->addScore((int)score, info, false, false); } @@ -697,8 +697,8 @@ void KBattleshipWindow::slotServerConnect() slotStatusMsg(i18n("Loading Connect-Server dialog...")); m_client = new KClientDialog(this); - connect(m_client, SIGNAL(sigConnectServer()), this, SLOT(slotConnectToBattleshipServer())); - connect(m_client, SIGNAL(sigCancelConnect()), this, SLOT(slotDeleteConnectDialog())); + connect(m_client, TQT_SIGNAL(sigConnectServer()), this, TQT_SLOT(slotConnectToBattleshipServer())); + connect(m_client, TQT_SIGNAL(sigCancelConnect()), this, TQT_SLOT(slotDeleteConnectDialog())); m_client->show(); slotStatusMsg(i18n("Ready")); @@ -715,7 +715,7 @@ void KBattleshipWindow::slotDeleteConnectDialog() void KBattleshipWindow::slotReplayRequest() { - switch(KMessageBox::questionYesNo(this, i18n("The client is asking to restart the game. Do you accept?"),QString::null,i18n("Accept Restart"), i18n("Deny Restart"))) + switch(KMessageBox::questionYesNo(this, i18n("The client is asking to restart the game. Do you accept?"),TQString::null,i18n("Accept Restart"), i18n("Deny Restart"))) { case KMessageBox::Yes: if (m_connection) @@ -735,7 +735,7 @@ void KBattleshipWindow::slotReplayRequest() void KBattleshipWindow::slotServerReplay() { KMessage *msg = new KMessage(KMessage::REPLAY); - switch(KMessageBox::questionYesNo(this, i18n("Do you want to restart the game?"), QString::null, i18n("Restart"), i18n("Do Not Restart"))) + switch(KMessageBox::questionYesNo(this, i18n("Do you want to restart the game?"), TQString::null, i18n("Restart"), i18n("Do Not Restart"))) { case KMessageBox::Yes: if (m_connection) @@ -761,7 +761,7 @@ void KBattleshipWindow::slotServerReplay() void KBattleshipWindow::slotClientReplay() { KMessage *msg = new KMessage(KMessage::REPLAY); - switch(KMessageBox::questionYesNo(this, i18n("Do you want to ask the server restarting the game?"), QString::null, i18n("Ask to Restart"), i18n("Do Not Ask"))) + switch(KMessageBox::questionYesNo(this, i18n("Do you want to ask the server restarting the game?"), TQString::null, i18n("Ask to Restart"), i18n("Do Not Ask"))) { case KMessageBox::Yes: if (m_connection) @@ -806,8 +806,8 @@ void KBattleshipWindow::slotNewServer() slotStatusMsg(i18n("Loading Start-Server dialog...")); m_server = new KServerDialog(this); - connect(m_server, SIGNAL(okClicked()), this, SLOT(slotStartBattleshipServer())); - connect(m_server, SIGNAL(cancelClicked()), this, SLOT(slotDeleteServerDialog())); + connect(m_server, TQT_SIGNAL(okClicked()), this, TQT_SLOT(slotStartBattleshipServer())); + connect(m_server, TQT_SIGNAL(cancelClicked()), this, TQT_SLOT(slotDeleteServerDialog())); m_server->show(); slotStatusMsg(i18n("Ready")); @@ -828,7 +828,7 @@ void KBattleshipWindow::slotSendVersion() msg->versionMessage(); slotSendMessage(msg); - QTimer::singleShot(150, this, SLOT(slotSendGreet())); + TQTimer::singleShot(150, this, TQT_SLOT(slotSendGreet())); } void KBattleshipWindow::slotSendGreet() @@ -837,7 +837,7 @@ void KBattleshipWindow::slotSendGreet() m_chat->slotAcceptMsg(true); KMessage *msg = new KMessage(KMessage::GREET); - msg->addField(QString("nickname"), m_ownNickname); + msg->addField(TQString("nickname"), m_ownNickname); slotSendMessage(msg); } @@ -862,49 +862,49 @@ void KBattleshipWindow::slotStartBattleshipServer() if(m_connection == 0) { m_connection = new KonnectionHandling(this, m_kbserver); - connect(m_connection, SIGNAL(sigStatusBar(const QString &)), this, SLOT(slotStatusMsg(const QString &))); - connect(m_connection, SIGNAL(sigEnemyNickname(const QString &)), this, SLOT(slotChangeEnemyPlayer(const QString &))); - connect(m_connection, SIGNAL(sigSendNickname()), this, SLOT(slotSendGreet())); - connect(m_connection, SIGNAL(sigPlaceShips(bool)), this, SLOT(slotSetPlaceable(bool))); - connect(m_connection, SIGNAL(sigShootable(bool)), this, SLOT(slotSetShootable(bool))); - connect(m_connection, SIGNAL(sigSendFieldState(int, int)), this, SLOT(slotSendEnemyFieldState(int, int))); - connect(m_connection, SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); - connect(m_connection, SIGNAL(sigClientLost()), this, SLOT(slotClientLost())); - connect(m_connection, SIGNAL(sigAbortNetworkGame()), this, SLOT(slotAbortNetworkGame())); - connect(m_connection, SIGNAL(sigReplay()), this, SLOT(slotReplayRequest())); - connect(m_connection, SIGNAL(sigChatMessage(const QString &, const QString &, bool)), m_chat, SLOT(slotReceivedMessage(const QString &, const QString &, bool))); - connect(m_connection, SIGNAL(sigClientInformation(const QString &, const QString &, const QString &, const QString &)), this, SLOT(slotReceivedClientInformation(const QString &, const QString &, const QString &, const QString &))); - connect(m_connection, SIGNAL(sigLost(KMessage *)), this, SLOT(slotLost(KMessage *))); + connect(m_connection, TQT_SIGNAL(sigStatusBar(const TQString &)), this, TQT_SLOT(slotStatusMsg(const TQString &))); + connect(m_connection, TQT_SIGNAL(sigEnemyNickname(const TQString &)), this, TQT_SLOT(slotChangeEnemyPlayer(const TQString &))); + connect(m_connection, TQT_SIGNAL(sigSendNickname()), this, TQT_SLOT(slotSendGreet())); + connect(m_connection, TQT_SIGNAL(sigPlaceShips(bool)), this, TQT_SLOT(slotSetPlaceable(bool))); + connect(m_connection, TQT_SIGNAL(sigShootable(bool)), this, TQT_SLOT(slotSetShootable(bool))); + connect(m_connection, TQT_SIGNAL(sigSendFieldState(int, int)), this, TQT_SLOT(slotSendEnemyFieldState(int, int))); + connect(m_connection, TQT_SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, TQT_SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); + connect(m_connection, TQT_SIGNAL(sigClientLost()), this, TQT_SLOT(slotClientLost())); + connect(m_connection, TQT_SIGNAL(sigAbortNetworkGame()), this, TQT_SLOT(slotAbortNetworkGame())); + connect(m_connection, TQT_SIGNAL(sigReplay()), this, TQT_SLOT(slotReplayRequest())); + connect(m_connection, TQT_SIGNAL(sigChatMessage(const TQString &, const TQString &, bool)), m_chat, TQT_SLOT(slotReceivedMessage(const TQString &, const TQString &, bool))); + connect(m_connection, TQT_SIGNAL(sigClientInformation(const TQString &, const TQString &, const TQString &, const TQString &)), this, TQT_SLOT(slotReceivedClientInformation(const TQString &, const TQString &, const TQString &, const TQString &))); + connect(m_connection, TQT_SIGNAL(sigLost(KMessage *)), this, TQT_SLOT(slotLost(KMessage *))); } else { if(m_connection->type() == KonnectionHandling::CLIENT) { - disconnect(m_kbclient, SIGNAL(sigConnected()), this, SLOT(slotSendVersion())); - disconnect(m_connection, SIGNAL(sigAbortNetworkGame()), this, SLOT(slotAbortNetworkGame())); - disconnect(m_connection, SIGNAL(sigStatusBar(const QString &)), this, SLOT(slotStatusMsg(const QString &))); - disconnect(m_connection, SIGNAL(sigEnemyNickname(const QString &)), this, SLOT(slotChangeEnemyPlayer(const QString &))); - disconnect(m_connection, SIGNAL(sigSendFieldState(int, int)), this, SLOT(slotSendEnemyFieldState(int, int))); - disconnect(m_connection, SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); - disconnect(m_connection, SIGNAL(sigShootable(bool)), this, SLOT(slotSetShootable(bool))); - disconnect(m_connection, SIGNAL(sigPlaceShips(bool)), this, SLOT(slotSetPlaceable(bool))); - disconnect(m_connection, SIGNAL(sigServerLost()), this, SLOT(slotServerLost())); - disconnect(m_connection, SIGNAL(sigReplay()), this, SLOT(slotReplay())); - disconnect(m_connection, SIGNAL(sigChatMessage(const QString &, const QString &, bool)), m_chat, SLOT(slotReceivedMessage(const QString &, const QString &, bool))); - disconnect(m_connection, SIGNAL(sigLost(KMessage *)), this, SLOT(slotLost(KMessage *))); + disconnect(m_kbclient, TQT_SIGNAL(sigConnected()), this, TQT_SLOT(slotSendVersion())); + disconnect(m_connection, TQT_SIGNAL(sigAbortNetworkGame()), this, TQT_SLOT(slotAbortNetworkGame())); + disconnect(m_connection, TQT_SIGNAL(sigStatusBar(const TQString &)), this, TQT_SLOT(slotStatusMsg(const TQString &))); + disconnect(m_connection, TQT_SIGNAL(sigEnemyNickname(const TQString &)), this, TQT_SLOT(slotChangeEnemyPlayer(const TQString &))); + disconnect(m_connection, TQT_SIGNAL(sigSendFieldState(int, int)), this, TQT_SLOT(slotSendEnemyFieldState(int, int))); + disconnect(m_connection, TQT_SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, TQT_SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); + disconnect(m_connection, TQT_SIGNAL(sigShootable(bool)), this, TQT_SLOT(slotSetShootable(bool))); + disconnect(m_connection, TQT_SIGNAL(sigPlaceShips(bool)), this, TQT_SLOT(slotSetPlaceable(bool))); + disconnect(m_connection, TQT_SIGNAL(sigServerLost()), this, TQT_SLOT(slotServerLost())); + disconnect(m_connection, TQT_SIGNAL(sigReplay()), this, TQT_SLOT(slotReplay())); + disconnect(m_connection, TQT_SIGNAL(sigChatMessage(const TQString &, const TQString &, bool)), m_chat, TQT_SLOT(slotReceivedMessage(const TQString &, const TQString &, bool))); + disconnect(m_connection, TQT_SIGNAL(sigLost(KMessage *)), this, TQT_SLOT(slotLost(KMessage *))); m_connection->updateInternal(m_kbserver); - connect(m_connection, SIGNAL(sigStatusBar(const QString &)), this, SLOT(slotStatusMsg(const QString &))); - connect(m_connection, SIGNAL(sigEnemyNickname(const QString &)), this, SLOT(slotChangeEnemyPlayer(const QString &))); - connect(m_connection, SIGNAL(sigSendNickname()), this, SLOT(slotSendGreet())); - connect(m_connection, SIGNAL(sigPlaceShips(bool)), this, SLOT(slotSetPlaceable(bool))); - connect(m_connection, SIGNAL(sigShootable(bool)), this, SLOT(slotSetShootable(bool))); - connect(m_connection, SIGNAL(sigSendFieldState(int, int)), this, SLOT(slotSendEnemyFieldState(int, int))); - connect(m_connection, SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); - connect(m_connection, SIGNAL(sigClientLost()), this, SLOT(slotClientLost())); - connect(m_connection, SIGNAL(sigAbortNetworkGame()), this, SLOT(slotAbortNetworkGame())); - connect(m_connection, SIGNAL(sigReplay()), this, SLOT(slotReplayRequest())); - connect(m_connection, SIGNAL(sigChatMessage(const QString &, const QString &, bool)), m_chat, SLOT(slotReceivedMessage(const QString &, const QString &, bool))); - connect(m_connection, SIGNAL(sigLost(KMessage *)), this, SLOT(slotLost(KMessage *))); + connect(m_connection, TQT_SIGNAL(sigStatusBar(const TQString &)), this, TQT_SLOT(slotStatusMsg(const TQString &))); + connect(m_connection, TQT_SIGNAL(sigEnemyNickname(const TQString &)), this, TQT_SLOT(slotChangeEnemyPlayer(const TQString &))); + connect(m_connection, TQT_SIGNAL(sigSendNickname()), this, TQT_SLOT(slotSendGreet())); + connect(m_connection, TQT_SIGNAL(sigPlaceShips(bool)), this, TQT_SLOT(slotSetPlaceable(bool))); + connect(m_connection, TQT_SIGNAL(sigShootable(bool)), this, TQT_SLOT(slotSetShootable(bool))); + connect(m_connection, TQT_SIGNAL(sigSendFieldState(int, int)), this, TQT_SLOT(slotSendEnemyFieldState(int, int))); + connect(m_connection, TQT_SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, TQT_SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); + connect(m_connection, TQT_SIGNAL(sigClientLost()), this, TQT_SLOT(slotClientLost())); + connect(m_connection, TQT_SIGNAL(sigAbortNetworkGame()), this, TQT_SLOT(slotAbortNetworkGame())); + connect(m_connection, TQT_SIGNAL(sigReplay()), this, TQT_SLOT(slotReplayRequest())); + connect(m_connection, TQT_SIGNAL(sigChatMessage(const TQString &, const TQString &, bool)), m_chat, TQT_SLOT(slotReceivedMessage(const TQString &, const TQString &, bool))); + connect(m_connection, TQT_SIGNAL(sigLost(KMessage *)), this, TQT_SLOT(slotLost(KMessage *))); } else m_connection->updateInternal(m_kbserver); @@ -923,7 +923,7 @@ void KBattleshipWindow::slotSendEnemyFieldState(int fieldx, int fieldy) { int data, showstate; bool xokay = false, yokay = false, is_kill = false; - typedef QValueList<int> DeathValueList; + typedef TQValueList<int> DeathValueList; DeathValueList deathList; data = m_ownshiplist->shipTypeAt(fieldx, fieldy); @@ -982,46 +982,46 @@ void KBattleshipWindow::slotSendEnemyFieldState(int fieldx, int fieldy) } else if(m_ownshiplist->shipTypeAt(fieldx, fieldy) == 0) { - msg->addField(QString("xstart"), QString::number(fieldx)); - msg->addField(QString("xstop"), QString::number(fieldx)); - msg->addField(QString("ystart"), QString::number(fieldy)); - msg->addField(QString("ystop"), QString::number(fieldy)); - msg->addField(QString("death"), QString("true")); + msg->addField(TQString("xstart"), TQString::number(fieldx)); + msg->addField(TQString("xstop"), TQString::number(fieldx)); + msg->addField(TQString("ystart"), TQString::number(fieldy)); + msg->addField(TQString("ystop"), TQString::number(fieldy)); + msg->addField(TQString("death"), TQString("true")); is_kill = true; } } - msg->addField(QString("fieldx"), QString::number(fieldx)); - msg->addField(QString("fieldy"), QString::number(fieldy)); + msg->addField(TQString("fieldx"), TQString::number(fieldx)); + msg->addField(TQString("fieldy"), TQString::number(fieldy)); if(xokay) { - msg->addField(QString("xstart"), QString::number(deathList.first())); - msg->addField(QString("xstop"), QString::number(deathList.last())); - msg->addField(QString("ystart"), QString::number(fieldy)); - msg->addField(QString("ystop"), QString::number(fieldy)); - msg->addField(QString("death"), QString("true")); + msg->addField(TQString("xstart"), TQString::number(deathList.first())); + msg->addField(TQString("xstop"), TQString::number(deathList.last())); + msg->addField(TQString("ystart"), TQString::number(fieldy)); + msg->addField(TQString("ystop"), TQString::number(fieldy)); + msg->addField(TQString("death"), TQString("true")); is_kill = true; } else if(yokay) { - msg->addField(QString("xstart"), QString::number(fieldx)); - msg->addField(QString("xstop"), QString::number(fieldx)); - msg->addField(QString("ystart"), QString::number(deathList.first())); - msg->addField(QString("ystop"), QString::number(deathList.last())); - msg->addField(QString("death"), QString("true")); + msg->addField(TQString("xstart"), TQString::number(fieldx)); + msg->addField(TQString("xstop"), TQString::number(fieldx)); + msg->addField(TQString("ystart"), TQString::number(deathList.first())); + msg->addField(TQString("ystop"), TQString::number(deathList.last())); + msg->addField(TQString("death"), TQString("true")); is_kill = true; } if(is_kill) // If sunk, reveal ship type - msg->addField(QString("fieldstate"), QString::number(data)); + msg->addField(TQString("fieldstate"), TQString::number(data)); else if(showstate == KBattleField::HIT) // On non-fatal hit, keep ship type secret - msg->addField(QString("fieldstate"), QString::number(1)); + msg->addField(TQString("fieldstate"), TQString::number(1)); else /* showstate == KBattleField::WATER */ // Miss - msg->addField(QString("fieldstate"), QString::number(99)); + msg->addField(TQString("fieldstate"), TQString::number(99)); if(m_connection->type() == KonnectionHandling::SERVER) m_kbserver->sendMessage(msg); @@ -1094,14 +1094,14 @@ void KBattleshipWindow::parseCommandLine() { void KBattleshipWindow::slotConnectToBattleshipServer() { - QString host = m_client->host(); + TQString host = m_client->host(); int port = m_client->port().toInt(); - QString nickname = m_client->nickname(); + TQString nickname = m_client->nickname(); delete m_client; m_client = 0; slotConnectToBattleshipServer(host, port, nickname); } -void KBattleshipWindow::slotConnectToBattleshipServer(const QString &host, int port, const QString &nickname) +void KBattleshipWindow::slotConnectToBattleshipServer(const TQString &host, int port, const TQString &nickname) { m_kbclient = new KBattleshipClient(host, port); nickname.isEmpty() ? m_ownNickname = "TestUser" : m_ownNickname = nickname; @@ -1119,51 +1119,51 @@ void KBattleshipWindow::slotConnectToBattleshipServer(const QString &host, int p if(m_connection == 0) { m_connection = new KonnectionHandling(this, m_kbclient); - connect(m_kbclient, SIGNAL(sigConnected()), this, SLOT(slotSendVersion())); - connect(m_connection, SIGNAL(sigAbortNetworkGame()), this, SLOT(slotAbortNetworkGame())); - connect(m_connection, SIGNAL(sigStatusBar(const QString &)), this, SLOT(slotStatusMsg(const QString &))); - connect(m_connection, SIGNAL(sigEnemyNickname(const QString &)), this, SLOT(slotChangeEnemyPlayer(const QString &))); - connect(m_connection, SIGNAL(sigSendFieldState(int, int)), this, SLOT(slotSendEnemyFieldState(int, int))); - connect(m_connection, SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); - connect(m_connection, SIGNAL(sigShootable(bool)), this, SLOT(slotSetShootable(bool))); - connect(m_connection, SIGNAL(sigPlaceShips(bool)), this, SLOT(slotSetPlaceable(bool))); - connect(m_connection, SIGNAL(sigServerLost()), this, SLOT(slotServerLost())); - connect(m_connection, SIGNAL(sigReplay()), this, SLOT(slotReplay())); - connect(m_connection, SIGNAL(sigChatMessage(const QString &, const QString &, bool)), m_chat, SLOT(slotReceivedMessage(const QString &, const QString &, bool))); - connect(m_connection, SIGNAL(sigClientInformation(const QString &, const QString &, const QString &, const QString &)), this, SLOT(slotReceivedClientInformation(const QString &, const QString &, const QString &, const QString &))); - connect(m_connection, SIGNAL(sigLost(KMessage *)), this, SLOT(slotLost(KMessage *))); + connect(m_kbclient, TQT_SIGNAL(sigConnected()), this, TQT_SLOT(slotSendVersion())); + connect(m_connection, TQT_SIGNAL(sigAbortNetworkGame()), this, TQT_SLOT(slotAbortNetworkGame())); + connect(m_connection, TQT_SIGNAL(sigStatusBar(const TQString &)), this, TQT_SLOT(slotStatusMsg(const TQString &))); + connect(m_connection, TQT_SIGNAL(sigEnemyNickname(const TQString &)), this, TQT_SLOT(slotChangeEnemyPlayer(const TQString &))); + connect(m_connection, TQT_SIGNAL(sigSendFieldState(int, int)), this, TQT_SLOT(slotSendEnemyFieldState(int, int))); + connect(m_connection, TQT_SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, TQT_SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); + connect(m_connection, TQT_SIGNAL(sigShootable(bool)), this, TQT_SLOT(slotSetShootable(bool))); + connect(m_connection, TQT_SIGNAL(sigPlaceShips(bool)), this, TQT_SLOT(slotSetPlaceable(bool))); + connect(m_connection, TQT_SIGNAL(sigServerLost()), this, TQT_SLOT(slotServerLost())); + connect(m_connection, TQT_SIGNAL(sigReplay()), this, TQT_SLOT(slotReplay())); + connect(m_connection, TQT_SIGNAL(sigChatMessage(const TQString &, const TQString &, bool)), m_chat, TQT_SLOT(slotReceivedMessage(const TQString &, const TQString &, bool))); + connect(m_connection, TQT_SIGNAL(sigClientInformation(const TQString &, const TQString &, const TQString &, const TQString &)), this, TQT_SLOT(slotReceivedClientInformation(const TQString &, const TQString &, const TQString &, const TQString &))); + connect(m_connection, TQT_SIGNAL(sigLost(KMessage *)), this, TQT_SLOT(slotLost(KMessage *))); } else { if(m_connection->type() == KonnectionHandling::SERVER) { - disconnect(m_connection, SIGNAL(sigStatusBar(const QString &)), this, SLOT(slotStatusMsg(const QString &))); - disconnect(m_connection, SIGNAL(sigEnemyNickname(const QString &)), this, SLOT(slotChangeEnemyPlayer(const QString &))); - disconnect(m_connection, SIGNAL(sigSendNickname()), this, SLOT(slotSendGreet())); - disconnect(m_connection, SIGNAL(sigPlaceShips(bool)), this, SLOT(slotSetPlaceable(bool))); - disconnect(m_connection, SIGNAL(sigShootable(bool)), this, SLOT(slotSetShootable(bool))); - disconnect(m_connection, SIGNAL(sigSendFieldState(int, int)), this, SLOT(slotSendEnemyFieldState(int, int))); - disconnect(m_connection, SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); - disconnect(m_connection, SIGNAL(sigClientLost()), this, SLOT(slotClientLost())); - disconnect(m_connection, SIGNAL(sigAbortNetworkGame()), this, SLOT(slotAbortNetworkGame())); - disconnect(m_connection, SIGNAL(sigReplay()), this, SLOT(slotReplayRequest())); - disconnect(m_connection, SIGNAL(sigChatMessage(const QString &, const QString &, bool)), m_chat, SLOT(slotReceivedMessage(const QString &, const QString &, bool))); - disconnect(m_connection, SIGNAL(sigLost(KMessage *)), this, SLOT(slotLost(KMessage *))); + disconnect(m_connection, TQT_SIGNAL(sigStatusBar(const TQString &)), this, TQT_SLOT(slotStatusMsg(const TQString &))); + disconnect(m_connection, TQT_SIGNAL(sigEnemyNickname(const TQString &)), this, TQT_SLOT(slotChangeEnemyPlayer(const TQString &))); + disconnect(m_connection, TQT_SIGNAL(sigSendNickname()), this, TQT_SLOT(slotSendGreet())); + disconnect(m_connection, TQT_SIGNAL(sigPlaceShips(bool)), this, TQT_SLOT(slotSetPlaceable(bool))); + disconnect(m_connection, TQT_SIGNAL(sigShootable(bool)), this, TQT_SLOT(slotSetShootable(bool))); + disconnect(m_connection, TQT_SIGNAL(sigSendFieldState(int, int)), this, TQT_SLOT(slotSendEnemyFieldState(int, int))); + disconnect(m_connection, TQT_SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, TQT_SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); + disconnect(m_connection, TQT_SIGNAL(sigClientLost()), this, TQT_SLOT(slotClientLost())); + disconnect(m_connection, TQT_SIGNAL(sigAbortNetworkGame()), this, TQT_SLOT(slotAbortNetworkGame())); + disconnect(m_connection, TQT_SIGNAL(sigReplay()), this, TQT_SLOT(slotReplayRequest())); + disconnect(m_connection, TQT_SIGNAL(sigChatMessage(const TQString &, const TQString &, bool)), m_chat, TQT_SLOT(slotReceivedMessage(const TQString &, const TQString &, bool))); + disconnect(m_connection, TQT_SIGNAL(sigLost(KMessage *)), this, TQT_SLOT(slotLost(KMessage *))); m_connection->updateInternal(m_kbclient); - connect(m_kbclient, SIGNAL(sigConnected()), this, SLOT(slotSendVersion())); - connect(m_connection, SIGNAL(sigAbortNetworkGame()), this, SLOT(slotAbortNetworkGame())); - connect(m_connection, SIGNAL(sigStatusBar(const QString &)), this, SLOT(slotStatusMsg(const QString &))); - connect(m_connection, SIGNAL(sigEnemyNickname(const QString &)), this, SLOT(slotChangeEnemyPlayer(const QString &))); - connect(m_connection, SIGNAL(sigSendFieldState(int, int)), this, SLOT(slotSendEnemyFieldState(int, int))); - connect(m_connection, SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); - connect(m_connection, SIGNAL(sigShootable(bool)), this, SLOT(slotSetShootable(bool))); - connect(m_connection, SIGNAL(sigPlaceShips(bool)), this, SLOT(slotSetPlaceable(bool))); - connect(m_connection, SIGNAL(sigServerLost()), this, SLOT(slotServerLost())); - connect(m_connection, SIGNAL(sigReplay()), this, SLOT(slotReplay())); - connect(m_connection, SIGNAL(sigChatMessage(const QString &, const QString &, bool)), m_chat, SLOT(slotReceivedMessage(const QString &, const QString &, bool))); + connect(m_kbclient, TQT_SIGNAL(sigConnected()), this, TQT_SLOT(slotSendVersion())); + connect(m_connection, TQT_SIGNAL(sigAbortNetworkGame()), this, TQT_SLOT(slotAbortNetworkGame())); + connect(m_connection, TQT_SIGNAL(sigStatusBar(const TQString &)), this, TQT_SLOT(slotStatusMsg(const TQString &))); + connect(m_connection, TQT_SIGNAL(sigEnemyNickname(const TQString &)), this, TQT_SLOT(slotChangeEnemyPlayer(const TQString &))); + connect(m_connection, TQT_SIGNAL(sigSendFieldState(int, int)), this, TQT_SLOT(slotSendEnemyFieldState(int, int))); + connect(m_connection, TQT_SIGNAL(sigEnemyFieldData(int, int, int, int, int, int, int, bool)), this, TQT_SLOT(slotReceivedEnemyFieldData(int, int, int, int, int, int, int, bool))); + connect(m_connection, TQT_SIGNAL(sigShootable(bool)), this, TQT_SLOT(slotSetShootable(bool))); + connect(m_connection, TQT_SIGNAL(sigPlaceShips(bool)), this, TQT_SLOT(slotSetPlaceable(bool))); + connect(m_connection, TQT_SIGNAL(sigServerLost()), this, TQT_SLOT(slotServerLost())); + connect(m_connection, TQT_SIGNAL(sigReplay()), this, TQT_SLOT(slotReplay())); + connect(m_connection, TQT_SIGNAL(sigChatMessage(const TQString &, const TQString &, bool)), m_chat, TQT_SLOT(slotReceivedMessage(const TQString &, const TQString &, bool))); m_kbclient->init(); - connect(m_connection, SIGNAL(sigClientInformation(const QString &, const QString &, const QString &, const QString &)), this, SLOT(slotReceivedClientInformation(const QString &, const QString &, const QString &, const QString &))); - connect(m_connection, SIGNAL(sigLost(KMessage *)), this, SLOT(slotLost(KMessage *))); + connect(m_connection, TQT_SIGNAL(sigClientInformation(const TQString &, const TQString &, const TQString &, const TQString &)), this, TQT_SLOT(slotReceivedClientInformation(const TQString &, const TQString &, const TQString &, const TQString &))); + connect(m_connection, TQT_SIGNAL(sigLost(KMessage *)), this, TQT_SLOT(slotLost(KMessage *))); } else m_connection->updateInternal(m_kbclient); @@ -1189,19 +1189,19 @@ void KBattleshipWindow::slotShowGrid() m_view->field()->enableGrid(); } -void KBattleshipWindow::slotStatusMsg(const QString &text) +void KBattleshipWindow::slotStatusMsg(const TQString &text) { statusBar()->clear(); statusBar()->changeItem(text, ID_STATUS_MSG); } -void KBattleshipWindow::slotChangeOwnPlayer(const QString &text) +void KBattleshipWindow::slotChangeOwnPlayer(const TQString &text) { statusBar()->clear(); statusBar()->changeItem(i18n(" Player 1: %1 ").arg(text), ID_PLAYER_OWN); } -void KBattleshipWindow::slotChangeEnemyPlayer(const QString &text) +void KBattleshipWindow::slotChangeEnemyPlayer(const TQString &text) { statusBar()->clear(); statusBar()->changeItem(i18n(" Player 2: %1 ").arg(text), ID_PLAYER_ENEMY); @@ -1234,7 +1234,7 @@ void KBattleshipWindow::slotSinglePlayer() slotStatusMsg(i18n("Ready")); m_stat->clear(); m_chat->clear(); - QTimer::singleShot(0, this, SLOT(slotDeleteAI())); + TQTimer::singleShot(0, this, TQT_SLOT(slotDeleteAI())); cleanup(false); } } @@ -1269,8 +1269,8 @@ void KBattleshipWindow::slotStartBattleshipGame(bool clearstat) { m_aiPlayer = new KBAIPlayer(); m_aiPlayer->init(m_view->field(), m_enemyshiplist); - connect(m_aiPlayer, SIGNAL(sigReady()), this, SLOT(slotAIReady())); - connect(m_aiPlayer, SIGNAL(sigShootAt(const QPoint)), this, SLOT(slotAIShootsAt(const QPoint))); + connect(m_aiPlayer, TQT_SIGNAL(sigReady()), this, TQT_SLOT(slotAIReady())); + connect(m_aiPlayer, TQT_SIGNAL(sigShootAt(const TQPoint)), this, TQT_SLOT(slotAIShootsAt(const TQPoint))); } m_aiPlayer->slotRestart(); } @@ -1281,7 +1281,7 @@ void KBattleshipWindow::slotAIReady() m_placeable = true; } -void KBattleshipWindow::slotAIShootsAt(const QPoint pos) +void KBattleshipWindow::slotAIShootsAt(const TQPoint pos) { if(!m_shootable) m_shootable = true; @@ -1317,14 +1317,14 @@ void KBattleshipWindow::slotAIShootsAt(const QPoint pos) m_stat->slotAddEnemyWon(); slotUpdateHighscore(); m_view->drawEnemyShipsAI(m_enemyshiplist); // let's show ai player ships - switch(KMessageBox::questionYesNo(this, i18n("Do you want to restart the game?"), QString::null, i18n("Restart"), i18n("Do Not Restart"))) + switch(KMessageBox::questionYesNo(this, i18n("Do you want to restart the game?"), TQString::null, i18n("Restart"), i18n("Do Not Restart"))) { case KMessageBox::Yes: - QTimer::singleShot(0, this, SLOT(slotRestartAI())); + TQTimer::singleShot(0, this, TQT_SLOT(slotRestartAI())); break; case KMessageBox::No: - QTimer::singleShot(0, this, SLOT(slotDeleteAI())); + TQTimer::singleShot(0, this, TQT_SLOT(slotDeleteAI())); break; } } @@ -1335,7 +1335,7 @@ void KBattleshipWindow::slotAIShootsAt(const QPoint pos) } } -void KBattleshipWindow::slotReceivedClientInformation(const QString &clientName, const QString &clientVersion, const QString &clientDescription, const QString &protocolVersion) +void KBattleshipWindow::slotReceivedClientInformation(const TQString &clientName, const TQString &clientVersion, const TQString &clientDescription, const TQString &protocolVersion) { m_enemyClient = clientName; m_enemyClientVersion = clientVersion; |