summaryrefslogtreecommitdiffstats
path: root/gui/object.cpp
diff options
context:
space:
mode:
authorVojtech Bocek <vbocek@gmail.com>2014-02-08 02:05:33 +0100
committerVojtech Bocek <vbocek@gmail.com>2014-02-12 19:19:32 +0100
commit072205626caec16f3028a9b698e792e525848581 (patch)
treed262f85a3f58a7a86181dcadc24d6c352928f3f2 /gui/object.cpp
parentProperly delete all GUIObjects and pages on theme reload (diff)
downloadandroid_bootable_recovery-072205626caec16f3028a9b698e792e525848581.tar
android_bootable_recovery-072205626caec16f3028a9b698e792e525848581.tar.gz
android_bootable_recovery-072205626caec16f3028a9b698e792e525848581.tar.bz2
android_bootable_recovery-072205626caec16f3028a9b698e792e525848581.tar.lz
android_bootable_recovery-072205626caec16f3028a9b698e792e525848581.tar.xz
android_bootable_recovery-072205626caec16f3028a9b698e792e525848581.tar.zst
android_bootable_recovery-072205626caec16f3028a9b698e792e525848581.zip
Diffstat (limited to 'gui/object.cpp')
-rw-r--r--gui/object.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/gui/object.cpp b/gui/object.cpp
index b6010d778..41cc822bb 100644
--- a/gui/object.cpp
+++ b/gui/object.cpp
@@ -29,6 +29,8 @@ extern "C" {
GUIObject::GUIObject(xml_node<>* node)
{
+ mConditionsResult = true;
+
// Break out early, it's too hard to check if valid every step
if (!node) return;
@@ -78,13 +80,7 @@ bool GUIObject::IsConditionVariable(std::string var)
bool GUIObject::isConditionTrue()
{
- std::vector<Condition>::iterator iter;
- for (iter = mConditions.begin(); iter != mConditions.end(); iter++)
- {
- if (!isConditionTrue(&(*iter)))
- return false;
- }
- return true;
+ return mConditionsResult;
}
bool GUIObject::isConditionTrue(Condition* condition)
@@ -159,12 +155,15 @@ bool GUIObject::isConditionValid()
return !mConditions.empty();
}
-void GUIObject::NotifyPageSet()
+int GUIObject::NotifyVarChange(const std::string& varName, const std::string& value)
{
+ mConditionsResult = true;
+
+ const bool varNameEmpty = varName.empty();
std::vector<Condition>::iterator iter;
- for (iter = mConditions.begin(); iter != mConditions.end(); iter++)
+ for (iter = mConditions.begin(); iter != mConditions.end(); ++iter)
{
- if (iter->mCompareOp == "modified")
+ if(varNameEmpty && iter->mCompareOp == "modified")
{
string val;
@@ -176,7 +175,14 @@ void GUIObject::NotifyPageSet()
}
iter->mLastVal = val;
}
+
+ if(varNameEmpty || iter->mVar1 == varName || iter->mVar2 == varName)
+ iter->mLastResult = isConditionTrue(&(*iter));
+
+ if(!iter->mLastResult)
+ mConditionsResult = false;
}
+ return 0;
}
bool GUIObject::isMounted(string vol)