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 --- kbackgammon/engines/nextgen/kbggame.cpp | 6 ++-- kbackgammon/engines/nextgen/kbggame.h | 3 +- kbackgammon/engines/nextgen/kbgng.cpp | 58 ++++++++++++++++----------------- kbackgammon/engines/nextgen/kbgng.h | 15 +++++---- kbackgammon/engines/nextgen/kbgplayer.h | 1 + 5 files changed, 43 insertions(+), 40 deletions(-) (limited to 'kbackgammon/engines/nextgen') diff --git a/kbackgammon/engines/nextgen/kbggame.cpp b/kbackgammon/engines/nextgen/kbggame.cpp index 13ae076a..d00c1966 100644 --- a/kbackgammon/engines/nextgen/kbggame.cpp +++ b/kbackgammon/engines/nextgen/kbggame.cpp @@ -31,15 +31,15 @@ /* * Constructor */ -KBgGame::KBgGame(int cookie, TQObject *parent) - : KGame(cookie, parent) +KBgGame::KBgGame(int cookie, TQObject *tqparent) + : KGame(cookie, tqparent) { // do nothing... } bool KBgGame::playerInput(TQDataStream &msg,KPlayer *player) { - Q_INT32 move; + TQ_INT32 move; msg >> move; cerr << " Player " << player->id() << " moved to " << move << endl; return true; diff --git a/kbackgammon/engines/nextgen/kbggame.h b/kbackgammon/engines/nextgen/kbggame.h index 7888be62..255a3483 100644 --- a/kbackgammon/engines/nextgen/kbggame.h +++ b/kbackgammon/engines/nextgen/kbggame.h @@ -40,12 +40,13 @@ class KPlayer; class KDE_EXPORT KBgGame : public KGame { Q_OBJECT + TQ_OBJECT public: enum MsgID {Text, Cmd, MaxMsg}; - KBgGame(int cookie = 42, TQObject *parent = 0); + KBgGame(int cookie = 42, TQObject *tqparent = 0); protected: diff --git a/kbackgammon/engines/nextgen/kbgng.cpp b/kbackgammon/engines/nextgen/kbgng.cpp index 302cbb58..f2f04066 100644 --- a/kbackgammon/engines/nextgen/kbgng.cpp +++ b/kbackgammon/engines/nextgen/kbgng.cpp @@ -51,8 +51,8 @@ /* * Constructor */ -KBgEngineNg::KBgEngineNg(TQWidget *parent, TQString *name, TQPopupMenu *pmenu) - : KBgEngine(parent, name, pmenu) +KBgEngineNg::KBgEngineNg(TQWidget *tqparent, TQString *name, TQPopupMenu *pmenu) + : KBgEngine(tqparent, name, pmenu) { // get a new game initGame(); @@ -124,7 +124,7 @@ void KBgEngineNg::setGame() // initialize a new game bool ret = false; TQString label, port_s, host_s; - Q_UINT16 port; + TQ_UINT16 port; switch (_currGame = _gameSelect->currentItem()) { @@ -140,7 +140,7 @@ void KBgEngineNg::setGame() "65535."); port_s.setNum(_port); do { - port_s = KLineEditDlg::getText(label, port_s, &ret, (TQWidget *)parent()); + port_s = KLineEditDlg::getText(label, port_s, &ret, (TQWidget *)tqparent()); if (!ret) return; port = port_s.toUShort(&ret); @@ -150,7 +150,7 @@ void KBgEngineNg::setGame() emit infoText(i18n("Now waiting for incoming connections on port %1."). arg(_port = port)); else - emit infoText(i18n("Failed to offer connections on port %1.").arg(port)); + emit infoText(i18n("Failed to offer connections on port %1.").tqarg(port)); _game->addPlayer(createPlayer(0, _name[0])); break; @@ -159,16 +159,16 @@ void KBgEngineNg::setGame() label = i18n("Type the name of the server you want to connect to:"); host_s = _host; do { - host_s = KLineEditDlg::getText(label, host_s, &ret, (TQWidget *)parent()); + host_s = KLineEditDlg::getText(label, host_s, &ret, (TQWidget *)tqparent()); if (!ret) return; } while (host_s.isEmpty()); label = i18n("Type the port number on %1 you want to connect to.\nThe " - "number should be between 1024 and 65535.").arg(host_s); + "number should be between 1024 and 65535.").tqarg(host_s); port_s.setNum(_port); do { - port_s = KLineEditDlg::getText(label, port_s, &ret, (TQWidget *)parent()); + port_s = KLineEditDlg::getText(label, port_s, &ret, (TQWidget *)tqparent()); if (!ret) return; port = port_s.toUShort(&ret); @@ -183,10 +183,10 @@ void KBgEngineNg::setGame() _game->addPlayer(createPlayer(0, _name[0])); if (_game->connectToServer(host_s, port)) - emit infoText(i18n("Now connected to %1:%2.").arg(_host = host_s). + emit infoText(i18n("Now connected to %1:%2.").tqarg(_host = host_s). arg(_port = port)); else - emit infoText(i18n("Failed to connect to %1:%2.").arg(_host = host_s). + emit infoText(i18n("Failed to connect to %1:%2.").tqarg(_host = host_s). arg(_port = port)); // @@ -202,13 +202,13 @@ void KBgEngineNg::setGame() // we are still having problems with player creation... - // FIXME - which status _game->setGameStatus(KGame::End); + // FIXME - which status _game->setGametqStatus(KGame::End); } void KBgEngineNg::slotPlayerJoinedGame(KPlayer *p) { - emit infoText(i18n("Player %1 (%2) has joined the game.").arg(p->name()).arg(p->id())); - cerr << i18n("Player %1 (%2) has joined the game.").arg(p->name()).arg(p->id()).latin1() << endl; + emit infoText(i18n("Player %1 (%2) has joined the game.").tqarg(p->name()).tqarg(p->id())); + cerr << i18n("Player %1 (%2) has joined the game.").tqarg(p->name()).tqarg(p->id()).latin1() << endl; } void KBgEngineNg::slotCreatePlayer(KPlayer *&p, int rtti, int io, bool v, KGame *g) @@ -216,16 +216,16 @@ void KBgEngineNg::slotCreatePlayer(KPlayer *&p, int rtti, int io, bool v, KGame Q_UNUSED(rtti) Q_UNUSED(g) Q_UNUSED(io) - emit infoText(i18n("creating player. virtual=%1").arg(v)); + emit infoText(i18n("creating player. virtual=%1").tqarg(v)); p = createPlayer(1); } -void KBgEngineNg::slotClientConnected(Q_UINT32) +void KBgEngineNg::slotClientConnected(TQ_UINT32) { cerr << "client has joint the game..." << endl; } -void KBgEngineNg::slotClientDisconnected(Q_UINT32, bool) +void KBgEngineNg::slotClientDisconnected(TQ_UINT32, bool) { cerr << "KBgEngineNg::slotClientDisconnected" << endl; } @@ -507,7 +507,7 @@ void KBgEngineNg::slotPropertyChanged(KGamePropertyBase *p, KPlayer *me) case KGamePropertyBase::IdName: emit infoText(i18n("Player %1 has changed the name to %2.") - .arg(_name[player]).arg(me->name())); + .tqarg(_name[player]).tqarg(me->name())); _name[player] = me->name(); break; @@ -542,14 +542,14 @@ void KBgEngineNg::changeName() TQString name; for (int i = 0; i < 2; i++) { - name = TQString::null; + name = TQString(); while (!_player[i]->isVirtual() && name.isEmpty()) { if (i == 0) name = KLineEditDlg::getText(i18n("Type the name of the first player:"), - _name[i], &ok, (TQWidget *)parent()); + _name[i], &ok, (TQWidget *)tqparent()); else name = KLineEditDlg::getText(i18n("Type the name of the second player:"), - _name[i], &ok, (TQWidget *)parent()); + _name[i], &ok, (TQWidget *)tqparent()); if (!ok) return; _player[i]->setName(name); } @@ -559,7 +559,7 @@ void KBgEngineNg::changeName() /* * Receive data sent via KBgGame::sendMessage(...) */ -void KBgEngineNg::slotNetworkData(int msgid, const TQByteArray &msg, Q_UINT32 r, Q_UINT32 s) +void KBgEngineNg::slotNetworkData(int msgid, const TQByteArray &msg, TQ_UINT32 r, TQ_UINT32 s) { Q_UNUSED(r); Q_UNUSED(s); @@ -567,8 +567,8 @@ void KBgEngineNg::slotNetworkData(int msgid, const TQByteArray &msg, Q_UINT32 r, case KBgGame::Cmd: emit infoText(msg); - emit infoText(i18n("Players are %1 and %2").arg(_player[0]->name()) - .arg(_player[1]->name())); + emit infoText(i18n("Players are %1 and %2").tqarg(_player[0]->name()) + .tqarg(_player[1]->name())); break; default: @@ -608,15 +608,15 @@ void KBgEngineNg::initGame() connect(_game, TQT_SIGNAL(signalCreatePlayer(KPlayer *&, int, int, bool, KGame *)), this, TQT_SLOT(slotCreatePlayer(KPlayer *&, int, int, bool, KGame *))); - connect(_game, TQT_SIGNAL(signalClientConnected(Q_UINT32)), - this, TQT_SLOT(slotClientConnected(Q_UINT32))); - connect(_game, TQT_SIGNAL(signalClientDisconnected(Q_UINT32, bool)), - this, TQT_SLOT(slotClientDisconnected(Q_UINT32, bool))); + connect(_game, TQT_SIGNAL(signalClientConnected(TQ_UINT32)), + this, TQT_SLOT(slotClientConnected(TQ_UINT32))); + connect(_game, TQT_SIGNAL(signalClientDisconnected(TQ_UINT32, bool)), + this, TQT_SLOT(slotClientDisconnected(TQ_UINT32, bool))); connect(_game, TQT_SIGNAL(signalPropertyChanged(KGamePropertyBase *, KGame *)), this, TQT_SLOT(slotPropertyChanged(KGamePropertyBase *, KGame *))); - connect(_game, TQT_SIGNAL(signalNetworkData(int,const TQByteArray &, Q_UINT32, Q_UINT32)), - this, TQT_SLOT(slotNetworkData(int,const TQByteArray &, Q_UINT32, Q_UINT32))); + connect(_game, TQT_SIGNAL(signalNetworkData(int,const TQByteArray &, TQ_UINT32, TQ_UINT32)), + this, TQT_SLOT(slotNetworkData(int,const TQByteArray &, TQ_UINT32, TQ_UINT32))); } // EOF diff --git a/kbackgammon/engines/nextgen/kbgng.h b/kbackgammon/engines/nextgen/kbgng.h index 99ea82c1..12c94140 100644 --- a/kbackgammon/engines/nextgen/kbgng.h +++ b/kbackgammon/engines/nextgen/kbgng.h @@ -51,13 +51,14 @@ class KBgEngineNg : public KBgEngine { Q_OBJECT + TQ_OBJECT public: /* * Constructor and destructor */ - KBgEngineNg( TQWidget *parent = 0, TQString *name = 0, TQPopupMenu *pmenu = 0); + KBgEngineNg( TQWidget *tqparent = 0, TQString *name = 0, TQPopupMenu *pmenu = 0); virtual ~KBgEngineNg(); /** @@ -152,11 +153,11 @@ public slots: void slotPlayerJoinedGame(KPlayer *p); - void slotNetworkData(int msgid, const TQByteArray &msg, Q_UINT32 receiver, Q_UINT32 sender); + void slotNetworkData(int msgid, const TQByteArray &msg, TQ_UINT32 receiver, TQ_UINT32 sender); void slotCreatePlayer(KPlayer *&, int, int, bool, KGame *); - void slotClientDisconnected(Q_UINT32, bool); - void slotClientConnected(Q_UINT32); + void slotClientDisconnected(TQ_UINT32, bool); + void slotClientConnected(TQ_UINT32); void slotPropertyChanged(KGamePropertyBase *p, KGame *me); void slotPropertyChanged(KGamePropertyBase *p, KPlayer *me); @@ -220,7 +221,7 @@ private: int _nplayers; TQString _host; - Q_UINT16 _port; + TQ_UINT16 _port; // ************************************************************ // ************************************************************ @@ -244,11 +245,11 @@ private: /** * Create the i-th player. Legal values for i are 0 and 1. The - * name of the player is taken from @ref _name and the parent of + * name of the player is taken from @ref _name and the tqparent of * the player is @ref _player. That means that the players are * automatically deleted. */ - KBgPlayer * createPlayer(int i, TQString name = TQString::null); + KBgPlayer * createPlayer(int i, TQString name = TQString()); private: diff --git a/kbackgammon/engines/nextgen/kbgplayer.h b/kbackgammon/engines/nextgen/kbgplayer.h index 8d6536de..c9fcdb1c 100644 --- a/kbackgammon/engines/nextgen/kbgplayer.h +++ b/kbackgammon/engines/nextgen/kbgplayer.h @@ -41,6 +41,7 @@ class KGame; class KBgPlayer : public KPlayer { Q_OBJECT + TQ_OBJECT public: -- cgit v1.2.3