ContextSubscriber::PropertyHandle Class Reference

A common handle for a context property. More...

#include <propertyhandle.h>

List of all members.

Signals

void valueChanged ()

Public Member Functions

void subscribe ()
 Increase the subscribeCount of this context property and subscribe to it through the myProvider instance if neccessary.
void unsubscribe ()
 Decrease the subscribeCount of this context property and unsubscribe from it through the myProvider instance if neccessary.
QString key () const
QVariant value () const
bool isSubscribePending () const
const ContextPropertyInfoinfo () const
void onValueChanged ()
 Used by the HandleSignalRouter to change the value of the property.
void setSubscribeFinished (Provider *provider)
 Sets subscribePending to false.
void blockUntilSubscribed ()

Static Public Member Functions

static PropertyHandleinstance (const QString &key)
static void ignoreCommander ()
static void setTypeCheck (bool typeCheck)

Static Public Attributes

static const ContextProviderInfo commanderInfo

Private Slots

void updateProvider ()
 Decides who is the current provider of this property and sets up myProvider accordingly.

Private Member Functions

 PropertyHandle (const QString &key)

Private Attributes

QSet< Provider * > pendingSubscriptions
 Providers pending subscription.
QList< Provider * > myProviders
 Providers of this property.
ContextPropertyInfomyInfo
 Metadata for this property.
unsigned int subscribeCount
 Number of subscribed ContextProperty objects subscribed to this property.
QMutex subscribeCountLock
QString myKey
 Key of this property.
QReadWriteLock valueLock
QVariant myValue
 Current value of this property.

Static Private Attributes

static DBusNameListenercommanderListener = new DBusNameListener(commanderDBusType, commanderDBusName)
 Listener for ContextCommander's (dis)appearance.
static bool commandingEnabled = true
 Whether the properties can be directed to ContextCommander.
static bool typeCheckEnabled = false
 Whether we check the type of the value received from the provider.


Detailed Description

A common handle for a context property.

Only one handle exists at a time for a context property, no matter how much ContextProperty objects are created for it.

Communication with the provider is done through the myProvider Provider instance, which is updated when needed because of registry changes. Handling of disappearance from the DBus and then reappearance on the DBus of the same provider is handled privately by Provider. If we don't know the current provider for this handle, then the myProvider pointer is 0.

PropertyHandle and Provider instances are never deleted; they stick around until the process is terminated.

All of the PropertyHandle instances and Property provider instances are always created with the QCoreApplication's thread as the thread where they live. This is needed, because user threads can go away and we would like to have only one DBus connection.


Constructor & Destructor Documentation

ContextSubscriber::PropertyHandle::PropertyHandle ( const QString &  key  )  [private]


Member Function Documentation

void ContextSubscriber::PropertyHandle::subscribe (  ) 

Increase the subscribeCount of this context property and subscribe to it through the myProvider instance if neccessary.

void ContextSubscriber::PropertyHandle::unsubscribe (  ) 

Decrease the subscribeCount of this context property and unsubscribe from it through the myProvider instance if neccessary.

QString ContextSubscriber::PropertyHandle::key (  )  const

QVariant ContextSubscriber::PropertyHandle::value (  )  const

bool ContextSubscriber::PropertyHandle::isSubscribePending (  )  const

const ContextPropertyInfo * ContextSubscriber::PropertyHandle::info (  )  const

PropertyHandle * ContextSubscriber::PropertyHandle::instance ( const QString &  key  )  [static]

void ContextSubscriber::PropertyHandle::onValueChanged (  ) 

Used by the HandleSignalRouter to change the value of the property.

Before changing the value it checks the type if type checks are enabled. The verification errors are signalled on the stderr. After the check it updates the value and emits the valueChanged() signal.

void ContextSubscriber::PropertyHandle::setSubscribeFinished ( Provider provider  ) 

Sets subscribePending to false.

void ContextSubscriber::PropertyHandle::ignoreCommander (  )  [static]

void ContextSubscriber::PropertyHandle::setTypeCheck ( bool  typeCheck  )  [static]

void ContextSubscriber::PropertyHandle::blockUntilSubscribed (  ) 

void ContextSubscriber::PropertyHandle::valueChanged (  )  [signal]

void ContextSubscriber::PropertyHandle::updateProvider (  )  [private, slot]

Decides who is the current provider of this property and sets up myProvider accordingly.

If the provider has changed then renews the subscriptions.


Member Data Documentation

Providers pending subscription.

Providers of this property.

Metadata for this property.

Number of subscribed ContextProperty objects subscribed to this property.

Key of this property.

QReadWriteLock ContextSubscriber::PropertyHandle::valueLock [mutable, private]

Current value of this property.

DBusNameListener * ContextSubscriber::PropertyHandle::commanderListener = new DBusNameListener(commanderDBusType, commanderDBusName) [static, private]

Listener for ContextCommander's (dis)appearance.

Whether the properties can be directed to ContextCommander.

Whether we check the type of the value received from the provider.


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

Generated on Sun Apr 21 16:11:51 2013 for libcontextsubscriber by  doxygen 1.5.6