summaryrefslogtreecommitdiff
path: root/libresourceqt/src
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
parentda47faf6b036220e32e7ce90210530ba5ef9dc2b (diff)
Changes based on Qt feedback. Removed addResources, it add no value
Diffstat (limited to 'libresourceqt/src')
-rw-r--r--libresourceqt/src/audio-resource.cpp6
-rw-r--r--libresourceqt/src/resource-set.cpp61
-rw-r--r--libresourceqt/src/resources.cpp56
3 files changed, 54 insertions, 69 deletions
diff --git a/libresourceqt/src/audio-resource.cpp b/libresourceqt/src/audio-resource.cpp
index f3c345e..10fe7e5 100644
--- a/libresourceqt/src/audio-resource.cpp
+++ b/libresourceqt/src/audio-resource.cpp
@@ -14,11 +14,6 @@ AudioResource::AudioResource(const AudioResource &other)
{
}
-Resource * AudioResource::clone() const
-{
- return new AudioResource(*this);
-}
-
AudioResource::~AudioResource()
{
}
@@ -86,4 +81,3 @@ ResourceType AudioResource::type() const
{
return AudioPlaybackType;
}
-
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)
diff --git a/libresourceqt/src/resources.cpp b/libresourceqt/src/resources.cpp
index f6a54d8..d0ac8f0 100644
--- a/libresourceqt/src/resources.cpp
+++ b/libresourceqt/src/resources.cpp
@@ -12,11 +12,6 @@ AudioRecorderResource::AudioRecorderResource(const AudioRecorderResource &other)
{
}
-Resource * AudioRecorderResource::clone() const
-{
- return new AudioRecorderResource(*this);
-}
-
AudioRecorderResource::~AudioRecorderResource()
{
}
@@ -36,11 +31,6 @@ VideoResource::VideoResource(const VideoResource &other)
{
}
-Resource * VideoResource::clone() const
-{
- return new VideoResource(*this);
-}
-
VideoResource::~VideoResource()
{
}
@@ -60,11 +50,6 @@ VideoRecorderResource::VideoRecorderResource(const VideoRecorderResource &other)
{
}
-Resource * VideoRecorderResource::clone() const
-{
- return new VideoRecorderResource(*this);
-}
-
VideoRecorderResource::~VideoRecorderResource()
{
}
@@ -84,11 +69,6 @@ VibraResource::VibraResource(const VibraResource &other)
{
}
-Resource * VibraResource::clone() const
-{
- return new VibraResource(*this);
-}
-
VibraResource::~VibraResource()
{
}
@@ -108,11 +88,6 @@ LedsResource::LedsResource(const LedsResource &other)
{
}
-Resource * LedsResource::clone() const
-{
- return new LedsResource(*this);
-}
-
LedsResource::~LedsResource()
{
}
@@ -132,11 +107,6 @@ BacklightResource::BacklightResource(const BacklightResource &other)
{
}
-Resource * BacklightResource::clone() const
-{
- return new BacklightResource(*this);
-}
-
BacklightResource::~BacklightResource()
{
}
@@ -156,11 +126,6 @@ SystemButtonResource::SystemButtonResource(const SystemButtonResource &other)
{
}
-Resource * SystemButtonResource::clone() const
-{
- return new SystemButtonResource(*this);
-}
-
SystemButtonResource::~SystemButtonResource()
{
}
@@ -180,11 +145,6 @@ LockButtonResource::LockButtonResource(const LockButtonResource &other)
{
}
-Resource * LockButtonResource::clone() const
-{
- return new LockButtonResource(*this);
-}
-
LockButtonResource::~LockButtonResource()
{
}
@@ -204,11 +164,6 @@ ScaleButtonResource::ScaleButtonResource(const ScaleButtonResource &other)
{
}
-Resource * ScaleButtonResource::clone() const
-{
- return new ScaleButtonResource(*this);
-}
-
ScaleButtonResource::~ScaleButtonResource()
{
}
@@ -228,11 +183,6 @@ SnapButtonResource::SnapButtonResource(const SnapButtonResource &other)
{
}
-Resource * SnapButtonResource::clone() const
-{
- return new SnapButtonResource(*this);
-}
-
SnapButtonResource::~SnapButtonResource()
{
}
@@ -252,11 +202,6 @@ LensCoverResource::LensCoverResource(const LensCoverResource &other)
{
}
-Resource * LensCoverResource::clone() const
-{
- return new LensCoverResource(*this);
-}
-
LensCoverResource::~LensCoverResource()
{
}
@@ -265,4 +210,3 @@ ResourceType LensCoverResource::type() const
{
return LensCoverType;
}
-