summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorthat <github@that.at>2015-01-18 12:00:02 +0100
committerthat <github@that.at>2015-01-18 12:00:02 +0100
commitf74ac8740cd745bf2bb4b8dcc5463fea9016dfd2 (patch)
treefe7a879d59a72f35f35e2c80e8da4a83305c71a0 /gui
parent2.8.4.0 (diff)
downloadandroid_bootable_recovery-f74ac8740cd745bf2bb4b8dcc5463fea9016dfd2.tar
android_bootable_recovery-f74ac8740cd745bf2bb4b8dcc5463fea9016dfd2.tar.gz
android_bootable_recovery-f74ac8740cd745bf2bb4b8dcc5463fea9016dfd2.tar.bz2
android_bootable_recovery-f74ac8740cd745bf2bb4b8dcc5463fea9016dfd2.tar.lz
android_bootable_recovery-f74ac8740cd745bf2bb4b8dcc5463fea9016dfd2.tar.xz
android_bootable_recovery-f74ac8740cd745bf2bb4b8dcc5463fea9016dfd2.tar.zst
android_bootable_recovery-f74ac8740cd745bf2bb4b8dcc5463fea9016dfd2.zip
Diffstat (limited to 'gui')
-rw-r--r--gui/resources.cpp85
1 files changed, 24 insertions, 61 deletions
diff --git a/gui/resources.cpp b/gui/resources.cpp
index 74f020b62..0d32ceee0 100644
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -256,82 +256,45 @@ void ResourceManager::LoadResources(xml_node<>* resList, ZipArchive* pZip)
if (!attr)
break;
+ Resource* res = NULL;
std::string type = attr->value();
-
if (type == "font")
{
- FontResource* res = new FontResource(child, pZip);
- if (res == NULL || res->GetResource() == NULL)
- {
- std::string res_name;
- if (child->first_attribute("name"))
- res_name = child->first_attribute("name")->value();
- if (res_name.empty() && child->first_attribute("filename"))
- res_name = child->first_attribute("filename")->value();
-
- if (!res_name.empty()) {
- LOGERR("Resource (%s)-(%s) failed to load\n", type.c_str(), res_name.c_str());
- } else
- LOGERR("Resource type (%s) failed to load\n", type.c_str());
-
- delete res;
- }
- else
- {
- mResources.push_back((Resource*) res);
- }
+ res = new FontResource(child, pZip);
}
else if (type == "image")
{
- ImageResource* res = new ImageResource(child, pZip);
- if (res == NULL || res->GetResource() == NULL)
- {
- std::string res_name;
- if (child->first_attribute("name"))
- res_name = child->first_attribute("name")->value();
- if (res_name.empty() && child->first_attribute("filename"))
- res_name = child->first_attribute("filename")->value();
-
- if (!res_name.empty()) {
- LOGERR("Resource (%s)-(%s) failed to load\n", type.c_str(), res_name.c_str());
- } else
- LOGERR("Resource type (%s) failed to load\n", type.c_str());
-
- delete res;
- }
- else
- {
- mResources.push_back((Resource*) res);
- }
+ res = new ImageResource(child, pZip);
}
else if (type == "animation")
{
- AnimationResource* res = new AnimationResource(child, pZip);
- if (res == NULL || res->GetResource() == NULL)
- {
- std::string res_name;
- if (child->first_attribute("name"))
- res_name = child->first_attribute("name")->value();
- if (res_name.empty() && child->first_attribute("filename"))
- res_name = child->first_attribute("filename")->value();
-
- if (!res_name.empty()) {
- LOGERR("Resource (%s)-(%s) failed to load\n", type.c_str(), res_name.c_str());
- } else
- LOGERR("Resource type (%s) failed to load\n", type.c_str());
-
- delete res;
- }
- else
- {
- mResources.push_back((Resource*) res);
- }
+ res = new AnimationResource(child, pZip);
}
else
{
LOGERR("Resource type (%s) not supported.\n", type.c_str());
}
+ if (res == NULL || res->GetResource() == NULL)
+ {
+ std::string res_name;
+ if (child->first_attribute("name"))
+ res_name = child->first_attribute("name")->value();
+ if (res_name.empty() && child->first_attribute("filename"))
+ res_name = child->first_attribute("filename")->value();
+
+ if (!res_name.empty()) {
+ LOGERR("Resource (%s)-(%s) failed to load\n", type.c_str(), res_name.c_str());
+ } else
+ LOGERR("Resource type (%s) failed to load\n", type.c_str());
+
+ delete res;
+ }
+ else
+ {
+ mResources.push_back(res);
+ }
+
child = child->next_sibling("resource");
}
}