KGameChat Class Reference
A Chat widget for KGame-based games. More...
#include <kgamechat.h>
Inheritance diagram for KGameChat:

Public Types | |
enum | SendingIds { SendToGroup = 1 } |
Public Slots | |
virtual void | addMessage (const QString &fromName, const QString &text) |
virtual void | addMessage (int fromId, const QString &text) |
void | slotReceiveMessage (int, const QByteArray &, Q_UINT32 receiver, Q_UINT32 sender) |
Public Member Functions | |
KGameChat (KGame *game, int msgid, KPlayer *fromPlayer, QWidget *parent) | |
KGameChat (KGame *game, int msgId, QWidget *parent) | |
KGameChat (QWidget *parent) | |
void | setFromPlayer (KPlayer *player) |
KPlayer * | fromPlayer () const |
void | setKGame (KGame *g) |
KGame * | game () const |
int | messageId () const |
void | setMessageId (int msgid) |
virtual const QString & | fromName () const |
Protected Slots | |
void | slotUnsetKGame () |
void | slotPropertyChanged (KGamePropertyBase *, KPlayer *) |
void | slotAddPlayer (KPlayer *) |
void | slotRemovePlayer (KPlayer *) |
void | slotReceivePrivateMessage (int msgid, const QByteArray &buffer, Q_UINT32 sender, KPlayer *me) |
Protected Member Functions | |
bool | isSendToAllMessage (int id) const |
bool | isToGroupMessage (int id) const |
bool | isToPlayerMessage (int id) const |
int | playerId (int id) const |
int | sendingId (int playerId) const |
bool | hasPlayer (int id) const |
virtual QString | sendToPlayerEntry (const QString &name) const |
virtual void | returnPressed (const QString &text) |
Detailed Description
A Chat widget for KGame-based games.Call setFromPlayer() first - this will be used as the "from" part of every message you will send. Otherwise it won't work! You can also use the fromPlayer parameter in the constructor though...
- Author:
- Andreas Beckermann <b_mann@gmx.de>
Definition at line 43 of file kgamechat.h.
Constructor & Destructor Documentation
|
Construct a KGame chat widget on
The Definition at line 65 of file kgamechat.cpp. References setFromPlayer(). |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. To make use of this widget you need to call setFromPlayer manually. Definition at line 60 of file kgamechat.cpp. |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This constructs a widget that is not usable. You must call at least setGame, setFromPlayer and setMessageId manually.
Definition at line 71 of file kgamechat.cpp. |
Member Function Documentation
|
This sets the fromPlayer to The fromPlayer is the player that will appear as "from" when you send messages through this widget.
Definition at line 198 of file kgamechat.cpp. References KChatBase::addSendingEntry(), KChatBase::changeSendingEntry(), KPlayer::group(), KChatBase::nextId(), and KChatBase::removeSendingEntry(). Referenced by KGameChat(). |
|
Set the KGame object for this chat widget. All messages will be sent through this object. You don't have to implement any send functions, just call this function, call setFromPlayer and be done :-)
Definition at line 221 of file kgamechat.cpp. References QPtrList::at(), QPtrList::count(), and slotUnsetKGame(). |
|
Definition at line 154 of file kgamechat.cpp. Referenced by returnPressed(). |
|
Change the message id of the chat widget. It is recommended that you don't use this but prefer the constructor instead, but in certain situations (such as using this widget in Qt designer) it may be useful to change the message id. See also messageId
Definition at line 151 of file kgamechat.cpp. |
|
reimplemented from KChatBase
Implements KChatBase. Definition at line 190 of file kgamechat.cpp. |
|
Add a text in the listbox. See also signalSendMessage() Maybe you want to replace this with a function that creates a nicer text than "fromName: text" Update: the function layoutMessage is called by this now. This means that you will get user defined outlook on the messages :-)
Reimplemented from KChatBase. Definition at line 121 of file kgamechat.h. References KChatBase::addMessage(). |
|
Definition at line 157 of file kgamechat.cpp. Referenced by returnPressed(). |
|
Used to indicate whether a message shall be sent to a group of players. Note that this was not yet implemented when this doc was written so this description might be wrong. (FIXME)
Definition at line 160 of file kgamechat.cpp. Referenced by returnPressed(). |
|
Used to indicate whether the message shall be sent to a single player only. Note that you can also call isSendToAllMessage and isToGroupMessage - if both return false it must be a player message. This behaviour might be changed later - so don't depend on it. See also toPlayerId
Definition at line 163 of file kgamechat.cpp. Referenced by playerId(), and returnPressed(). |
|
Definition at line 170 of file kgamechat.cpp. References isToPlayerMessage(). Referenced by returnPressed(). |
|
Definition at line 179 of file kgamechat.cpp. Referenced by hasPlayer(). |
|
Definition at line 193 of file kgamechat.cpp. References sendingId(). |
|
Definition at line 167 of file kgamechat.cpp. References QString::arg(). |
|
Unsets a KGame object that has been set using setKGame before. You don't have to call this - this is usually done automatically. Definition at line 255 of file kgamechat.cpp. References KChatBase::removeSendingEntry(). Referenced by setKGame(). |
|
Called when KPlayer::signalNetworkData is emitted.
The message gets forwarded to slotReceiveMessage if Definition at line 320 of file kgamechat.cpp. References KPlayer::id(). |
|
This is called whenever the user pushed return ie wants to send a message. Note that you MUST add the message to the widget when this function is called as it has already been added to the KCompletion object of the KLineEdit widget! Must be implemented in derived classes
Implements KChatBase. Definition at line 108 of file kgamechat.cpp. References isSendToAllMessage(), isToGroupMessage(), isToPlayerMessage(), messageId(), playerId(), and KChatBase::sendingEntry(). |
The documentation for this class was generated from the following files: