kgameprocess.h

00001 /*
00002     This file is part of the KDE games library
00003     Copyright (C) 2001 Martin Heni (martin@heni-online.de)
00004     Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License version 2 as published by the Free Software Foundation.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 /*
00021     $Id: kgameprocess.h 465369 2005-09-29 14:33:08Z mueller $
00022 */
00023 #ifndef __KGAMEPROCESS_H_
00024 #define __KGAMEPROCESS_H_
00025 
00026 #include <qstring.h>
00027 #include <qobject.h>
00028 #include <qfile.h>
00029 
00030 #include "kgameproperty.h"
00031 #include <krandomsequence.h>
00032 #include <kdemacros.h>
00033 class KPlayer;
00034 class KMessageFilePipe;
00035 
00042 class KDE_EXPORT KGameProcess:  public QObject
00043 {
00044   Q_OBJECT
00045 
00046   public:
00073     KGameProcess();
00077     ~KGameProcess();
00078 
00083     bool exec(int argc, char *argv[]);
00084 
00091     bool terminate() const {return mTerminate;}
00092 
00099     void setTerminate(bool b) {mTerminate=b;}
00100 
00110     void sendMessage(QDataStream &stream,int msgid,Q_UINT32 receiver=0);
00111 
00131     void sendSystemMessage(QDataStream &stream,int msgid,Q_UINT32 receiver=0);
00132 
00142     KRandomSequence *random() {return mRandom;}
00143 
00144   protected:
00149     void processArgs(int argc, char *argv[]);
00150 
00151   protected slots:
00156       void receivedMessage(const QByteArray& receiveBuffer);
00157 
00158   signals:
00180      void signalCommand(QDataStream &inputStream,int msgid,int receiver,int sender);
00181 
00219      void signalTurn(QDataStream &stream,bool turn);
00220 
00232      void signalInit(QDataStream &stream,int userid);
00233 
00234   protected:
00235     bool mTerminate;
00236     KMessageFilePipe *mMessageIO;
00237   private:
00238     QFile rFile;
00239     QFile wFile;
00240     KRandomSequence* mRandom;
00241 };
00242 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys