From 96af84a4094c2018d35c792e33813c07344f553c Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Mon, 5 Jan 2015 14:58:36 -0600 Subject: Allow flashing of images via the GUI - Use the Images... button in the lower right of the zip install page - Unify image flashing functions between restore and image flash - boot and recovery partitions are flashable by default - use fstab flag flashimg=1 or 0 to override defaults - file system partitions are currently not flashable Change-Id: I822dc446030543c55d2153e219d67a1292374ffc --- gui/action.cpp | 19 ++++ gui/devices/1024x600/res/ui.xml | 1 + gui/devices/1024x768/res/ui.xml | 1 + gui/devices/1080x1920/res/ui.xml | 1 + gui/devices/1200x1920/res/ui.xml | 1 + gui/devices/1280x800/res/ui.xml | 1 + gui/devices/1440x2560/res/ui.xml | 1 + gui/devices/1600x2560/res/ui.xml | 1 + gui/devices/1920x1200/res/ui.xml | 1 + gui/devices/240x240/res/ui.xml | 1 + gui/devices/2560x1600/res/ui.xml | 1 + gui/devices/280x280/res/ui.xml | 1 + gui/devices/320x320/res/ui.xml | 1 + gui/devices/320x480/res/ui.xml | 1 + gui/devices/480x800/res/ui.xml | 1 + gui/devices/480x854/res/ui.xml | 1 + gui/devices/540x960/res/ui.xml | 13 +-- gui/devices/720x1280/res/ui.xml | 1 + gui/devices/800x1280/res/ui.xml | 1 + gui/devices/800x480/res/ui.xml | 1 + gui/devices/landscape/res/landscape.xml | 177 ++++++++++++++++++++++++++++++ gui/devices/portrait/res/portrait.xml | 161 ++++++++++++++++++++++++++++ gui/devices/watch/res/watch.xml | 183 +++++++++++++++++++++++++++++++- gui/objects.hpp | 1 + gui/partitionlist.cpp | 4 + 25 files changed, 565 insertions(+), 11 deletions(-) (limited to 'gui') diff --git a/gui/action.cpp b/gui/action.cpp index 750d73b8d..96f620957 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -201,6 +201,7 @@ GUIAction::GUIAction(xml_node<>* node) mf["decrypt_backup"] = &GUIAction::decrypt_backup; mf["repair"] = &GUIAction::repair; mf["changefilesystem"] = &GUIAction::changefilesystem; + mf["flashimage"] = &GUIAction::flashimage; } // First, get the action @@ -1651,6 +1652,24 @@ int GUIAction::stopmtp(std::string arg) return 0; } +int GUIAction::flashimage(std::string arg) +{ + int op_status = 0; + + operation_start("Flash Image"); + string path, filename, full_filename; + DataManager::GetValue("tw_zip_location", path); + DataManager::GetValue("tw_file", filename); + full_filename = path + "/" + filename; + if (PartitionManager.Flash_Image(full_filename)) + op_status = 0; // success + else + op_status = 1; // fail + + operation_end(op_status); + return 0; +} + int GUIAction::getKeyByName(std::string key) { if (key == "home") return KEY_HOME; diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml index 7b7ad8ce7..1669d4586 100644 --- a/gui/devices/1024x600/res/ui.xml +++ b/gui/devices/1024x600/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml index b5ce1b40b..253ae07e5 100644 --- a/gui/devices/1024x768/res/ui.xml +++ b/gui/devices/1024x768/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml index 1367015bf..ddab4f317 100644 --- a/gui/devices/1080x1920/res/ui.xml +++ b/gui/devices/1080x1920/res/ui.xml @@ -81,6 +81,7 @@ + diff --git a/gui/devices/1200x1920/res/ui.xml b/gui/devices/1200x1920/res/ui.xml index 77af05ba7..c02032fbd 100644 --- a/gui/devices/1200x1920/res/ui.xml +++ b/gui/devices/1200x1920/res/ui.xml @@ -84,6 +84,7 @@ + diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml index 716dadc1e..94d0bf981 100644 --- a/gui/devices/1280x800/res/ui.xml +++ b/gui/devices/1280x800/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/1440x2560/res/ui.xml b/gui/devices/1440x2560/res/ui.xml index 4fc699645..52bf20776 100644 --- a/gui/devices/1440x2560/res/ui.xml +++ b/gui/devices/1440x2560/res/ui.xml @@ -81,6 +81,7 @@ + diff --git a/gui/devices/1600x2560/res/ui.xml b/gui/devices/1600x2560/res/ui.xml index 76217921b..b85803bb3 100644 --- a/gui/devices/1600x2560/res/ui.xml +++ b/gui/devices/1600x2560/res/ui.xml @@ -84,6 +84,7 @@ + diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml index e36d0ae76..4bd85a27a 100644 --- a/gui/devices/1920x1200/res/ui.xml +++ b/gui/devices/1920x1200/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/240x240/res/ui.xml b/gui/devices/240x240/res/ui.xml index d157f85c1..7448ae5ec 100644 --- a/gui/devices/240x240/res/ui.xml +++ b/gui/devices/240x240/res/ui.xml @@ -75,6 +75,7 @@ + diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml index 12a2d5536..6da373e56 100644 --- a/gui/devices/2560x1600/res/ui.xml +++ b/gui/devices/2560x1600/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/280x280/res/ui.xml b/gui/devices/280x280/res/ui.xml index 971e6371f..ae8c27d3f 100644 --- a/gui/devices/280x280/res/ui.xml +++ b/gui/devices/280x280/res/ui.xml @@ -74,6 +74,7 @@ + diff --git a/gui/devices/320x320/res/ui.xml b/gui/devices/320x320/res/ui.xml index 4678e855f..4a03855ef 100644 --- a/gui/devices/320x320/res/ui.xml +++ b/gui/devices/320x320/res/ui.xml @@ -75,6 +75,7 @@ + diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml index dd4cdbc36..70d33e601 100644 --- a/gui/devices/320x480/res/ui.xml +++ b/gui/devices/320x480/res/ui.xml @@ -77,6 +77,7 @@ + diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml index 0e0f65d70..895cfaa48 100644 --- a/gui/devices/480x800/res/ui.xml +++ b/gui/devices/480x800/res/ui.xml @@ -77,6 +77,7 @@ + diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml index 26d8b28d0..dd7efd720 100644 --- a/gui/devices/480x854/res/ui.xml +++ b/gui/devices/480x854/res/ui.xml @@ -76,6 +76,7 @@ + diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml index dc647ce60..eb6d671bc 100644 --- a/gui/devices/540x960/res/ui.xml +++ b/gui/devices/540x960/res/ui.xml @@ -77,6 +77,7 @@ + @@ -311,7 +312,7 @@ - + Name tw_gui_sort_order=1 @@ -319,7 +320,7 @@ - + Date tw_gui_sort_order=2 @@ -327,7 +328,7 @@ - + Size tw_gui_sort_order=3 @@ -341,7 +342,7 @@ - + Name tw_gui_sort_order=-1 @@ -349,7 +350,7 @@ - + Date tw_gui_sort_order=-2 @@ -357,7 +358,7 @@ - + Size tw_gui_sort_order=-3 diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml index 2f1fbc7c5..3020daa4f 100644 --- a/gui/devices/720x1280/res/ui.xml +++ b/gui/devices/720x1280/res/ui.xml @@ -81,6 +81,7 @@ + diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml index 03b6144fc..6f49bf7ff 100644 --- a/gui/devices/800x1280/res/ui.xml +++ b/gui/devices/800x1280/res/ui.xml @@ -78,6 +78,7 @@ + diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml index ed1c84271..b80ed3be1 100644 --- a/gui/devices/800x480/res/ui.xml +++ b/gui/devices/800x480/res/ui.xml @@ -192,6 +192,7 @@ + diff --git a/gui/devices/landscape/res/landscape.xml b/gui/devices/landscape/res/landscape.xml index 8f557aa33..f66eb8bb6 100644 --- a/gui/devices/landscape/res/landscape.xml +++ b/gui/devices/landscape/res/landscape.xml @@ -148,6 +148,17 @@ + + + + + Images... + + + install_image + + + @@ -390,6 +401,172 @@ + + + + + + + Select Image to Flash + + + + + + + + Storage: %tw_storage_display_name% (%tw_storage_free_size% MB) + + tw_back=install_image + selectstorage + + + + + + +
+ + Folders: + + + + + + + + +
+ + + + +
+ + %tw_zip_location% + + + + + + + + + +
+ + + + + + + + Zips... + + + install + + + + + + flashimage_confirm + + + + + install + + + + + main + + + + + + + + + + + +
+ + Select Partition to Flash Image: + + + + + + +
+ + + + + Folder: + + + + + + %tw_zip_location% + + + + + + File to flash: + + + + + + %tw_file% + + + + + + + tw_back=flashimage_confirm + tw_action=flashimage + tw_has_action2=0 + tw_action_text1=Flashing Image... + tw_action_text2= + tw_complete_text1=Image Flashed + action_page + + + + + + + + Swipe to Confirm Flash + + + + + + tw_clear_destination=install_image + clear_vars + + + + + + + tw_clear_destination=main2 + clear_vars + + + + + + tw_operation_state=0 diff --git a/gui/devices/portrait/res/portrait.xml b/gui/devices/portrait/res/portrait.xml index 0642c30b0..b73297411 100644 --- a/gui/devices/portrait/res/portrait.xml +++ b/gui/devices/portrait/res/portrait.xml @@ -133,6 +133,17 @@ + + + + + Images... + + + install_image + + + @@ -403,6 +414,156 @@ + + + + + + + Select Image to Install + + + + + + + + Storage: %tw_storage_display_name% (%tw_storage_free_size% MB) + + tw_back=install_image + selectstorage + + + + + + +
+ + %tw_zip_location% + + + + + + + + + +
+ + + + + + + + Zips... + + + install + + + + + + flashimage_confirm + + + + + install + + + + + main + + + + + + + + + + + +
+ + Select Partition to Flash Image: + + + + + + +
+ + + + + Folder: + + + + + + %tw_zip_location% + + + + + + File to flash: + + + + + + %tw_file% + + + + + + + tw_back=flashimage_confirm + tw_action=flashimage + tw_has_action2=0 + tw_action_text1=Flashing Image... + tw_action_text2= + tw_complete_text1=Image Flashed + action_page + + + + + + + + Swipe to Confirm Flash + + + + + + tw_clear_destination=install_image + clear_vars + + + + + + + tw_clear_destination=main2 + clear_vars + + + + + + tw_operation_state=0 diff --git a/gui/devices/watch/res/watch.xml b/gui/devices/watch/res/watch.xml index 38de230c4..03effde31 100644 --- a/gui/devices/watch/res/watch.xml +++ b/gui/devices/watch/res/watch.xml @@ -22,10 +22,7 @@ Install - - - install - + install_select @@ -95,6 +92,45 @@ + + + + + + + + + + Install Zips + + + + install + + + + + + + + Install Images + + install_image + + + + + main + + + + + main + + + + + @@ -145,7 +181,7 @@ - main + install_select @@ -385,6 +421,143 @@ + + + + + + + Select Image to Install + + + + + + + + Storage: %tw_storage_display_name% (%tw_storage_free_size% MB) + + tw_back=install_image + selectstorage + + + + + + +
+ + %tw_zip_location% + + + + + + + + + +
+ + + + + + flashimage_confirm + + + + + install_select + + + + + main + + + + + + + + + + + +
+ + Select Partition to Flash Image: + + + + + + +
+ + + + + Folder: + + + + + + %tw_zip_location% + + + + + + File to flash: + + + + + + %tw_file% + + + + + + + tw_back=flashimage_confirm + tw_action=flashimage + tw_has_action2=0 + tw_action_text1=Flashing Image... + tw_action_text2= + tw_complete_text1=Image Flashed + action_page + + + + + + + + Swipe to Confirm Flash + + + + + + tw_clear_destination=install_image + clear_vars + + + + + + + tw_clear_destination=main2 + clear_vars + + + + tw_operation_state=0 diff --git a/gui/objects.hpp b/gui/objects.hpp index 76dbb4625..bb3edb398 100644 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -352,6 +352,7 @@ protected: int changefilesystem(std::string arg); int startmtp(std::string arg); int stopmtp(std::string arg); + int flashimage(std::string arg); int simulate; }; diff --git a/gui/partitionlist.cpp b/gui/partitionlist.cpp index 9cc6a777b..3ec15488a 100644 --- a/gui/partitionlist.cpp +++ b/gui/partitionlist.cpp @@ -793,6 +793,10 @@ int GUIPartitionList::NotifyTouch(TOUCH_STATE state, int x, int y) DataManager::SetValue(mVariable, str); } } else { + if (ListType == "flashimg") { // only one item can be selected for flashing images + for (int i=0; i