#include <propertyhandle.h>
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 ContextPropertyInfo * | info () 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 PropertyHandle * | instance (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. | |
ContextPropertyInfo * | myInfo |
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 DBusNameListener * | commanderListener = 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. |
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.
ContextSubscriber::PropertyHandle::PropertyHandle | ( | const QString & | key | ) | [private] |
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.
QSet<Provider*> ContextSubscriber::PropertyHandle::pendingSubscriptions [private] |
Providers pending subscription.
QList<Provider*> ContextSubscriber::PropertyHandle::myProviders [private] |
Providers of this property.
Metadata for this property.
unsigned int ContextSubscriber::PropertyHandle::subscribeCount [private] |
Number of subscribed ContextProperty objects subscribed to this property.
QMutex ContextSubscriber::PropertyHandle::subscribeCountLock [private] |
QString ContextSubscriber::PropertyHandle::myKey [private] |
Key of this property.
QReadWriteLock ContextSubscriber::PropertyHandle::valueLock [mutable, private] |
QVariant ContextSubscriber::PropertyHandle::myValue [private] |
Current value of this property.
DBusNameListener * ContextSubscriber::PropertyHandle::commanderListener = new DBusNameListener(commanderDBusType, commanderDBusName) [static, private] |
Listener for ContextCommander's (dis)appearance.
bool ContextSubscriber::PropertyHandle::commandingEnabled = true [static, private] |
Whether the properties can be directed to ContextCommander.
bool ContextSubscriber::PropertyHandle::typeCheckEnabled = false [static, private] |
Whether we check the type of the value received from the provider.