summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthat <github@that.at>2015-06-27 21:35:11 +0200
committerEthan Yonker <dees_troy@teamw.in>2015-07-13 22:04:11 +0200
commitb63e2f9156e90c0af3a35f900975b5ce9b4c5d00 (patch)
tree19e78e9398cebe3f97d5149a558f036719417d40
parentAdd flag to disable double buffering (diff)
downloadandroid_bootable_recovery-b63e2f9156e90c0af3a35f900975b5ce9b4c5d00.tar
android_bootable_recovery-b63e2f9156e90c0af3a35f900975b5ce9b4c5d00.tar.gz
android_bootable_recovery-b63e2f9156e90c0af3a35f900975b5ce9b4c5d00.tar.bz2
android_bootable_recovery-b63e2f9156e90c0af3a35f900975b5ce9b4c5d00.tar.lz
android_bootable_recovery-b63e2f9156e90c0af3a35f900975b5ce9b4c5d00.tar.xz
android_bootable_recovery-b63e2f9156e90c0af3a35f900975b5ce9b4c5d00.tar.zst
android_bootable_recovery-b63e2f9156e90c0af3a35f900975b5ce9b4c5d00.zip
-rw-r--r--gui/pages.cpp42
-rw-r--r--gui/pages.hpp4
2 files changed, 19 insertions, 27 deletions
diff --git a/gui/pages.cpp b/gui/pages.cpp
index 975d40ff0..4c98a7233 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -267,7 +267,7 @@ int ActionObject::SetActionPos(int x, int y, int w, int h)
return 0;
}
-Page::Page(xml_node<>* page, std::vector<xml_node<>*> *templates /* = NULL */)
+Page::Page(xml_node<>* page, std::vector<xml_node<>*> *templates)
{
mTouchStart = NULL;
@@ -296,9 +296,7 @@ Page::Page(xml_node<>* page, std::vector<xml_node<>*> *templates /* = NULL */)
LOGINFO("Loading page %s\n", mName.c_str());
// This is a recursive routine for template handling
- ProcessNode(page, templates);
-
- return;
+ ProcessNode(page, templates, 0);
}
Page::~Page()
@@ -307,7 +305,7 @@ Page::~Page()
delete *itr;
}
-bool Page::ProcessNode(xml_node<>* page, std::vector<xml_node<>*> *templates /* = NULL */, int depth /* = 0 */)
+bool Page::ProcessNode(xml_node<>* page, std::vector<xml_node<>*> *templates, int depth)
{
if (depth == 10)
{
@@ -315,26 +313,20 @@ bool Page::ProcessNode(xml_node<>* page, std::vector<xml_node<>*> *templates /*
return false;
}
- // Let's retrieve the background value, if any
- xml_node<>* bg = page->first_node("background");
- if (bg)
+ for (xml_node<>* child = page->first_node(); child; child = child->next_sibling())
{
- xml_attribute<>* attr = bg->first_attribute("color");
- if (attr)
- {
- std::string color = attr->value();
- ConvertStrToColor(color, &mBackground);
- }
- }
+ std::string type = child->name();
- xml_node<>* child;
- child = page->first_node("object");
- while (child)
- {
- if (!child->first_attribute("type"))
- break;
+ if (type == "background") {
+ mBackground = LoadAttrColor(child, "color", COLOR(0,0,0,0));
+ continue;
+ }
- std::string type = child->first_attribute("type")->value();
+ if (type == "object") {
+ // legacy format : <object type="...">
+ xml_attribute<>* attr = child->first_attribute("type");
+ type = attr ? attr->value() : "*unspecified*";
+ }
if (type == "text")
{
@@ -486,14 +478,14 @@ bool Page::ProcessNode(xml_node<>* page, std::vector<xml_node<>*> *templates /*
break;
node = node->next_sibling("template");
}
+ // [check] why is there no if (node_found) here too?
}
}
}
else
{
- LOGERR("Unknown object type.\n");
+ LOGERR("Unknown object type: %s.\n", type.c_str());
}
- child = child->next_sibling("object");
}
return true;
}
@@ -660,7 +652,7 @@ PageSet::PageSet(char* xmlFile)
if (xmlFile)
mDoc.parse<0>(mXmlFile);
else
- mCurrentPage = new Page(NULL);
+ mCurrentPage = new Page(NULL, NULL);
}
PageSet::~PageSet()
diff --git a/gui/pages.hpp b/gui/pages.hpp
index f0b2155c4..81112f979 100644
--- a/gui/pages.hpp
+++ b/gui/pages.hpp
@@ -46,7 +46,7 @@ class HardwareKeyboard;
class Page
{
public:
- Page(xml_node<>* page, std::vector<xml_node<>*> *templates = NULL);
+ Page(xml_node<>* page, std::vector<xml_node<>*> *templates);
virtual ~Page();
std::string GetName(void) { return mName; }
@@ -72,7 +72,7 @@ protected:
COLOR mBackground;
protected:
- bool ProcessNode(xml_node<>* page, std::vector<xml_node<>*> *templates = NULL, int depth = 0);
+ bool ProcessNode(xml_node<>* page, std::vector<xml_node<>*> *templates, int depth);
};
class PageSet