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

libkdegames/kgame

kgamechat.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE games library
00003     Copyright (C) 2001-2002 Andreas Beckermann (b_mann@gmx.de)
00004     Copyright (C) 2001 Martin Heni (kde at heni-online.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 #ifndef __KGAMECHAT_H__
00022 #define __KGAMECHAT_H__
00023 
00024 #include <QtCore/QString>
00025 
00026 #include "kchatbase.h"
00027 #include <libkdegames_export.h>
00028 class KPlayer;
00029 class KGame;
00030 class KGamePropertyBase;
00031 
00032 class KGameChatPrivate;
00033 
00045 class KDEGAMES_EXPORT KGameChat : public KChatBase
00046 {
00047     Q_OBJECT
00048 public:
00054     KGameChat(KGame* game, int msgid, KPlayer* fromPlayer, QWidget * parent, KChatBaseModel* model=0, KChatBaseItemDelegate* delegate=0);
00055 
00061     KGameChat(KGame* game, int msgId, QWidget* parent, KChatBaseModel* model=0, KChatBaseItemDelegate* delegate=0);
00062 
00068     explicit KGameChat(QWidget* parent);
00069 
00070     virtual ~KGameChat();
00071 
00072     enum SendingIds {
00073         SendToGroup = 1
00074     };
00075 
00082     void setFromPlayer(KPlayer* player);
00083 
00084     KPlayer* fromPlayer() const;
00085 
00093     void setKGame(KGame* g);
00094 
00095     KGame* game() const;
00096 
00101     int messageId() const;
00102 
00111     void setMessageId(int msgid);
00112 
00117     virtual QString fromName() const;
00118 
00119 
00120 public Q_SLOTS:
00121     virtual void addMessage(const QString& fromName, const QString& text) { KChatBase::addMessage(fromName, text);}
00122     virtual void addMessage(int fromId, const QString& text);
00123 
00124     void slotReceiveMessage(int, const QByteArray&, quint32 receiver, quint32 sender);
00125 
00126 protected:
00132     bool isSendToAllMessage(int id) const;
00133 
00143     bool isToGroupMessage(int id) const;
00144     
00145 
00158     bool isToPlayerMessage(int id) const;
00159 
00169     int playerId(int id) const;
00170 
00176     int sendingId(int playerId) const;
00177 
00182     bool hasPlayer(int id) const;
00183 
00190     virtual QString sendToPlayerEntry(const QString& name) const;
00191 
00192 
00193 protected Q_SLOTS:
00199     void slotUnsetKGame();
00200 
00201 
00202     void slotPropertyChanged(KGamePropertyBase*, KPlayer*);
00203     void slotAddPlayer(KPlayer*);
00204     void slotRemovePlayer(KPlayer*);
00205 
00211     void slotReceivePrivateMessage(int msgid, const QByteArray& buffer, quint32 sender, KPlayer* me);
00212 
00213 protected:
00214     virtual void returnPressed(const QString& text);
00215 
00216 private:
00217     void init(KGame* g, int msgid);
00218 
00219 private:
00220     KGameChatPrivate* const d;
00221 };
00222 
00223 #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