summaryrefslogtreecommitdiff
path: root/libresourceqt/src/resource-set.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-19 17:06:45 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-19 17:06:45 +0200
commitd6a687cdff25a69b3333a1e490934128b095f0db (patch)
tree22ad5401e417f5ab2706ae59f76ac5ebc74e9ed2 /libresourceqt/src/resource-set.cpp
parentda47faf6b036220e32e7ce90210530ba5ef9dc2b (diff)
downloadlibresourceqt-d6a687cdff25a69b3333a1e490934128b095f0db.tar.gz
Changes based on Qt feedback. Removed addResources, it add no value
Diffstat (limited to 'libresourceqt/src/resource-set.cpp')
-rw-r--r--libresourceqt/src/resource-set.cpp61
1 files changed, 54 insertions, 7 deletions
diff --git a/libresourceqt/src/resource-set.cpp b/libresourceqt/src/resource-set.cpp
index 8d2668b..e45cb1c 100644
--- a/libresourceqt/src/resource-set.cpp
+++ b/libresourceqt/src/resource-set.cpp
@@ -18,9 +18,11 @@ ResourceSet::~ResourceSet()
for (int i = 0;i < NumberOfTypes;i++) {
delete resourceSet[i];
}
- resourceEngine->disconnect(this);
-// resourceEngine->disconnectFromManager();
- delete resourceEngine;
+ if(resourceEngine != NULL) {
+ resourceEngine->disconnect(this);
+ //resourceEngine->disconnectFromManager();
+ delete resourceEngine;
+ }
}
bool ResourceSet::initialize()
@@ -52,8 +54,10 @@ bool ResourceSet::initialize()
return true;
}
-void ResourceSet::addResource(Resource *resource)
+void ResourceSet::addResourceObject(Resource *resource)
{
+ if(resource == NULL)
+ return;
if (resource->type() == AudioPlaybackType) {
qDebug("audioResource... %p", resource);
audioResource = static_cast<AudioResource *>(resource);
@@ -73,11 +77,54 @@ void ResourceSet::addResource(Resource *resource)
resourceSet[resource->type()] = resource;
}
-void ResourceSet::addResources(const QList<Resource *>resources)
+bool ResourceSet::addResource(ResourceType type)
{
- for (int i = 0; i < resources.size(); i++) {
- addResource(resources.at(i));
+ Resource *resource = NULL;
+ switch (type) {
+ case AudioPlaybackType:
+ resource = new AudioResource;
+ break;
+ case AudioRecorderType:
+ resource = new AudioRecorderResource;
+ break;
+ case VideoPlaybackType:
+ resource = new VideoResource;
+ break;
+ case VideoRecorderType:
+ resource = new VideoRecorderResource;
+ break;
+ case VibraType:
+ resource = new VibraResource;
+ break;
+ case LedsType:
+ resource = new LedsResource;
+ break;
+ case BacklightType:
+ resource = new BacklightResource;
+ break;
+ case SystemButtonType:
+ resource = new SystemButtonResource;
+ break;
+ case LockButtonType:
+ resource = new LockButtonResource;
+ break;
+ case ScaleButtonType:
+ resource = new ScaleButtonResource;
+ break;
+ case SnapButtonType:
+ resource = new SnapButtonResource;
+ break;
+ case LensCoverType:
+ resource = new LensCoverResource;
+ break;
+ default:
+ return false;
+ }
+ if (resource == NULL) {
+ return false;
}
+ addResourceObject(resource);
+ return true;
}
void ResourceSet::deleteResource(ResourceType type)