• 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
kgamechat.h
Go to the documentation of this file.
1 /*
2  This file is part of the KDE games library
3  Copyright (C) 2001-2002 Andreas Beckermann (b_mann@gmx.de)
4  Copyright (C) 2001 Martin Heni (kde at heni-online.de)
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef __KGAMECHAT_H__
22 #define __KGAMECHAT_H__
23 
24 #include <QtCore/QString>
25 
26 #include "../kchatbase.h"
27 #include "../libkdegamesprivate_export.h"
28 class KPlayer;
29 class KGame;
30 class KGamePropertyBase;
31 
32 class KGameChatPrivate;
33 
45 class KDEGAMESPRIVATE_EXPORT KGameChat : public KChatBase
46 {
47  Q_OBJECT
48 public:
54  KGameChat(KGame* game, int msgid, KPlayer* fromPlayer, QWidget * parent, KChatBaseModel* model=0, KChatBaseItemDelegate* delegate=0);
55 
61  KGameChat(KGame* game, int msgId, QWidget* parent, KChatBaseModel* model=0, KChatBaseItemDelegate* delegate=0);
62 
68  explicit KGameChat(QWidget* parent);
69 
70  virtual ~KGameChat();
71 
72  enum SendingIds {
73  SendToGroup = 1
74  };
75 
82  void setFromPlayer(KPlayer* player);
83 
84  KPlayer* fromPlayer() const;
85 
93  void setKGame(KGame* g);
94 
95  KGame* game() const;
96 
101  int messageId() const;
102 
111  void setMessageId(int msgid);
112 
117  virtual QString fromName() const;
118 
119 
120 public Q_SLOTS:
121  virtual void addMessage(const QString& fromName, const QString& text) { KChatBase::addMessage(fromName, text);}
122  virtual void addMessage(int fromId, const QString& text);
123 
124  void slotReceiveMessage(int, const QByteArray&, quint32 receiver, quint32 sender);
125 
126 protected:
132  bool isSendToAllMessage(int id) const;
133 
143  bool isToGroupMessage(int id) const;
144 
145 
158  bool isToPlayerMessage(int id) const;
159 
169  int playerId(int id) const;
170 
176  int sendingId(int playerId) const;
177 
182  bool hasPlayer(int id) const;
183 
190  virtual QString sendToPlayerEntry(const QString& name) const;
191 
192 
193 protected Q_SLOTS:
199  void slotUnsetKGame();
200 
201 
202  void slotPropertyChanged(KGamePropertyBase*, KPlayer*);
203  void slotAddPlayer(KPlayer*);
204  void slotRemovePlayer(KPlayer*);
205 
211  void slotReceivePrivateMessage(int msgid, const QByteArray& buffer, quint32 sender, KPlayer* me);
212 
213 protected:
214  virtual void returnPressed(const QString& text);
215 
216 private:
217  void init(KGame* g, int msgid);
218 
219 private:
220  KGameChatPrivate* const d;
221 };
222 
223 #endif
QWidget
KGameChat::addMessage
virtual void addMessage(const QString &fromName, const QString &text)
Definition: kgamechat.h:121
QByteArray
KChatBase
KGameChat::SendingIds
SendingIds
Definition: kgamechat.h:72
QString
KPlayer
Base class for a game player.
Definition: kplayer.h:69
KGamePropertyBase
Base class of KGameProperty.
Definition: kgameproperty.h:45
KGame
The main KDE game object.
Definition: kgame.h:60
KGameChat
A Chat widget for KGame-based games.
Definition: kgamechat.h:45
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