summaryrefslogtreecommitdiffstats
path: root/libkdegames/kgame/kgamenetwork.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
commit576eb4299a00bc053db35414406f46372a0f70f2 (patch)
tree4c030922d533821db464af566188e7d40cc8848c /libkdegames/kgame/kgamenetwork.cpp
parent0718336b6017d1a4fc1d626544180a5a2a29ddec (diff)
downloadtdegames-576eb4299a00bc053db35414406f46372a0f70f2.tar.gz
tdegames-576eb4299a00bc053db35414406f46372a0f70f2.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdegames/kgame/kgamenetwork.cpp')
-rw-r--r--libkdegames/kgame/kgamenetwork.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/libkdegames/kgame/kgamenetwork.cpp b/libkdegames/kgame/kgamenetwork.cpp
index 9eccb868..92669834 100644
--- a/libkdegames/kgame/kgamenetwork.cpp
+++ b/libkdegames/kgame/kgamenetwork.cpp
@@ -33,7 +33,7 @@
#include <kdebug.h>
-#include <qbuffer.h>
+#include <tqbuffer.h>
class KGameNetworkPrivate
@@ -52,14 +52,14 @@ public:
KMessageServer* mMessageServer;
Q_UINT32 mDisconnectId; // Stores gameId() over a disconnect process
DNSSD::PublicService* mService;
- QString mType;
- QString mName;
+ TQString mType;
+ TQString mName;
int mCookie;
};
// ------------------- NETWORK GAME ------------------------
-KGameNetwork::KGameNetwork(int c, QObject* parent) : QObject(parent, 0)
+KGameNetwork::KGameNetwork(int c, TQObject* parent) : TQObject(parent, 0)
{
d = new KGameNetworkPrivate;
d->mCookie = (Q_INT16)c;
@@ -120,25 +120,25 @@ void KGameNetwork::setMaster()
}
if (!d->mMessageClient) {
d->mMessageClient = new KMessageClient (this);
- connect (d->mMessageClient, SIGNAL(broadcastReceived(const QByteArray&, Q_UINT32)),
- this, SLOT(receiveNetworkTransmission(const QByteArray&, Q_UINT32)));
- connect (d->mMessageClient, SIGNAL(connectionBroken()),
- this, SIGNAL(signalConnectionBroken()));
- connect (d->mMessageClient, SIGNAL(aboutToDisconnect(Q_UINT32)),
- this, SLOT(aboutToLoseConnection(Q_UINT32)));
- connect (d->mMessageClient, SIGNAL(connectionBroken()),
- this, SLOT(slotResetConnection()));
-
- connect (d->mMessageClient, SIGNAL(adminStatusChanged(bool)),
- this, SLOT(slotAdminStatusChanged(bool)));
- connect (d->mMessageClient, SIGNAL(eventClientConnected(Q_UINT32)),
- this, SIGNAL(signalClientConnected(Q_UINT32)));
- connect (d->mMessageClient, SIGNAL(eventClientDisconnected(Q_UINT32, bool)),
- this, SIGNAL(signalClientDisconnected(Q_UINT32, bool)));
+ connect (d->mMessageClient, TQT_SIGNAL(broadcastReceived(const TQByteArray&, Q_UINT32)),
+ this, TQT_SLOT(receiveNetworkTransmission(const TQByteArray&, Q_UINT32)));
+ connect (d->mMessageClient, TQT_SIGNAL(connectionBroken()),
+ this, TQT_SIGNAL(signalConnectionBroken()));
+ connect (d->mMessageClient, TQT_SIGNAL(aboutToDisconnect(Q_UINT32)),
+ this, TQT_SLOT(aboutToLoseConnection(Q_UINT32)));
+ connect (d->mMessageClient, TQT_SIGNAL(connectionBroken()),
+ this, TQT_SLOT(slotResetConnection()));
+
+ connect (d->mMessageClient, TQT_SIGNAL(adminStatusChanged(bool)),
+ this, TQT_SLOT(slotAdminStatusChanged(bool)));
+ connect (d->mMessageClient, TQT_SIGNAL(eventClientConnected(Q_UINT32)),
+ this, TQT_SIGNAL(signalClientConnected(Q_UINT32)));
+ connect (d->mMessageClient, TQT_SIGNAL(eventClientDisconnected(Q_UINT32, bool)),
+ this, TQT_SIGNAL(signalClientDisconnected(Q_UINT32, bool)));
// broacast and direct messages are treated equally on receive.
- connect (d->mMessageClient, SIGNAL(forwardReceived(const QByteArray&, Q_UINT32, const QValueList<Q_UINT32>&)),
- d->mMessageClient, SIGNAL(broadcastReceived(const QByteArray&, Q_UINT32)));
+ connect (d->mMessageClient, TQT_SIGNAL(forwardReceived(const TQByteArray&, Q_UINT32, const TQValueList<Q_UINT32>&)),
+ d->mMessageClient, TQT_SIGNAL(broadcastReceived(const TQByteArray&, Q_UINT32)));
} else {
// should be no problem but still has to be tested
@@ -147,7 +147,7 @@ void KGameNetwork::setMaster()
d->mMessageClient->setServer(d->mMessageServer);
}
-void KGameNetwork::setDiscoveryInfo(const QString& type, const QString& name)
+void KGameNetwork::setDiscoveryInfo(const TQString& type, const TQString& name)
{
kdDebug() << k_funcinfo << type << ":" << name << endl;
d->mType = type;
@@ -201,7 +201,7 @@ bool KGameNetwork::offerConnections(Q_UINT16 port)
return true;
}
-bool KGameNetwork::connectToServer (const QString& host, Q_UINT16 port)
+bool KGameNetwork::connectToServer (const TQString& host, Q_UINT16 port)
{
if (host.isEmpty()) {
kdError(11001) << k_funcinfo << "No hostname given" << endl;
@@ -251,7 +251,7 @@ Q_UINT16 KGameNetwork::port() const
return 0;
}
-QString KGameNetwork::hostName() const
+TQString KGameNetwork::hostName() const
{
return d->mMessageClient->peerName();
}
@@ -276,8 +276,8 @@ void KGameNetwork::disconnect()
kdDebug(11001) << k_funcinfo << endl;
stopServerConnection();
if (d->mMessageServer) {
- QValueList <Q_UINT32> list=d->mMessageServer->clientIDs();
- QValueList<Q_UINT32>::Iterator it;
+ TQValueList <Q_UINT32> list=d->mMessageServer->clientIDs();
+ TQValueList<Q_UINT32>::Iterator it;
for( it = list.begin(); it != list.end(); ++it )
{
kdDebug(11001) << "Client id=" << (*it) << endl;
@@ -338,8 +338,8 @@ void KGameNetwork::electAdmin(Q_UINT32 clientID)
kdWarning(11001) << k_funcinfo << "only ADMIN is allowed to call this!" << endl;
return;
}
- QByteArray buffer;
- QDataStream stream(buffer,IO_WriteOnly);
+ TQByteArray buffer;
+ TQDataStream stream(buffer,IO_WriteOnly);
stream << static_cast<Q_UINT32>( KMessageServer::REQ_ADMIN_CHANGE );
stream << clientID;
d->mMessageClient->sendServerMessage(buffer);
@@ -351,8 +351,8 @@ void KGameNetwork::setMaxClients(int max)
kdWarning(11001) << k_funcinfo << "only ADMIN is allowed to call this!" << endl;
return;
}
- QByteArray buffer;
- QDataStream stream(buffer,IO_WriteOnly);
+ TQByteArray buffer;
+ TQDataStream stream(buffer,IO_WriteOnly);
stream << static_cast<Q_UINT32>( KMessageServer::REQ_MAX_NUM_CLIENTS );
stream << (Q_INT32)max;
d->mMessageClient->sendServerMessage(buffer);
@@ -376,27 +376,27 @@ void KGameNetwork::unlock()
bool KGameNetwork::sendSystemMessage(int data, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
{
- QByteArray buffer;
- QDataStream stream(buffer,IO_WriteOnly);
+ TQByteArray buffer;
+ TQDataStream stream(buffer,IO_WriteOnly);
stream << data;
return sendSystemMessage(buffer,msgid,receiver,sender);
}
-bool KGameNetwork::sendSystemMessage(const QString &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendSystemMessage(const TQString &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
{
- QByteArray buffer;
- QDataStream stream(buffer, IO_WriteOnly);
+ TQByteArray buffer;
+ TQDataStream stream(buffer, IO_WriteOnly);
stream << msg;
return sendSystemMessage(buffer, msgid, receiver, sender);
}
-bool KGameNetwork::sendSystemMessage(const QDataStream &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
-{ return sendSystemMessage(((QBuffer*)msg.device())->buffer(), msgid, receiver, sender); }
+bool KGameNetwork::sendSystemMessage(const TQDataStream &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+{ return sendSystemMessage(((TQBuffer*)msg.device())->buffer(), msgid, receiver, sender); }
-bool KGameNetwork::sendSystemMessage(const QByteArray& data, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendSystemMessage(const TQByteArray& data, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
{
- QByteArray buffer;
- QDataStream stream(buffer,IO_WriteOnly);
+ TQByteArray buffer;
+ TQDataStream stream(buffer,IO_WriteOnly);
if (!sender) {
sender = gameId();
}
@@ -438,19 +438,19 @@ bool KGameNetwork::sendSystemMessage(const QByteArray& data, int msgid, Q_UINT32
bool KGameNetwork::sendMessage(int data, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
{ return sendSystemMessage(data,msgid+KGameMessage::IdUser,receiver,sender); }
-bool KGameNetwork::sendMessage(const QString &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendMessage(const TQString &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
{ return sendSystemMessage(msg,msgid+KGameMessage::IdUser,receiver,sender); }
-bool KGameNetwork::sendMessage(const QDataStream &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendMessage(const TQDataStream &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
{ return sendSystemMessage(msg, msgid+KGameMessage::IdUser, receiver, sender); }
-bool KGameNetwork::sendMessage(const QByteArray &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendMessage(const TQByteArray &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
{ return sendSystemMessage(msg, msgid+KGameMessage::IdUser, receiver, sender); }
-void KGameNetwork::sendError(int error,const QByteArray& message, Q_UINT32 receiver, Q_UINT32 sender)
+void KGameNetwork::sendError(int error,const TQByteArray& message, Q_UINT32 receiver, Q_UINT32 sender)
{
- QByteArray buffer;
- QDataStream stream(buffer,IO_WriteOnly);
+ TQByteArray buffer;
+ TQDataStream stream(buffer,IO_WriteOnly);
stream << (Q_INT32) error;
stream.writeRawBytes(message.data(), message.size());
sendSystemMessage(stream,KGameMessage::IdError,receiver,sender);
@@ -458,9 +458,9 @@ void KGameNetwork::sendError(int error,const QByteArray& message, Q_UINT32 recei
// ----------------- receive messages from the network
-void KGameNetwork::receiveNetworkTransmission(const QByteArray& receiveBuffer, Q_UINT32 clientID)
+void KGameNetwork::receiveNetworkTransmission(const TQByteArray& receiveBuffer, Q_UINT32 clientID)
{
- QDataStream stream(receiveBuffer, IO_ReadOnly);
+ TQDataStream stream(receiveBuffer, IO_ReadOnly);
int msgid;
Q_UINT32 sender; // the id of the KGame/KPlayer who sent the message
Q_UINT32 receiver; // the id of the KGame/KPlayer the message is for
@@ -480,7 +480,7 @@ void KGameNetwork::receiveNetworkTransmission(const QByteArray& receiveBuffer, Q
}
else if (msgid==KGameMessage::IdError)
{
- QString text;
+ TQString text;
Q_INT32 error;
stream >> error;
kdDebug(11001) << k_funcinfo << "Got IdError " << error << endl;