diff options
Diffstat (limited to 'libkdegames/kgame/kgameio.cpp')
-rw-r--r-- | libkdegames/kgame/kgameio.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/libkdegames/kgame/kgameio.cpp b/libkdegames/kgame/kgameio.cpp index 9b3a55e8..7183d5d3 100644 --- a/libkdegames/kgame/kgameio.cpp +++ b/libkdegames/kgame/kgameio.cpp @@ -30,20 +30,20 @@ #include <kdebug.h> -#include <qwidget.h> -#include <qbuffer.h> -#include <qtimer.h> +#include <tqwidget.h> +#include <tqbuffer.h> +#include <tqtimer.h> #include <stdlib.h> // ----------------------- Generic IO ------------------------- -KGameIO::KGameIO() : QObject(0,0) +KGameIO::KGameIO() : TQObject(0,0) { kdDebug(11001) << k_funcinfo << ": this=" << this << ", sizeof(this)" << sizeof(KGameIO) << endl; mPlayer = 0; } -KGameIO::KGameIO(KPlayer* player) : QObject(0,0) +KGameIO::KGameIO(KPlayer* player) : TQObject(0,0) { kdDebug(11001) << k_funcinfo << ": this=" << this << ", sizeof(this)" << sizeof(KGameIO) << endl; mPlayer = 0; @@ -76,12 +76,12 @@ void KGameIO::notifyTurn(bool b) return; } bool sendit=false; - QByteArray buffer; - QDataStream stream(buffer, IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer, IO_WriteOnly); emit signalPrepareTurn(stream, b, this, &sendit); if (sendit) { - QDataStream ostream(buffer,IO_ReadOnly); + TQDataStream ostream(buffer,IO_ReadOnly); Q_UINT32 sender = player()->id(); // force correct sender kdDebug(11001) << "Prepare turn sendInput" << endl; sendInput(ostream, true, sender); @@ -97,7 +97,7 @@ KGame* KGameIO::game() const return player()->game(); } -bool KGameIO::sendInput(QDataStream& s, bool transmit, Q_UINT32 sender) +bool KGameIO::sendInput(TQDataStream& s, bool transmit, Q_UINT32 sender) { if (!player()) { @@ -117,7 +117,7 @@ void KGameIO::Debug() // ----------------------- Key IO --------------------------- -KGameKeyIO::KGameKeyIO(QWidget *parent) +KGameKeyIO::KGameKeyIO(TQWidget *parent) : KGameIO() { if (parent) @@ -137,7 +137,7 @@ KGameKeyIO::~KGameKeyIO() int KGameKeyIO::rtti() const { return KeyIO; } -bool KGameKeyIO::eventFilter( QObject *o, QEvent *e ) +bool KGameKeyIO::eventFilter( TQObject *o, TQEvent *e ) { if (!player()) { @@ -145,16 +145,16 @@ bool KGameKeyIO::eventFilter( QObject *o, QEvent *e ) } // key press/release - if ( e->type() == QEvent::KeyPress || - e->type() == QEvent::KeyRelease ) + if ( e->type() == TQEvent::KeyPress || + e->type() == TQEvent::KeyRelease ) { - QKeyEvent *k = (QKeyEvent*)e; + TQKeyEvent *k = (TQKeyEvent*)e; // kdDebug(11001) << "KGameKeyIO " << this << " key press/release " << k->key() << endl ; - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); bool eatevent=false; emit signalKeyEvent(this,stream,k,&eatevent); - QDataStream msg(buffer,IO_ReadOnly); + TQDataStream msg(buffer,IO_ReadOnly); if (eatevent && sendInput(msg)) { @@ -162,12 +162,12 @@ bool KGameKeyIO::eventFilter( QObject *o, QEvent *e ) } return false; // do not eat otherwise } - return QObject::eventFilter( o, e ); // standard event processing + return TQObject::eventFilter( o, e ); // standard event processing } // ----------------------- Mouse IO --------------------------- -KGameMouseIO::KGameMouseIO(QWidget *parent,bool trackmouse) +KGameMouseIO::KGameMouseIO(TQWidget *parent,bool trackmouse) : KGameIO() { if (parent) @@ -195,11 +195,11 @@ void KGameMouseIO::setMouseTracking(bool b) { if (parent()) { - ((QWidget*)parent())->setMouseTracking(b); + ((TQWidget*)parent())->setMouseTracking(b); } } -bool KGameMouseIO::eventFilter( QObject *o, QEvent *e ) +bool KGameMouseIO::eventFilter( TQObject *o, TQEvent *e ) { if (!player()) { @@ -208,28 +208,28 @@ bool KGameMouseIO::eventFilter( QObject *o, QEvent *e ) // kdDebug(11001) << "KGameMouseIO " << this << endl ; // mouse action - if ( e->type() == QEvent::MouseButtonPress || - e->type() == QEvent::MouseButtonRelease || - e->type() == QEvent::MouseButtonDblClick || - e->type() == QEvent::Wheel || - e->type() == QEvent::MouseMove + if ( e->type() == TQEvent::MouseButtonPress || + e->type() == TQEvent::MouseButtonRelease || + e->type() == TQEvent::MouseButtonDblClick || + e->type() == TQEvent::Wheel || + e->type() == TQEvent::MouseMove ) { - QMouseEvent *k = (QMouseEvent*)e; + TQMouseEvent *k = (TQMouseEvent*)e; // kdDebug(11001) << "KGameMouseIO " << this << endl ; - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); bool eatevent=false; emit signalMouseEvent(this,stream,k,&eatevent); // kdDebug(11001) << "################# eatevent=" << eatevent << endl; - QDataStream msg(buffer,IO_ReadOnly); + TQDataStream msg(buffer,IO_ReadOnly); if (eatevent && sendInput(msg)) { return eatevent; } return false; // do not eat otherwise } - return QObject::eventFilter( o, e ); // standard event processing + return TQObject::eventFilter( o, e ); // standard event processing } @@ -249,7 +249,7 @@ public: }; // ----------------------- Process IO --------------------------- -KGameProcessIO::KGameProcessIO(const QString& name) +KGameProcessIO::KGameProcessIO(const TQString& name) : KGameIO() { kdDebug(11001) << k_funcinfo << ": this=" << this << ", sizeof(this)=" << sizeof(KGameProcessIO) << endl; @@ -266,12 +266,12 @@ KGameProcessIO::KGameProcessIO(const QString& name) //kdDebug(11001) << "================= KMEssage SetSErver ==================== " << endl; //d->mMessageClient->setServer(d->mMessageServer); kdDebug(11001) << "================= KMEssage: Connect ==================== " << endl; - //connect(d->mMessageClient, SIGNAL(broadcastReceived(const QByteArray&, Q_UINT32)), - // this, SLOT(clientMessage(const QByteArray&, Q_UINT32))); - //connect(d->mMessageClient, SIGNAL(forwardReceived(const QByteArray&, Q_UINT32, const QValueList <Q_UINT32> &)), - // this, SLOT(clientMessage(const QByteArray&, Q_UINT32, const QValueList <Q_UINT32> &))); - connect(d->mProcessIO, SIGNAL(received(const QByteArray&)), - this, SLOT(receivedMessage(const QByteArray&))); + //connect(d->mMessageClient, TQT_SIGNAL(broadcastReceived(const TQByteArray&, Q_UINT32)), + // this, TQT_SLOT(clientMessage(const TQByteArray&, Q_UINT32))); + //connect(d->mMessageClient, TQT_SIGNAL(forwardReceived(const TQByteArray&, Q_UINT32, const TQValueList <Q_UINT32> &)), + // this, TQT_SLOT(clientMessage(const TQByteArray&, Q_UINT32, const TQValueList <Q_UINT32> &))); + connect(d->mProcessIO, TQT_SIGNAL(received(const TQByteArray&)), + this, TQT_SLOT(receivedMessage(const TQByteArray&))); //kdDebug(11001) << "Our client is id="<<d->mMessageClient->id() << endl; } @@ -300,8 +300,8 @@ void KGameProcessIO::initIO(KPlayer *p) { KGameIO::initIO(p); // Send 'hello' to process - QByteArray buffer; - QDataStream stream(buffer, IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer, IO_WriteOnly); Q_INT16 id = p->userId(); stream << id; @@ -326,8 +326,8 @@ void KGameProcessIO::notifyTurn(bool b) return; } bool sendit=true; - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); stream << (Q_INT8)b; emit signalPrepareTurn(stream,b,this,&sendit); if (sendit) @@ -338,17 +338,17 @@ void KGameProcessIO::notifyTurn(bool b) } } -void KGameProcessIO::sendSystemMessage(QDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender) +void KGameProcessIO::sendSystemMessage(TQDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender) { sendAllMessages(stream, msgid, receiver, sender, false); } -void KGameProcessIO::sendMessage(QDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender) +void KGameProcessIO::sendMessage(TQDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender) { sendAllMessages(stream, msgid, receiver, sender, true); } -void KGameProcessIO::sendAllMessages(QDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender, bool usermsg) +void KGameProcessIO::sendAllMessages(TQDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender, bool usermsg) { kdDebug(11001) << "==============> KGameProcessIO::sendMessage (usermsg="<<usermsg<<")" << endl; // if (!player()) return ; @@ -361,10 +361,10 @@ void KGameProcessIO::sendAllMessages(QDataStream &stream,int msgid, Q_UINT32 rec kdDebug(11001) << "=============* ProcessIO (" << msgid << "," << receiver << "," << sender << ") ===========" << endl; - QByteArray buffer; - QDataStream ostream(buffer,IO_WriteOnly); - QBuffer *device=(QBuffer *)stream.device(); - QByteArray data=device->buffer();; + TQByteArray buffer; + TQDataStream ostream(buffer,IO_WriteOnly); + TQBuffer *device=(TQBuffer *)stream.device(); + TQByteArray data=device->buffer();; KGameMessage::createHeader(ostream,sender,receiver,msgid); // ostream.writeRawBytes(data.data()+device->at(),data.size()-device->at()); @@ -377,10 +377,10 @@ void KGameProcessIO::sendAllMessages(QDataStream &stream,int msgid, Q_UINT32 rec } } -//void KGameProcessIO::clientMessage(const QByteArray& receiveBuffer, Q_UINT32 clientID, const QValueList <Q_UINT32> &recv) -void KGameProcessIO::receivedMessage(const QByteArray& receiveBuffer) +//void KGameProcessIO::clientMessage(const TQByteArray& receiveBuffer, Q_UINT32 clientID, const TQValueList <Q_UINT32> &recv) +void KGameProcessIO::receivedMessage(const TQByteArray& receiveBuffer) { - QDataStream stream(receiveBuffer,IO_ReadOnly); + TQDataStream stream(receiveBuffer,IO_ReadOnly); int msgid; Q_UINT32 sender; Q_UINT32 receiver; @@ -391,10 +391,10 @@ void KGameProcessIO::receivedMessage(const QByteArray& receiveBuffer) // Cut out the header part...to not confuse network code - QBuffer *buf=(QBuffer *)stream.device(); - QByteArray newbuffer; + TQBuffer *buf=(TQBuffer *)stream.device(); + TQByteArray newbuffer; newbuffer.setRawData(buf->buffer().data()+buf->at(),buf->size()-buf->at()); - QDataStream ostream(newbuffer,IO_ReadOnly); + TQDataStream ostream(newbuffer,IO_ReadOnly); kdDebug(11001) << "Newbuffer size=" << newbuffer.size() << endl; @@ -443,7 +443,7 @@ public: int mPauseCounter; - QTimer* mAdvanceTimer; + TQTimer* mAdvanceTimer; }; KGameComputerIO::KGameComputerIO() : KGameIO() @@ -488,8 +488,8 @@ int KGameComputerIO::reactionPeriod() const void KGameComputerIO::setAdvancePeriod(int ms) { stopAdvancePeriod(); - d->mAdvanceTimer = new QTimer(this); - connect(d->mAdvanceTimer, SIGNAL(timeout()), this, SLOT(advance())); + d->mAdvanceTimer = new TQTimer(this); + connect(d->mAdvanceTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(advance())); d->mAdvanceTimer->start(ms); } |