summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gui/image.cpp5
-rw-r--r--gui/objects.hpp2
-rw-r--r--twrp-functions.cpp7
3 files changed, 12 insertions, 2 deletions
diff --git a/gui/image.cpp b/gui/image.cpp
index 45d863673..31d9418d3 100644
--- a/gui/image.cpp
+++ b/gui/image.cpp
@@ -25,7 +25,7 @@ extern "C" {
#include "rapidxml.hpp"
#include "objects.hpp"
-GUIImage::GUIImage(xml_node<>* node)
+GUIImage::GUIImage(xml_node<>* node) : Conditional(node)
{
xml_attribute<>* attr;
xml_node<>* child;
@@ -79,6 +79,9 @@ GUIImage::GUIImage(xml_node<>* node)
int GUIImage::Render(void)
{
+ if (!isConditionTrue())
+ return 0;
+
if (isHighlighted && mHighlightImage && mHighlightImage->GetResource()) {
gr_blit(mHighlightImage->GetResource(), 0, 0, mRenderW, mRenderH, mRenderX, mRenderY);
return 0;
diff --git a/gui/objects.hpp b/gui/objects.hpp
index 1e272b276..c259fd490 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -215,7 +215,7 @@ protected:
};
// GUIImage - Used for static image
-class GUIImage : public RenderObject
+class GUIImage : public RenderObject, public Conditional
{
public:
GUIImage(xml_node<>* node);
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index c39a6b242..1c0ad7590 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -1016,6 +1016,13 @@ void TWFunc::Auto_Generate_Backup_Name() {
Backup_Name += " " + propvalue;
if (Backup_Name.size() > MAX_BACKUP_NAME_LEN)
Backup_Name.resize(MAX_BACKUP_NAME_LEN);
+ // Trailing spaces cause problems on some file systems, so remove them
+ string space_check, space = " ";
+ space_check = Backup_Name.substr(Backup_Name.size() - 1, 1);
+ while (space_check == space) {
+ Backup_Name.resize(Backup_Name.size() - 1);
+ space_check = Backup_Name.substr(Backup_Name.size() - 1, 1);
+ }
DataManager::SetValue(TW_BACKUP_NAME, Backup_Name);
break;
}