• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

libkdegames/libkdegamesprivate/kgame

  • sources
  • kde-4.14
  • kdegames
  • libkdegames
  • libkdegamesprivate
  • kgame
kmessageclient.h
Go to the documentation of this file.
1 /*
2  This file is part of the KDE games library
3  Copyright (C) 2001 Burkhard Lehner (Burkhard.Lehner@gmx.de)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef __KMESSAGECLIENT_H__
21 #define __KMESSAGECLIENT_H__
22 
23 #include <QtCore/QObject>
24 #include <QtCore/QString>
25 
26 #include "../libkdegamesprivate_export.h"
27 class KMessageIO;
28 class KMessageServer;
29 class KMessageClientPrivate;
30 
52 class KDEGAMESPRIVATE_EXPORT KMessageClient : public QObject
53 {
54  Q_OBJECT
55 
56 public:
57 
63  KMessageClient (QObject *parent = 0);
64 
69  ~KMessageClient ();
70 
78  quint32 id () const;
79 
90  bool isAdmin () const;
91 
95  quint32 adminId() const;
96 
100  QList <quint32> clientList() const;
101 
113  void setServer (const QString &host, quint16 port);
114 
124  void setServer (KMessageServer *server);
125 
129  void disconnect();
130 
152  virtual void setServer (KMessageIO *connection);
153 
160  bool isConnected () const;
161 
166  bool isNetwork () const;
167 
172  quint16 peerPort () const;
173 
178  QString peerName() const;
179 
191  void sendServerMessage (const QByteArray &msg);
192 
201  //AB: processBroadcast doesn't exist!! is processIncomingMessage meant?
202  void sendBroadcast (const QByteArray &msg);
203 
220  //AB: processForward doesn't exist!! is processIncomingMessage meant?
221  void sendForward (const QByteArray &msg, const QList <quint32> &clients);
222 
233  void sendForward (const QByteArray &msg, quint32 client);
234 
242  void lock();
243 
248  void unlock();
249 
253  unsigned int delayedMessageCount() const;
254 
255 Q_SIGNALS:
276  void broadcastReceived (const QByteArray &msg, quint32 senderID);
277 
306  void forwardReceived (const QByteArray &msg, quint32 senderID, const QList <quint32> &receivers);
307 
317  void connectionBroken ();
318 
323  void aboutToDisconnect(quint32 id);
324 
331  void adminStatusChanged (bool isAdmin);
332 
339  void eventClientConnected (quint32 clientID);
340 
348  void eventClientDisconnected (quint32 clientID, bool broken);
349 
360  //AB: maybe add a setNoEmit() so that the other signals can be deactivated?
361  //Could be a performance benefit (note: KMessageClient is a time critical
362  //class!!!)
363  void serverMessageReceived (const QByteArray &msg, bool &unknown);
364 
365 protected:
383  virtual void processMessage (const QByteArray& msg);
384 
385 protected Q_SLOTS:
401  virtual void processIncomingMessage (const QByteArray &msg);
402 
407  void processFirstMessage();
408 
415  virtual void removeBrokenConnection ();
416  void removeBrokenConnection2 ();
417 
418 private:
419  KMessageClientPrivate * const d;
420 };
421 
422 #endif
QByteArray
QObject::disconnect
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
KMessageClient
A client to connect to a KMessageServer.
Definition: kmessageclient.h:52
QObject
KMessageIO
This abstract base class represents one end of a message connections between two clients.
Definition: kmessageio.h:57
KMessageServer
A server for message sending and broadcasting, using TCP/IP connections.
Definition: kmessageserver.h:175
QString
QList< quint32 >
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:54 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdegames/libkdegamesprivate/kgame

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

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal