KDEGames
kgamepropertyhandler.cpp
45KGamePropertyHandler::KGamePropertyHandler(int id, const QObject *receiver, const char *sendf, const char *emitf, QObject *parent)
75void KGamePropertyHandler::registerHandler(int id, const QObject *receiver, const char *sendf, const char *emitf)
79 connect(this, SIGNAL(signalSendMessage(int, QDataStream &, bool *)), receiver, sendf, Qt::DirectConnection);
376 qDebug() << " " << p->id() << ": p=" << p->policy() << "l=" << p->isLocked() << "e=" << p->isEmittingSignal() << "o=" << p->isOptimized()
static void extractPropertyHeader(QDataStream &msg, int &id)
Retrieves the property id from a property message header.
Definition kgamemessage.cpp:67
static void extractPropertyCommand(QDataStream &msg, int &pid, int &cmd)
Retrieves the property id from a property message header.
Definition kgamemessage.cpp:81
static void createPropertyHeader(QDataStream &msg, int id)
Creates a property header given the property id.
Definition kgamemessage.cpp:62
virtual void load(QDataStream &s)=0
This will read the value of this property from the stream.
virtual void command(QDataStream &stream, int msgid, bool isSender=false)
send a command to advanced properties like arrays
Definition kgameproperty.cpp:191
bool isLocked() const
A locked property can only be changed by the player who has set the lock.
Definition kgameproperty.h:200
A collection class for KGameProperty objects.
Definition kgamepropertyhandler.h:64
bool sendProperty(QDataStream &s)
called by a property to send itself into the datastream.
Definition kgamepropertyhandler.cpp:300
void setId(int id)
Use id as new ID for this KGamePropertyHandler.
Definition kgamepropertyhandler.cpp:70
void signalRequestValue(KGamePropertyBase *property, QString &value)
If you call propertyValue with a non-standard KGameProperty it is possible that the value cannot auto...
void setPolicy(KGamePropertyBase::PropertyPolicy p, bool userspace=true)
Set the policy for all kgame variables which are currently registered in the KGame property handler.
Definition kgamepropertyhandler.cpp:215
void registerHandler(int id, const QObject *receiver, const char *send, const char *emit)
Register the handler with a parent.
Definition kgamepropertyhandler.cpp:75
void lockProperties()
Calls KGamePropertyBase::setReadOnly(true) for all properties of this handler.
Definition kgamepropertyhandler.cpp:238
int uniquePropertyId()
returns a unique property ID starting called usually with a base of KGamePropertyBase::IdAutomatic.
Definition kgamepropertyhandler.cpp:247
QString propertyValue(KGamePropertyBase *property)
In several situations you just want to have a QString of a KGameProperty object.
Definition kgamepropertyhandler.cpp:335
bool removeProperty(KGamePropertyBase *data)
Removes a property from the handler.
Definition kgamepropertyhandler.cpp:124
virtual bool save(QDataStream &stream)
Saves properties into the datastream.
Definition kgamepropertyhandler.cpp:193
QMultiHash< int, KGamePropertyBase * > & dict() const
Reference to the internal dictionary.
Definition kgamepropertyhandler.cpp:330
void flush()
Sends all properties which are marked dirty over the network.
Definition kgamepropertyhandler.cpp:252
bool addProperty(KGamePropertyBase *data, const QString &name=QString())
Adds a KGameProperty property to the handler.
Definition kgamepropertyhandler.cpp:134
void unlockProperties()
Calls KGamePropertyBase::setReadOnly(false) for all properties of this player.
Definition kgamepropertyhandler.cpp:229
virtual bool load(QDataStream &stream)
Loads properties from the datastream.
Definition kgamepropertyhandler.cpp:171
void unlockDirectEmit()
Removes the lock from the emitting of property signals.
Definition kgamepropertyhandler.cpp:271
void lockDirectEmit()
Called by the KGame or KPlayer object or the handler itself to delay emitting of signals.
Definition kgamepropertyhandler.cpp:266
KGamePropertyHandler(QObject *parent=nullptr)
Construct an unregistered KGamePropertyHandler.
Definition kgamepropertyhandler.cpp:52
void emitSignal(KGamePropertyBase *data)
called by a property to emit a signal This call is simply forwarded to the parent object
Definition kgamepropertyhandler.cpp:284
void signalPropertyChanged(KGamePropertyBase *)
This is emitted by a property.
bool processMessage(QDataStream &stream, int id, bool isSender)
Main message process function.
Definition kgamepropertyhandler.cpp:86
KGamePropertyBase::PropertyPolicy policy()
Returns the default policy for this property handler.
Definition kgamepropertyhandler.cpp:210
void signalSendMessage(int msgid, QDataStream &, bool *sent)
This signal is emitted when a property needs to be sent.
QString propertyName(int id) const
Definition kgamepropertyhandler.cpp:155
QString i18np(const char *singular, const char *plural, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool isEmpty() const const
bool isNull() const const
QString number(double n, char format, int precision)
DirectConnection
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.