KDEGames
kgameio.cpp
294 qCDebug(GAMES_PRIVATE_KGAME) << ": this=" << this << ", sizeof(this)=" << sizeof(KGameProcessIO);
313 connect(d->mProcessIO, &KMessageProcess::signalReceivedStderr, this, &KGameProcessIO::signalReceivedStderr);
381 void KGameProcessIO::sendSystemMessage(QDataStream &stream,int msgid, quint32 receiver, quint32 sender)
386 void KGameProcessIO::sendMessage(QDataStream &stream,int msgid, quint32 receiver, quint32 sender)
391 void KGameProcessIO::sendAllMessages(QDataStream &stream,int msgid, quint32 receiver, quint32 sender, bool usermsg)
395 qCDebug(GAMES_PRIVATE_KGAME) << "==============> KGameProcessIO::sendMessage (usermsg="<<usermsg<<")";
404 qCDebug(GAMES_PRIVATE_KGAME) << "=============* ProcessIO (" << msgid << "," << receiver << "," << sender << ") ===========";
414 qCDebug(GAMES_PRIVATE_KGAME) << " Adding user data from pos="<< device->pos() <<" amount=" << data.size() << "byte";
void removeEventFilter(QObject *obj)
void signalKeyEvent(KGameIO *io, QDataStream &stream, QKeyEvent *m, bool *eatevent)
Signal handler for keyboard events.
QByteArray & buffer()
void signalReaction()
This signal is emitted when your computer player is meant to do something, or better is meant to be a...
virtual void initIO(KPlayer *p)
Init this device by setting the player and e.g.
Definition: kgameio.cpp:80
void initIO(KPlayer *p) override
Init this device by setting the player and e.g.
Definition: kgameio.cpp:339
virtual void notifyTurn(bool b)
Notifies the IO device that the player's setTurn had been called Called by KPlayer.
Definition: kgameio.cpp:85
void sendMessage(QDataStream &stream, int msgid, quint32 receiver, quint32 sender)
Send a message to the process.
Definition: kgameio.cpp:386
void signalReceivedStderr(const QString &msg)
Text is received by the process on STDERR.
KeyPress
WriteOnly
bool eventFilter(QObject *o, QEvent *e) override
Internal method to process the events.
Definition: kgameio.cpp:157
QByteArray fromRawData(const char *data, int size)
virtual qint64 pos() const const override
Q_EMITQ_EMIT
void setAdvancePeriod(int ms)
Start a QTimer which calls advance every ms milli seconds.
Definition: kgameio.cpp:528
QIODevice * device() const const
QObject * sender() const const
void clear()
void setReactionPeriod(int advanceCalls)
The number of advance calls until the player (or rather: the IO) does something (default: 1).
Definition: kgameio.cpp:514
void signalProcessQuery(QDataStream &stream, KGameProcessIO *me)
A computer query message is received.
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
virtual bool eventFilter(QObject *watched, QEvent *event)
void notifyTurn(bool turn) override
Notifies the IO device that the player's setTurn had been called Called by KPlayer.
Definition: kgameio.cpp:361
Definition: kgameio.h:360
bool sendInput(QDataStream &stream, bool transmit=true, quint32 sender=0)
Send an input message using KPlayer::forwardInput.
Definition: kgameio.cpp:114
void installEventFilter(QObject *filterObj)
void timeout()
int writeRawData(const char *s, int len)
void setMouseTracking(bool b)
Manually activate or deactivate mouse tracking.
Definition: kgameio.cpp:226
void signalPrepareTurn(QDataStream &stream, bool turn, KGameIO *io, bool *send)
Signal generated when KPlayer::myTurn changes.
virtual qint64 size() const const override
bool removeGameIO(KGameIO *input=nullptr, bool deleteit=true)
remove (and delete) a game IO device
Definition: kplayer.cpp:271
KGameProcessIO(const QString &name)
Creates a computer player via a separate process.
Definition: kgameio.cpp:289
int userId() const
Returns the user defined id of the player This value can be used arbitrary by you to have some user i...
Definition: kplayer.cpp:153
void sendSystemMessage(QDataStream &stream, int msgid, quint32 receiver, quint32 sender)
Send a system message to the process.
Definition: kgameio.cpp:381
virtual bool forwardMessage(QDataStream &msg, int msgid, quint32 receiver=0, quint32 sender=0)
Forwards Message to the game object..internal use only.
Definition: kplayer.cpp:168
QEvent::Type type() const const
void receivedMessage(const QByteArray &receiveBuffer)
Internal message handler to receive data from the process.
Definition: kgameio.cpp:423
int size() const const
virtual void reaction()
Default implementation simply emits signalReaction.
Definition: kgameio.cpp:582
void signalIOAdded(KGameIO *game, QDataStream &stream, KPlayer *p, bool *send)
Signal generated when the computer player is added.
virtual bool forwardInput(QDataStream &msg, bool transmit=true, quint32 sender=0)
Forwards input to the game object..internal use only.
Definition: kplayer.cpp:182
KGameMouseIO(QWidget *parent, bool trackmouse=false)
Creates a mouse IO device.
Definition: kgameio.cpp:191
void sendAllMessages(QDataStream &stream, int msgid, quint32 receiver, quint32 sender, bool usermsg)
Internal combined function for all message handling.
Definition: kgameio.cpp:391
QObject * parent() const const
Q_D(Todo)
char * data()
void signalMouseEvent(KGameIO *io, QDataStream &stream, QMouseEvent *m, bool *eatevent)
Signal handler for mouse events.
KPlayer * player() const
This function returns the player who owns this IO.
Definition: kgameio.cpp:70
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu May 19 2022 04:04:39 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu May 19 2022 04:04:39 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.