• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libkdegames/kgame

kmessageclient.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE games library
00003     Copyright (C) 2001 Burkhard Lehner (Burkhard.Lehner@gmx.de)
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License version 2 as published by the Free Software Foundation.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __KMESSAGECLIENT_H__
00021 #define __KMESSAGECLIENT_H__
00022 
00023 #include <QtCore/QObject>
00024 #include <QtCore/QString>
00025 
00026 #include <libkdegames_export.h>
00027 class KMessageIO;
00028 class KMessageServer;
00029 class KMessageClientPrivate;
00030 
00052 class KDEGAMES_EXPORT KMessageClient : public QObject
00053 {
00054   Q_OBJECT
00055 
00056 public:
00057 
00063   KMessageClient (QObject *parent = 0);
00064 
00069   ~KMessageClient ();
00070 
00078   quint32 id () const;
00079 
00090   bool isAdmin () const;
00091 
00095   quint32 adminId() const;
00096 
00100   QList <quint32> clientList() const;
00101 
00113   void setServer (const QString &host, quint16 port);
00114 
00124   void setServer (KMessageServer *server);
00125 
00129   void disconnect();
00130 
00152   virtual void setServer (KMessageIO *connection);
00153 
00160   bool isConnected () const;
00161 
00166   bool isNetwork () const;
00167 
00172   quint16 peerPort () const;
00173 
00178   QString peerName() const;
00179 
00191   void sendServerMessage (const QByteArray &msg);
00192 
00201   //AB: processBroadcast doesn't exist!! is processIncomingMessage meant?
00202   void sendBroadcast (const QByteArray &msg);
00203 
00220   //AB: processForward doesn't exist!! is processIncomingMessage meant?
00221   void sendForward (const QByteArray &msg, const QList <quint32> &clients);
00222 
00233   void sendForward (const QByteArray &msg, quint32 client);
00234 
00242   void lock();
00243 
00248   void unlock();
00249 
00253   unsigned int delayedMessageCount() const;
00254 
00255 Q_SIGNALS:
00276   void broadcastReceived (const QByteArray &msg, quint32 senderID);
00277 
00306   void forwardReceived (const QByteArray &msg, quint32 senderID, const QList <quint32> &receivers);
00307 
00317   void connectionBroken ();
00318 
00323   void aboutToDisconnect(quint32 id);
00324 
00331   void adminStatusChanged (bool isAdmin);
00332 
00339   void eventClientConnected (quint32 clientID);
00340 
00348   void eventClientDisconnected (quint32 clientID, bool broken);
00349 
00360   //AB: maybe add a setNoEmit() so that the other signals can be deactivated?
00361   //Could be a performance benefit (note: KMessageClient is a time critical
00362   //class!!!)
00363   void serverMessageReceived (const QByteArray &msg, bool &unknown);
00364 
00365 protected:
00383   virtual void processMessage (const QByteArray& msg);
00384 
00385 protected Q_SLOTS:
00401   virtual void processIncomingMessage (const QByteArray &msg);
00402 
00407   void processFirstMessage();
00408 
00415   virtual void removeBrokenConnection ();
00416   void removeBrokenConnection2 ();
00417 
00418 private:
00419   KMessageClientPrivate * const d;
00420 };
00421 
00422 #endif

libkdegames/kgame

Skip menu "libkdegames/kgame"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal