diff options
author | Wolf Bergenheim <ext-wolf.2.bergenheim@nokia.com> | 2010-12-01 16:28:01 +0200 |
---|---|---|
committer | Wolf Bergenheim <ext-wolf.2.bergenheim@nokia.com> | 2010-12-01 16:28:01 +0200 |
commit | bece735d920909a83e290a790be0d76224653b07 (patch) | |
tree | 2d56daf9f1cc79039a7d9c40722ab566ab9ad424 /libresourceqt/src/resource-set.cpp | |
parent | 6a47ede3a71e22b09a09169818705351c00abf9d (diff) | |
parent | 78db2c0b916d68a0c4056d4be7228a606b2f9dac (diff) |
Merge branch 'master' into meego
Diffstat (limited to 'libresourceqt/src/resource-set.cpp')
-rw-r--r-- | libresourceqt/src/resource-set.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/libresourceqt/src/resource-set.cpp b/libresourceqt/src/resource-set.cpp index 8b46664..190df5e 100644 --- a/libresourceqt/src/resource-set.cpp +++ b/libresourceqt/src/resource-set.cpp @@ -80,6 +80,8 @@ bool ResourceSet::initialize() this, SLOT(handleResourcesBecameAvailable(quint32))); QObject::connect(resourceEngine, SIGNAL(errorCallback(quint32, const char*)), this, SIGNAL(errorCallback(quint32, const char*))); + QObject::connect(resourceEngine, SIGNAL(resourcesReleasedByManager()), + this, SIGNAL(resourcesReleasedByManager())); qDebug("initializing resource engine..."); if (!resourceEngine->initialize()) { @@ -228,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(); } @@ -309,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(); |