From 576eb4299a00bc053db35414406f46372a0f70f2 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:42:31 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libkdegames/kgame/kmessageio.cpp | 82 ++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'libkdegames/kgame/kmessageio.cpp') 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 +#include #include #include -#include +#include // ----------------------- 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("<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" <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); -- cgit v1.2.1