summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/action.cpp27
-rw-r--r--gui/devices/landscape/res/landscape.xml19
-rw-r--r--gui/devices/portrait/res/portrait.xml19
-rw-r--r--gui/devices/watch/res/watch.xml19
-rw-r--r--gui/objects.hpp1
5 files changed, 85 insertions, 0 deletions
diff --git a/gui/action.cpp b/gui/action.cpp
index 7ecd0b46a..fc3973738 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -223,6 +223,7 @@ GUIAction::GUIAction(xml_node<>* node)
ADD_ACTION(installsu);
ADD_ACTION(decrypt_backup);
ADD_ACTION(repair);
+ ADD_ACTION(resize);
ADD_ACTION(changefilesystem);
ADD_ACTION(flashimage);
}
@@ -872,6 +873,10 @@ int GUIAction::getpartitiondetails(std::string arg)
DataManager::SetValue("tw_partition_can_repair", 1);
else
DataManager::SetValue("tw_partition_can_repair", 0);
+ if (Part->Can_Resize())
+ DataManager::SetValue("tw_partition_can_resize", 1);
+ else
+ DataManager::SetValue("tw_partition_can_resize", 0);
if (TWFunc::Path_Exists("/sbin/mkdosfs"))
DataManager::SetValue("tw_partition_vfat", 1);
else
@@ -1651,6 +1656,28 @@ int GUIAction::repair(std::string arg)
return 0;
}
+int GUIAction::resize(std::string arg)
+{
+ int op_status = 0;
+
+ operation_start("Resize Partition");
+ if (simulate) {
+ simulate_progress_bar();
+ } else {
+ string part_path;
+ DataManager::GetValue("tw_partition_mount_point", part_path);
+ if (PartitionManager.Resize_By_Path(part_path, true)) {
+ op_status = 0; // success
+ } else {
+ LOGERR("Error resizing file system.\n");
+ op_status = 1; // fail
+ }
+ }
+
+ operation_end(op_status);
+ return 0;
+}
+
int GUIAction::changefilesystem(std::string arg)
{
int op_status = 0;
diff --git a/gui/devices/landscape/res/landscape.xml b/gui/devices/landscape/res/landscape.xml
index 12c66290b..529aef79c 100644
--- a/gui/devices/landscape/res/landscape.xml
+++ b/gui/devices/landscape/res/landscape.xml
@@ -1381,6 +1381,25 @@
</object>
<object type="button">
+ <condition var1="tw_partition_can_resize" op="=" var2="1" />
+ <placement x="%col1_x%" y="%row2_y%" />
+ <text>Resize</text>
+ <actions>
+ <action function="set">tw_back=partitionoptions</action>
+ <action function="set">tw_action=resize</action>
+ <action function="set">tw_action_param=%tw_partition_mount_point%</action>
+ <action function="set">tw_has_action2=1</action>
+ <action function="set">tw_action2=getpartitiondetails</action>
+ <action function="set">tw_text1=Resize %tw_partition_name%?</action>
+ <action function="set">tw_text2=</action>
+ <action function="set">tw_action_text1=Resizing...</action>
+ <action function="set">tw_complete_text1=Resize Complete</action>
+ <action function="set">tw_slider_text=Swipe to Resize</action>
+ <action function="page">confirm_action</action>
+ </actions>
+ </object>
+
+ <object type="button">
<condition var1="tw_partition_can_repair" op="=" var2="1" />
<placement x="%col2_x%" y="%row2_y%" />
<text>Repair</text>
diff --git a/gui/devices/portrait/res/portrait.xml b/gui/devices/portrait/res/portrait.xml
index 997da9d23..9ffd6e44e 100644
--- a/gui/devices/portrait/res/portrait.xml
+++ b/gui/devices/portrait/res/portrait.xml
@@ -1118,6 +1118,25 @@
</object>
<object type="button">
+ <condition var1="tw_partition_can_resize" op="=" var2="1" />
+ <placement x="%col1_x%" y="%row3_y%" />
+ <text>Resize</text>
+ <actions>
+ <action function="set">tw_back=partitionoptions</action>
+ <action function="set">tw_action=resize</action>
+ <action function="set">tw_action_param=%tw_partition_mount_point%</action>
+ <action function="set">tw_has_action2=1</action>
+ <action function="set">tw_action2=getpartitiondetails</action>
+ <action function="set">tw_text1=Resize %tw_partition_name%?</action>
+ <action function="set">tw_text2=</action>
+ <action function="set">tw_action_text1=Resizing...</action>
+ <action function="set">tw_complete_text1=Resize Complete</action>
+ <action function="set">tw_slider_text=Swipe to Resize</action>
+ <action function="page">confirm_action</action>
+ </actions>
+ </object>
+
+ <object type="button">
<condition var1="tw_partition_can_repair" op="=" var2="1" />
<placement x="%col1_x%" y="%row4_y%" />
<text>Repair</text>
diff --git a/gui/devices/watch/res/watch.xml b/gui/devices/watch/res/watch.xml
index f0f383dcb..a8535c659 100644
--- a/gui/devices/watch/res/watch.xml
+++ b/gui/devices/watch/res/watch.xml
@@ -1096,6 +1096,25 @@
</object>
<object type="button">
+ <condition var1="tw_partition_can_resize" op="=" var2="1" />
+ <placement x="%col1_x%" y="%row3_y%" />
+ <text>Resize</text>
+ <actions>
+ <action function="set">tw_back=partitionoptions</action>
+ <action function="set">tw_action=resize</action>
+ <action function="set">tw_action_param=%tw_partition_mount_point%</action>
+ <action function="set">tw_has_action2=1</action>
+ <action function="set">tw_action2=getpartitiondetails</action>
+ <action function="set">tw_text1=Resize %tw_partition_name%?</action>
+ <action function="set">tw_text2=</action>
+ <action function="set">tw_action_text1=Resizing...</action>
+ <action function="set">tw_complete_text1=Resize Complete</action>
+ <action function="set">tw_slider_text=Swipe to Resize</action>
+ <action function="page">confirm_action</action>
+ </actions>
+ </object>
+
+ <object type="button">
<condition var1="tw_partition_can_repair" op="=" var2="1" />
<placement x="%col1_x%" y="%row4_y%" />
<text>Repair</text>
diff --git a/gui/objects.hpp b/gui/objects.hpp
index ee0f08b8f..1991877ee 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -354,6 +354,7 @@ protected:
int fixsu(std::string arg);
int decrypt_backup(std::string arg);
int repair(std::string arg);
+ int resize(std::string arg);
int changefilesystem(std::string arg);
int startmtp(std::string arg);
int stopmtp(std::string arg);