diff options
author | Wolf Bergenheim <ext-wolf.2.bergenheim@nokia.com> | 2010-12-01 16:27:21 +0200 |
---|---|---|
committer | Wolf Bergenheim <ext-wolf.2.bergenheim@nokia.com> | 2010-12-01 16:27:21 +0200 |
commit | 78db2c0b916d68a0c4056d4be7228a606b2f9dac (patch) | |
tree | fb5c624c88b413d82c790c7f488d3e3efd862742 /libresourceqt | |
parent | c8917f1cbbf96a1c5c655d9adbd45a46833e70db (diff) | |
parent | ef6d735381083c0e90b122f6a22771c13337b8c1 (diff) |
Merge remote branch 'origin/master'
Diffstat (limited to 'libresourceqt')
-rw-r--r-- | libresourceqt/include/qt4/policy/resource-set.h | 12 | ||||
-rw-r--r-- | libresourceqt/src/resource-set.cpp | 26 |
2 files changed, 31 insertions, 7 deletions
diff --git a/libresourceqt/include/qt4/policy/resource-set.h b/libresourceqt/include/qt4/policy/resource-set.h index 25a8309..a36254d 100644 --- a/libresourceqt/include/qt4/policy/resource-set.h +++ b/libresourceqt/include/qt4/policy/resource-set.h @@ -213,6 +213,13 @@ public: QString applicationClass(); /** + * Initialize and connect the ResourceEngine of this ResourceSet. + * Use this method after adding resources to the ResourceSet initially. + * \return true if the method succeeds without encountering errors. + */ + bool initAndConnect(); + + /** * Try to acquire the \ref ResourceSet. The resourcesGranted() or * resourcesDenied() signal will be emited depending on whether the * requested resources could be acquired or not. @@ -303,6 +310,11 @@ signals: */ void errorCallback(quint32, const char*); + /** + * This signals that we have connected to the Resource Manager. + */ + void connectedToManager(); + private: bool initialize(); diff --git a/libresourceqt/src/resource-set.cpp b/libresourceqt/src/resource-set.cpp index e96c7a0..190df5e 100644 --- a/libresourceqt/src/resource-set.cpp +++ b/libresourceqt/src/resource-set.cpp @@ -230,21 +230,32 @@ Resource * ResourceSet::resource(ResourceType type) const return resourceSet[type]; } -bool ResourceSet::acquire() +bool ResourceSet::initAndConnect() { - if (!initialized) { + if ( !initialized ) { qDebug("ResourceSet::%s().... initializing...", __FUNCTION__); - pendingAcquire = true; return initialize(); } - if (!resourceEngine->isConnectedToManager()) { + if ( !resourceEngine->isConnectedToManager() ) { qDebug("ResourceSet::%s().... connecting...", __FUNCTION__); + return resourceEngine->connectToManager(); + } + else + qDebug("ResourceSet::%s(): already connected", __FUNCTION__); + + return true; +} + +bool ResourceSet::acquire() +{ + if ( !initialized || !resourceEngine->isConnectedToManager() ) + { pendingAcquire = true; - resourceEngine->connectToManager(); - return true; + return initAndConnect(); } - else { + else + { qDebug("ResourceSet::%s().... acquiring", __FUNCTION__); return resourceEngine->acquireResources(); } @@ -311,6 +322,7 @@ void ResourceSet::connectedHandler() qDebug("**************** ResourceSet::%s().... %d", __FUNCTION__, __LINE__); if (resourceEngine->isConnectedToManager()) { qDebug("ResourceSet::%s() Connected to manager!", __FUNCTION__); + emit connectedToManager(); if (pendingAudioProperties) { registerAudioProperties(); |