summaryrefslogtreecommitdiffstats
path: root/gui/resources.cpp
diff options
context:
space:
mode:
authorthat <github@that.at>2015-03-05 20:25:39 +0100
committerEthan Yonker <dees_troy@teamw.in>2015-03-11 13:38:37 +0100
commitb2e8f672f310276e7009895c0ac4e58fcfeb35ac (patch)
tree44efb3ac558764f7faa95e509d6e4f19477ea505 /gui/resources.cpp
parentgui: allow specifying resource type in element name (diff)
downloadandroid_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar.gz
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar.bz2
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar.lz
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar.xz
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.tar.zst
android_bootable_recovery-b2e8f672f310276e7009895c0ac4e58fcfeb35ac.zip
Diffstat (limited to '')
-rw-r--r--gui/resources.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/gui/resources.cpp b/gui/resources.cpp
index 563dcc45c..dcd4ca8b0 100644
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -4,22 +4,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <fcntl.h>
-#include <sys/reboot.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <time.h>
#include <unistd.h>
-#include <stdlib.h>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
+#include "../minzip/Zip.h"
extern "C" {
#include "../twcommon.h"
#include "../minuitwrp/minui.h"
@@ -282,6 +274,14 @@ AnimationResource* ResourceManager::FindAnimation(const std::string& name) const
return NULL;
}
+std::string ResourceManager::FindString(const std::string& name) const
+{
+ std::map<std::string, std::string>::const_iterator it = mStrings.find(name);
+ if (it != mStrings.end())
+ return it->second;
+ return "[" + name + ("]");
+}
+
ResourceManager::ResourceManager()
{
}
@@ -339,6 +339,13 @@ void ResourceManager::LoadResources(xml_node<>* resList, ZipArchive* pZip)
delete res;
}
}
+ else if (type == "string")
+ {
+ if (xml_attribute<>* attr = child->first_attribute("name"))
+ mStrings[attr->value()] = child->value();
+ else
+ error = true;
+ }
else
{
LOGERR("Resource type (%s) not supported.\n", type.c_str());