summaryrefslogtreecommitdiffstats
path: root/libkdegames/kgame/kmessageio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkdegames/kgame/kmessageio.cpp')
-rw-r--r--libkdegames/kgame/kmessageio.cpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/libkdegames/kgame/kmessageio.cpp b/libkdegames/kgame/kmessageio.cpp
index f3353277..7057a621 100644
--- a/libkdegames/kgame/kmessageio.cpp
+++ b/libkdegames/kgame/kmessageio.cpp
@@ -22,15 +22,15 @@
*/
#include "kmessageio.h"
-#include <qsocket.h>
+#include <tqsocket.h>
#include <kdebug.h>
#include <kprocess.h>
-#include <qfile.h>
+#include <tqfile.h>
// ----------------------- KMessageIO -------------------------
-KMessageIO::KMessageIO (QObject *parent, const char *name)
- : QObject (parent, name), m_id (0)
+KMessageIO::KMessageIO (TQObject *parent, const char *name)
+ : TQObject (parent, name), m_id (0)
{}
KMessageIO::~KMessageIO ()
@@ -48,25 +48,25 @@ Q_UINT32 KMessageIO::id ()
// ----------------------KMessageSocket -----------------------
-KMessageSocket::KMessageSocket (QString host, Q_UINT16 port, QObject *parent,
+KMessageSocket::KMessageSocket (TQString host, Q_UINT16 port, TQObject *parent,
const char *name)
: KMessageIO (parent, name)
{
- mSocket = new QSocket ();
+ mSocket = new TQSocket ();
mSocket->connectToHost (host, port);
initSocket ();
}
-KMessageSocket::KMessageSocket (QHostAddress host, Q_UINT16 port, QObject
+KMessageSocket::KMessageSocket (TQHostAddress host, Q_UINT16 port, TQObject
*parent, const char *name)
: KMessageIO (parent, name)
{
- mSocket = new QSocket ();
+ mSocket = new TQSocket ();
mSocket->connectToHost (host.toString(), port);
initSocket ();
}
-KMessageSocket::KMessageSocket (QSocket *socket, QObject *parent, const char
+KMessageSocket::KMessageSocket (TQSocket *socket, TQObject *parent, const char
*name)
: KMessageIO (parent, name)
{
@@ -74,11 +74,11 @@ KMessageSocket::KMessageSocket (QSocket *socket, QObject *parent, const char
initSocket ();
}
-KMessageSocket::KMessageSocket (int socketFD, QObject *parent, const char
+KMessageSocket::KMessageSocket (int socketFD, TQObject *parent, const char
*name)
: KMessageIO (parent, name)
{
- mSocket = new QSocket ();
+ mSocket = new TQSocket ();
mSocket->setSocket (socketFD);
initSocket ();
}
@@ -90,12 +90,12 @@ KMessageSocket::~KMessageSocket ()
bool KMessageSocket::isConnected () const
{
- return mSocket->state() == QSocket::Connection;
+ return mSocket->state() == TQSocket::Connection;
}
-void KMessageSocket::send (const QByteArray &msg)
+void KMessageSocket::send (const TQByteArray &msg)
{
- QDataStream str (mSocket);
+ TQDataStream str (mSocket);
str << Q_UINT8 ('M'); // magic number for begin of message
str.writeBytes (msg.data(), msg.size()); // writes the length (as Q_UINT32) and the data
}
@@ -106,7 +106,7 @@ void KMessageSocket::processNewData ()
return;
isRecursive = true;
- QDataStream str (mSocket);
+ TQDataStream str (mSocket);
while (mSocket->bytesAvailable() > 0)
{
if (mAwaitingHeader)
@@ -141,7 +141,7 @@ void KMessageSocket::processNewData ()
return;
}
- QByteArray msg (mNextBlockLength);
+ TQByteArray msg (mNextBlockLength);
str.readRawBytes (msg.data(), mNextBlockLength);
// send the received message
@@ -157,9 +157,9 @@ void KMessageSocket::processNewData ()
void KMessageSocket::initSocket ()
{
- connect (mSocket, SIGNAL (error(int)), SIGNAL (connectionBroken()));
- connect (mSocket, SIGNAL (connectionClosed()), SIGNAL (connectionBroken()));
- connect (mSocket, SIGNAL (readyRead()), SLOT (processNewData()));
+ connect (mSocket, TQT_SIGNAL (error(int)), TQT_SIGNAL (connectionBroken()));
+ connect (mSocket, TQT_SIGNAL (connectionClosed()), TQT_SIGNAL (connectionBroken()));
+ connect (mSocket, TQT_SIGNAL (readyRead()), TQT_SLOT (processNewData()));
mAwaitingHeader = true;
mNextBlockLength = 0;
isRecursive = false;
@@ -170,14 +170,14 @@ Q_UINT16 KMessageSocket::peerPort () const
return mSocket->peerPort();
}
-QString KMessageSocket::peerName () const
+TQString KMessageSocket::peerName () const
{
return mSocket->peerName();
}
// ----------------------KMessageDirect -----------------------
-KMessageDirect::KMessageDirect (KMessageDirect *partner, QObject *parent,
+KMessageDirect::KMessageDirect (KMessageDirect *partner, TQObject *parent,
const char *name)
: KMessageIO (parent, name), mPartner (0)
{
@@ -213,7 +213,7 @@ bool KMessageDirect::isConnected () const
return mPartner != 0;
}
-void KMessageDirect::send (const QByteArray &msg)
+void KMessageDirect::send (const TQByteArray &msg)
{
if (mPartner)
emit mPartner->received (msg);
@@ -238,24 +238,24 @@ KMessageProcess::~KMessageProcess()
// Maybe todo: delete mSendBuffer
}
}
-KMessageProcess::KMessageProcess(QObject *parent, QString file) : KMessageIO(parent,0)
+KMessageProcess::KMessageProcess(TQObject *parent, TQString file) : KMessageIO(parent,0)
{
// Start process
kdDebug(11001) << "@@@KMessageProcess::Start process" << endl;
mProcessName=file;
mProcess=new KProcess;
int id=0;
- *mProcess << mProcessName << QString("%1").arg(id);
+ *mProcess << mProcessName << TQString("%1").arg(id);
kdDebug(11001) << "@@@KMessageProcess::Init:Id= " << id << endl;
kdDebug(11001) << "@@@KMessgeProcess::Init:Processname: " << mProcessName << endl;
- connect(mProcess, SIGNAL(receivedStdout(KProcess *, char *, int )),
- this, SLOT(slotReceivedStdout(KProcess *, char * , int )));
- connect(mProcess, SIGNAL(receivedStderr(KProcess *, char *, int )),
- this, SLOT(slotReceivedStderr(KProcess *, char * , int )));
- connect(mProcess, SIGNAL(processExited(KProcess *)),
- this, SLOT(slotProcessExited(KProcess *)));
- connect(mProcess, SIGNAL(wroteStdin(KProcess *)),
- this, SLOT(slotWroteStdin(KProcess *)));
+ connect(mProcess, TQT_SIGNAL(receivedStdout(KProcess *, char *, int )),
+ this, TQT_SLOT(slotReceivedStdout(KProcess *, char * , int )));
+ connect(mProcess, TQT_SIGNAL(receivedStderr(KProcess *, char *, int )),
+ this, TQT_SLOT(slotReceivedStderr(KProcess *, char * , int )));
+ connect(mProcess, TQT_SIGNAL(processExited(KProcess *)),
+ this, TQT_SLOT(slotProcessExited(KProcess *)));
+ connect(mProcess, TQT_SIGNAL(wroteStdin(KProcess *)),
+ this, TQT_SLOT(slotWroteStdin(KProcess *)));
mProcess->start(KProcess::NotifyOnExit,KProcess::All);
mSendBuffer=0;
mReceiveCount=0;
@@ -267,7 +267,7 @@ bool KMessageProcess::isConnected() const
if (!mProcess) return false;
return mProcess->isRunning();
}
-void KMessageProcess::send(const QByteArray &msg)
+void KMessageProcess::send(const TQByteArray &msg)
{
kdDebug(11001) << "@@@KMessageProcess:: SEND("<<msg.size()<<") to process" << endl;
unsigned int size=msg.size()+2*sizeof(long);
@@ -280,7 +280,7 @@ void KMessageProcess::send(const QByteArray &msg)
*p1=0x4242aeae;
*p2=size;
- QByteArray *buffer=new QByteArray();
+ TQByteArray *buffer=new TQByteArray();
buffer->assign(tmpbuffer,size);
// buffer->duplicate(msg);
mQueue.enqueue(buffer);
@@ -330,9 +330,9 @@ void KMessageProcess::slotReceivedStderr(KProcess * proc, char *buffer, int bufl
if (!p) len=buflen;
else len=p-pos;
- QByteArray a;
+ TQByteArray a;
a.setRawData(pos,len);
- QString s(a);
+ TQString s(a);
kdDebug(11001) << "PID" <<pid<< ":" << s << endl;
a.resetRawData(pos,len);
if (p) pos=p+1;
@@ -371,7 +371,7 @@ void KMessageProcess::slotReceivedStdout(KProcess * , char *buffer, int buflen)
{
kdDebug(11001) << k_funcinfo << ": Got message with len " << len << endl;
- QByteArray msg;
+ TQByteArray msg;
// msg.setRawData(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long));
msg.duplicate(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long));
emit received(msg);
@@ -397,7 +397,7 @@ void KMessageProcess::slotProcessExited(KProcess * /*p*/)
// ----------------------- KMessageFilePipe ---------------------------
-KMessageFilePipe::KMessageFilePipe(QObject *parent,QFile *readfile,QFile *writefile) : KMessageIO(parent,0)
+KMessageFilePipe::KMessageFilePipe(TQObject *parent,TQFile *readfile,TQFile *writefile) : KMessageIO(parent,0)
{
mReadFile=readfile;
mWriteFile=writefile;
@@ -414,7 +414,7 @@ bool KMessageFilePipe::isConnected () const
return (mReadFile!=0)&&(mWriteFile!=0);
}
-void KMessageFilePipe::send(const QByteArray &msg)
+void KMessageFilePipe::send(const TQByteArray &msg)
{
unsigned int size=msg.size()+2*sizeof(long);
@@ -425,7 +425,7 @@ void KMessageFilePipe::send(const QByteArray &msg)
*p1=0x4242aeae;
*p2=size;
- QByteArray buffer;
+ TQByteArray buffer;
buffer.assign(tmpbuffer,size);
mWriteFile->writeBlock(buffer);
mWriteFile->flush();
@@ -464,7 +464,7 @@ void KMessageFilePipe::exec()
{
//fprintf(stderr,"KMessageFilePipe::exec:: Got Message with len %d\n",len);
- QByteArray msg;
+ TQByteArray msg;
//msg.setRawData(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long));
msg.duplicate(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long));
emit received(msg);