Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
SyncableObject Class Reference

#include </tmp/quassel/src/common/syncableobject.h>

Inheritance diagram for SyncableObject:

Public Slots

virtual void setInitialized ()
void requestUpdate (const QVariantMap &properties)
virtual void update (const QVariantMap &properties)


void initDone ()
void updatedRemotely ()
void updated ()

Public Member Functions

 SyncableObject (QObject *parent=0)
 SyncableObject (const QString &objectName, QObject *parent=0)
 SyncableObject (const SyncableObject &other, QObject *parent=0)
 ~SyncableObject ()
virtual QVariantMap toVariantMap ()
 Stores the object's state into a QVariantMap.
virtual void fromVariantMap (const QVariantMap &properties)
 Initialize the object's state from a given QVariantMap.
virtual bool isInitialized () const
virtual const QMetaObject * syncMetaObject () const
void setAllowClientUpdates (bool allow)
bool allowClientUpdates () const

Protected Member Functions

void sync_call__ (SignalProxy::ProxyMode modeType, const char *funcname,...) const
void renameObject (const QString &newName)
SyncableObjectoperator= (const SyncableObject &other)

Private Member Functions

void synchronize (SignalProxy *proxy)
void stopSynchronize (SignalProxy *proxy)
bool setInitValue (const QString &property, const QVariant &value)

Private Attributes

bool _initialized
bool _allowClientUpdates
QList< SignalProxy * > _signalProxies

Static Private Attributes

static const int _classNameOffset__ = QByteArray(staticMetaObject.className()).length() + 2


class SignalProxy

Detailed Description

Definition at line 48 of file syncableobject.h.

Constructor & Destructor Documentation

SyncableObject ( QObject *  parent = 0)

Definition at line 31 of file syncableobject.cpp.

SyncableObject ( const QString &  objectName,
QObject *  parent = 0 

Definition at line 39 of file syncableobject.cpp.

SyncableObject ( const SyncableObject other,
QObject *  parent = 0 

Definition at line 48 of file syncableobject.cpp.

Definition at line 56 of file syncableobject.cpp.

References _signalProxies, and SignalProxy::stopSynchronize().

Member Function Documentation

QVariantMap toVariantMap ( )

Stores the object's state into a QVariantMap.

The default implementation takes dynamic properties as well as getters that have names starting with "init" and stores them in a QVariantMap. Override this method in derived classes in order to store the object state in a custom form.

This is used by SignalProxy to transmit the state of the object to clients that request the initial object state. Later updates use a different mechanism and assume that the state is completely covered by properties and init* getters. DO NOT OVERRIDE THIS unless you know exactly what you do!
The object's state in a QVariantMap

Definition at line 91 of file syncableobject.cpp.

References SignalProxy::ExtendedMetaObject::methodBaseName(), and SignalProxy::ExtendedMetaObject::methodName().

Referenced by BufferViewSettingsPage::cloneConfig(), AliasesModel::commit(), IgnoreListModel::commit(), ClientBufferViewConfig::ensureDecoration(), IrcConnectionWizard::finishClicked(), SignalProxy::initData(), CoreNetworkConfig::save(), BufferViewSettingsPage::save(), and ClientBufferViewManager::setInitialized().

void fromVariantMap ( const QVariantMap &  properties)

Initialize the object's state from a given QVariantMap.

See Also
toVariantMap() for important information concerning this method.

Definition at line 135 of file syncableobject.cpp.

References setInitValue().

Referenced by BufferViewConfig::BufferViewConfig(), BufferViewSettingsPage::cloneConfig(), Network::newIrcChannel(), Network::newIrcUser(), SignalProxy::setInitData(), and update().

void setAllowClientUpdates ( bool  allow)
bool allowClientUpdates ( ) const

Definition at line 82 of file syncableobject.h.

References _allowClientUpdates.

Referenced by requestUpdate().

void requestUpdate ( const QVariantMap &  properties)
void update ( const QVariantMap &  properties)

Definition at line 192 of file syncableobject.cpp.

References ARG, fromVariantMap(), SYNC, and updated().

Referenced by requestUpdate().

void sync_call__ ( SignalProxy::ProxyMode  modeType,
const char *  funcname,
) const

Definition at line 209 of file syncableobject.cpp.

References _signalProxies, and SignalProxy::sync_call__().

void renameObject ( const QString &  newName)
SyncableObject & operator= ( const SyncableObject other)

Definition at line 67 of file syncableobject.cpp.

References _allowClientUpdates, and _initialized.

Referenced by IgnoreListManager::operator=(), and AliasManager::operator=().

void initDone ( )
void updatedRemotely ( )
void updated ( )
void synchronize ( SignalProxy proxy)

Reimplemented in CoreIdentity.

Definition at line 221 of file syncableobject.cpp.

References _signalProxies.

Referenced by BufferViewManager::BufferViewManager(), and SignalProxy::synchronize().

void stopSynchronize ( SignalProxy proxy)

Definition at line 229 of file syncableobject.cpp.

References _signalProxies.

Referenced by SignalProxy::stopSynchronize(), and SignalProxy::~SignalProxy().

bool setInitValue ( const QString &  property,
const QVariant &  value 

Definition at line 160 of file syncableobject.cpp.

Referenced by fromVariantMap().

Friends And Related Function Documentation

friend class SignalProxy

Definition at line 111 of file syncableobject.h.

Member Data Documentation

const int _classNameOffset__ = QByteArray(staticMetaObject.className()).length() + 2

Definition at line 50 of file syncableobject.h.

bool _initialized

Definition at line 106 of file syncableobject.h.

Referenced by isInitialized(), operator=(), and setInitialized().

bool _allowClientUpdates

Definition at line 107 of file syncableobject.h.

Referenced by allowClientUpdates(), operator=(), and setAllowClientUpdates().

QList<SignalProxy *> _signalProxies

The documentation for this class was generated from the following files: