diff options
Diffstat (limited to 'gui')
25 files changed, 591 insertions, 34 deletions
diff --git a/gui/action.cpp b/gui/action.cpp index d54ea0a03..953439906 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -98,18 +98,18 @@ ActionThread::~ActionThread() pthread_mutex_destroy(&m_act_lock); } -void ActionThread::threadActions(GUIAction *act, size_t start_index) +void ActionThread::threadActions(GUIAction *act) { pthread_mutex_lock(&m_act_lock); if (m_thread_running) { pthread_mutex_unlock(&m_act_lock); - LOGERR("Another threaded action is already running -- not running actions '%s' and following\n", act->mActions[start_index].mFunction.c_str()); + LOGERR("Another threaded action is already running -- not running %u actions starting with '%s'\n", + act->mActions.size(), act->mActions[0].mFunction.c_str()); } else { m_thread_running = true; pthread_mutex_unlock(&m_act_lock); ThreadData *d = new ThreadData; d->act = act; - d->start_index = start_index; pthread_create(&m_thread, NULL, &ActionThread_work_wrapper, d); } @@ -121,7 +121,7 @@ void ActionThread::run(void *data) GUIAction* act = d->act; std::vector<GUIAction::Action>::iterator it; - for (it = act->mActions.begin() + d->start_index; it != act->mActions.end(); ++it) + for (it = act->mActions.begin(); it != act->mActions.end(); ++it) act->doAction(*it); pthread_mutex_lock(&m_act_lock); @@ -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 @@ -324,7 +325,7 @@ void GUIAction::simulate_progress_bar(void) } } -int GUIAction::flash_zip(std::string filename, std::string pageName, int* wipe_cache) +int GUIAction::flash_zip(std::string filename, int* wipe_cache) { int ret_val = 0; @@ -336,15 +337,9 @@ int GUIAction::flash_zip(std::string filename, std::string pageName, int* wipe_c return -1; } - // We're going to jump to this page first, like a loading page - gui_changePage(pageName); - if (!PartitionManager.Mount_By_Path(filename, true)) return -1; - // TODO: why again? - gui_changePage(pageName); - if (simulate) { simulate_progress_bar(); } else { @@ -380,18 +375,24 @@ int GUIAction::doActions() if (mActions.size() < 1) return -1; + bool needThread = false; std::vector<Action>::iterator it; for (it = mActions.begin(); it != mActions.end(); ++it) { if (needsToRunInSeparateThread(*it)) { - // run all remaining actions in a separate thread - action_thread.threadActions(this, it - mActions.begin()); - // ...and we're done here + needThread = true; break; } - - doAction(*it); + } + if (needThread) + { + action_thread.threadActions(this); + } + else + { + for (it = mActions.begin(); it != mActions.end(); ++it) + doAction(*it); } return 0; @@ -937,29 +938,33 @@ void GUIAction::reinject_after_flash() int GUIAction::flash(std::string arg) { int i, ret_val = 0, wipe_cache = 0; + // We're going to jump to this page first, like a loading page + gui_changePage(arg); for (i=0; i<zip_queue_index; i++) { operation_start("Flashing"); DataManager::SetValue("tw_filename", zip_queue[i]); DataManager::SetValue(TW_ZIP_INDEX, (i + 1)); TWFunc::SetPerformanceMode(true); - ret_val = flash_zip(zip_queue[i], arg, &wipe_cache); + ret_val = flash_zip(zip_queue[i], &wipe_cache); TWFunc::SetPerformanceMode(false); if (ret_val != 0) { gui_print("Error flashing zip '%s'\n", zip_queue[i].c_str()); - i = 10; // Error flashing zip - exit queue ret_val = 1; + break; } } zip_queue_index = 0; - DataManager::SetValue(TW_ZIP_QUEUE_COUNT, zip_queue_index); - if (wipe_cache) + if (wipe_cache) { + gui_print("One or more zip requested a cache wipe\nWiping cache now.\n"); PartitionManager.Wipe_By_Path("/cache"); + } reinject_after_flash(); PartitionManager.Update_System_Details(); operation_end(ret_val); + DataManager::SetValue(TW_ZIP_QUEUE_COUNT, zip_queue_index); return 0; } @@ -1645,6 +1650,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 @@ <variable name="button_fill_half_height" value="50" /> <variable name="button_fill_quarter_height" value="30" /> <variable name="button_full_center_x" value="256" /> + <variable name="flash_list_height" value="200" /> <variable name="backup_list_x" value="23" /> <variable name="backup_list_y" value="105" /> <variable name="backup_list_width" value="486" /> 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 @@ <variable name="button_fill_half_height" value="50" /> <variable name="button_fill_quarter_height" value="30" /> <variable name="button_full_center_x" value="256" /> + <variable name="flash_list_height" value="200" /> <variable name="backup_list_x" value="23" /> <variable name="backup_list_y" value="105" /> <variable name="backup_list_width" value="486" /> 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 @@ <variable name="row17_text_y" value="1455" /> <variable name="row18_text_y" value="1530" /> <variable name="zip_status_y" value="922" /> + <variable name="flash_list_height" value="500" /> <variable name="tz_selected_y" value="240" /> <variable name="tz_set_y" value="1500" /> <variable name="tz_current_y" value="1425" /> 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 @@ <variable name="row17_text_y" value="1455" /> <variable name="row18_text_y" value="1530" /> <variable name="zip_status_y" value="922" /> + <variable name="flash_list_height" value="500" /> <variable name="tz_selected_y" value="240" /> <variable name="tz_set_y" value="1500" /> <variable name="tz_current_y" value="1425" /> 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 @@ <variable name="button_fill_half_height" value="53" /> <variable name="button_fill_quarter_height" value="40" /> <variable name="button_full_center_x" value="320" /> + <variable name="flash_list_height" value="220" /> <variable name="backup_list_x" value="28" /> <variable name="backup_list_y" value="105" /> <variable name="backup_list_width" value="609" /> 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 @@ <variable name="row17_text_y" value="1935" /> <variable name="row18_text_y" value="2035" /> <variable name="zip_status_y" value="1375" /> + <variable name="flash_list_height" value="650" /> <variable name="tz_selected_y" value="319" /> <variable name="tz_set_y" value="1995" /> <variable name="tz_current_y" value="1895" /> 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 @@ <variable name="row17_text_y" value="1935" /> <variable name="row18_text_y" value="2035" /> <variable name="zip_status_y" value="1250" /> + <variable name="flash_list_height" value="650" /> <variable name="tz_selected_y" value="319" /> <variable name="tz_set_y" value="1995" /> <variable name="tz_current_y" value="1895" /> 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 @@ <variable name="button_fill_half_height" value="80" /> <variable name="button_fill_quarter_height" value="60" /> <variable name="button_full_center_x" value="480" /> + <variable name="flash_list_height" value="300" /> <variable name="backup_list_x" value="50" /> <variable name="backup_list_y" value="160" /> <variable name="backup_list_width" value="900" /> diff --git a/gui/devices/240x240/res/ui.xml b/gui/devices/240x240/res/ui.xml index 889366966..f1cd46110 100644 --- a/gui/devices/240x240/res/ui.xml +++ b/gui/devices/240x240/res/ui.xml @@ -75,6 +75,7 @@ <variable name="row12_text_y" value="192" /> <variable name="row13_text_y" value="208" /> <variable name="zip_status_y" value="224" /> + <variable name="flash_list_height" value="120" /> <variable name="backup_text_y" value="60" /> <variable name="tz_set_y" value="200" /> <variable name="tz_current_y" value="184" /> 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 @@ <variable name="button_fill_half_height" value="107" /> <variable name="button_fill_quarter_height" value="80" /> <variable name="button_full_center_x" value="640" /> + <variable name="flash_list_height" value="450" /> <variable name="backup_list_x" value="50" /> <variable name="backup_list_y" value="210" /> <variable name="backup_list_width" value="1200" /> diff --git a/gui/devices/280x280/res/ui.xml b/gui/devices/280x280/res/ui.xml index d8fec3bcc..24e6e4ce5 100644 --- a/gui/devices/280x280/res/ui.xml +++ b/gui/devices/280x280/res/ui.xml @@ -74,6 +74,7 @@ <variable name="row11_text_y" value="209" /> <variable name="row12_text_y" value="228" /> <variable name="row13_text_y" value="237" /> + <variable name="flash_list_height" value="140" /> <variable name="zip_status_y" value="265" /> <variable name="backup_text_y" value="50" /> <variable name="col_progressbar_x" value="31" /> diff --git a/gui/devices/320x320/res/ui.xml b/gui/devices/320x320/res/ui.xml index ee6a731a4..6558d0b23 100644 --- a/gui/devices/320x320/res/ui.xml +++ b/gui/devices/320x320/res/ui.xml @@ -75,6 +75,7 @@ <variable name="row12_text_y" value="284" /> <variable name="row13_text_y" value="306" /> <variable name="zip_status_y" value="300" /> + <variable name="flash_list_height" value="160" /> <variable name="backup_text_y" value="60" /> <variable name="col_progressbar_x" value="34" /> <variable name="row_progressbar_y" value="285" /> 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 @@ <variable name="row17_text_y" value="389" /> <variable name="row18_text_y" value="408" /> <variable name="zip_status_y" value="350" /> + <variable name="flash_list_height" value="150" /> <variable name="tz_selected_y" value="66" /> <variable name="tz_set_y" value="348" /> <variable name="tz_current_y" value="438" /> 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 @@ <variable name="row17_text_y" value="620" /> <variable name="row18_text_y" value="650" /> <variable name="zip_status_y" value="585" /> + <variable name="flash_list_height" value="210" /> <variable name="tz_selected_y" value="110" /> <variable name="tz_set_y" value="580" /> <variable name="tz_current_y" value="730" /> 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 @@ <variable name="row17_text_y" value="630" /> <variable name="row18_text_y" value="660" /> <variable name="zip_status_y" value="585" /> + <variable name="flash_list_height" value="210" /> <variable name="tz_selected_y" value="110" /> <variable name="tz_set_y" value="580" /> <variable name="tz_current_y" value="730" /> 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 @@ <variable name="row17_text_y" value="780" /> <variable name="row18_text_y" value="820" /> <variable name="zip_status_y" value="696" /> + <variable name="flash_list_height" value="260" /> <variable name="tz_selected_y" value="110" /> <variable name="tz_set_y" value="720" /> <variable name="tz_current_y" value="895" /> @@ -311,7 +312,7 @@ <object type="button"> <placement x="%sort_col1_button_x%" y="%sort_asc_button_y%" /> - <font resource="UItext" color="%button_text_color%" /> + <font resource="mediumfont" color="%button_text_color%" /> <text>Name</text> <image resource="sort_button" /> <action function="set">tw_gui_sort_order=1</action> @@ -319,7 +320,7 @@ <object type="button"> <placement x="%sort_col2_button_x%" y="%sort_asc_button_y%" /> - <font resource="UItext" color="%button_text_color%" /> + <font resource="mediumfont" color="%button_text_color%" /> <text>Date</text> <image resource="sort_button" /> <action function="set">tw_gui_sort_order=2</action> @@ -327,7 +328,7 @@ <object type="button"> <placement x="%sort_col3_button_x%" y="%sort_asc_button_y%" /> - <font resource="UItext" color="%button_text_color%" /> + <font resource="mediumfont" color="%button_text_color%" /> <text>Size</text> <image resource="sort_button" /> <action function="set">tw_gui_sort_order=3</action> @@ -341,7 +342,7 @@ <object type="button"> <placement x="%sort_col1_button_x%" y="%sort_desc_button_y%" /> - <font resource="UItext" color="%button_text_color%" /> + <font resource="mediumfont" color="%button_text_color%" /> <text>Name</text> <image resource="sort_button" /> <action function="set">tw_gui_sort_order=-1</action> @@ -349,7 +350,7 @@ <object type="button"> <placement x="%sort_col2_button_x%" y="%sort_desc_button_y%" /> - <font resource="UItext" color="%button_text_color%" /> + <font resource="mediumfont" color="%button_text_color%" /> <text>Date</text> <image resource="sort_button" /> <action function="set">tw_gui_sort_order=-2</action> @@ -357,7 +358,7 @@ <object type="button"> <placement x="%sort_col3_button_x%" y="%sort_desc_button_y%" /> - <font resource="UItext" color="%button_text_color%" /> + <font resource="mediumfont" color="%button_text_color%" /> <text>Size</text> <image resource="sort_button" /> <action function="set">tw_gui_sort_order=-3</action> 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 @@ <variable name="row17_text_y" value="970" /> <variable name="row18_text_y" value="1020" /> <variable name="zip_status_y" value="615" /> + <variable name="flash_list_height" value="330" /> <variable name="tz_selected_y" value="160" /> <variable name="tz_set_y" value="950" /> <variable name="tz_current_y" value="1180" /> 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 @@ <variable name="row17_text_y" value="%row16_text_y%+%text_row_height%" /> <variable name="row18_text_y" value="%row17_text_y%+%text_row_height%" /> <variable name="zip_status_y" value="640" /> + <variable name="flash_list_height" value="330" /> <variable name="tz_selected_y" value="160" /> <variable name="tz_set_y" value="955" /> <variable name="tz_current_y" value="1185" /> 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 @@ <variable name="button_fill_half_height" value="40" /> <variable name="button_fill_quarter_height" value="30" /> <variable name="button_full_center_x" value="200" /> + <variable name="flash_list_height" value="140" /> <variable name="backup_list_x" value="23" /> <variable name="backup_list_y" value="80" /> <variable name="backup_list_width" value="367" /> 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 @@ <object type="template" name="sort_options" /> + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%filemanager_select_x%" y="%filemanager_select_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Images...</text> + <image resource="main_button" /> + <actions> + <action function="page">install_image</action> + </actions> + </object> + <object type="action"> <condition var1="tw_filename" op="modified" /> <actions> @@ -390,6 +401,172 @@ </object> </page> + <page name="install_image"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_text_y%" placement="5" /> + <text>Select Image to Flash</text> + </object> + + <object type="button"> + <highlight color="%highlight_color%" /> + <fill color="%button_fill_color%" /> + <placement x="%button_full_center_x%" y="%zipstorage_text_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" /> + <font resource="font" color="%button_text_color%" /> + <text>Storage: %tw_storage_display_name% (%tw_storage_free_size% MB)</text> + <actions> + <action function="set">tw_back=install_image</action> + <action function="page">selectstorage</action> + </actions> + </object> + + <object type="fileselector"> + <highlight color="%fileselector_highlight_color%" /> + <placement x="%fileselector_folder_x%" y="%fileselector_install_y%" w="%fileselector_folder_width%" h="%fileselector_install_height%" /> + <header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" /> + <fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" /> + <text>Folders:</text> + <separator color="%fileselector_separatorcolor%" height="%fileselector_separatorheight%" /> + <sort name="tw_gui_sort_order" /> + <icon folder="folder_icon" file="file_icon" /> + <background color="%fileselector_background%" /> + <font resource="font" spacing="%fileselector_spacing%" color="%text_color%" highlightcolor="%fileselector_highlight_font_color%" /> + <filter folders="1" files="0" /> + <path name="tw_zip_location" default="/sdcard" /> + <data name="select" /> + </object> + + <object type="fileselector"> + <highlight color="%fileselector_highlight_color%" /> + <placement x="%fileselector_file_x%" y="%fileselector_install_y%" w="%fileselector_file_width%" h="%fileselector_install_height%" /> + <header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" /> + <fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" /> + <text>%tw_zip_location%</text> + <separator color="%fileselector_separatorcolor%" height="%fileselector_separatorheight%" /> + <sort name="tw_gui_sort_order" /> + <icon folder="folder_icon" file="file_icon" /> + <background color="%fileselector_background%" /> + <font resource="font" spacing="%fileselector_spacing%" color="%text_color%" highlightcolor="%fileselector_highlight_font_color%" /> + <filter extn=".img" folders="0" files="1" /> + <path name="tw_zip_location" /> + <data name="tw_filename" /> + <selection name="tw_file" /> + </object> + + <object type="template" name="sort_options" /> + + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%filemanager_select_x%" y="%filemanager_select_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Zips...</text> + <image resource="main_button" /> + <actions> + <action function="page">install</action> + </actions> + </object> + + <object type="action"> + <condition var1="tw_filename" op="modified" /> + <action function="page">flashimage_confirm</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">install</action> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="template" name="footer" /> + </page> + + <page name="flashimage_confirm"> + <object type="template" name="header" /> + + <object type="partitionlist"> + <highlight color="%fileselector_highlight_color%" /> + <placement x="%col2_x%" y="%row1_text_y%" w="%listbox_width%" h="%flash_list_height%" /> + <header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" /> + <fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" /> + <text>Select Partition to Flash Image:</text> + <icon selected="radio_true" unselected="radio_false" /> + <separator color="%fileselector_separatorcolor%" height="%fileselector_separatorheight%" /> + <background color="%listbox_background%" /> + <font resource="font" spacing="%fileselector_spacing%" color="%text_color%" highlightcolor="%fileselector_highlight_font_color%" /> + <data name="tw_flash_partition" /> + <listtype name="flashimg" /> + </object> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row8_text_y%" placement="5" /> + <text>Folder:</text> + </object> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row9_text_y%" placement="5" /> + <text>%tw_zip_location%</text> + </object> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row10_text_y%" placement="5" /> + <text>File to flash:</text> + </object> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row11_text_y%" placement="5" /> + <text>%tw_file%</text> + </object> + + <object type="slider"> + <placement x="%slider_x%" y="%slider_y%" placement="5" /> + <resource base="slider" used="slider-used" touch="slider-touch" /> + <actions> + <action function="set">tw_back=flashimage_confirm</action> + <action function="set">tw_action=flashimage</action> + <action function="set">tw_has_action2=0</action> + <action function="set">tw_action_text1=Flashing Image...</action> + <action function="set">tw_action_text2=</action> + <action function="set">tw_complete_text1=Image Flashed</action> + <action function="page">action_page</action> + </actions> + <action function="flashimage"></action> + </object> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%slider_text_y%" placement="4" /> + <text>Swipe to Confirm Flash</text> + </object> + + <object type="action"> + <touch key="back" /> + <actions> + <action function="set">tw_clear_destination=install_image</action> + <action function="page">clear_vars</action> + </actions> + </object> + + <object type="action"> + <touch key="home" /> + <actions> + <action function="set">tw_clear_destination=main2</action> + <action function="page">clear_vars</action> + </actions> + </object> + + <object type="template" name="footer" /> + </page> + <page name="clear_vars"> <object type="action"> <action function="set">tw_operation_state=0</action> 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 @@ <object type="template" name="sort_options" /> + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%filemanager_select_x%" y="%filemanager_select_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Images...</text> + <image resource="medium_button" /> + <actions> + <action function="page">install_image</action> + </actions> + </object> + <object type="action"> <condition var1="tw_filename" op="modified" /> <actions> @@ -403,6 +414,156 @@ </object> </page> + <page name="install_image"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_header_y%" placement="5" /> + <text>Select Image to Install</text> + </object> + + <object type="button"> + <highlight color="%highlight_color%" /> + <fill color="%button_fill_color%" /> + <placement x="%col1_x%" y="%row1_text_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" /> + <font resource="font" color="%button_text_color%" /> + <text>Storage: %tw_storage_display_name% (%tw_storage_free_size% MB)</text> + <actions> + <action function="set">tw_back=install_image</action> + <action function="page">selectstorage</action> + </actions> + </object> + + <object type="fileselector"> + <highlight color="%fileselector_highlight_color%" /> + <placement x="%fileselector_x%" y="%row3_text_y%" w="%fileselector_width%" h="%fileselector_install_height%" /> + <header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" /> + <fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" /> + <text>%tw_zip_location%</text> + <separator color="%fileselector_separatorcolor%" height="%fileselector_separatorheight%" /> + <sort name="tw_gui_sort_order" /> + <icon folder="folder_icon" file="file_icon" /> + <background color="%fileselector_background%" /> + <font resource="filelist" spacing="%fileselector_spacing%" color="%text_color%" highlightcolor="%fileselector_highlight_font_color%" /> + <filter extn=".img" folders="1" files="1" /> + <path name="tw_zip_location" default="/sdcard" /> + <data name="tw_filename" /> + <selection name="tw_file" /> + </object> + + <object type="template" name="sort_options" /> + + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%filemanager_select_x%" y="%filemanager_select_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Zips...</text> + <image resource="medium_button" /> + <actions> + <action function="page">install</action> + </actions> + </object> + + <object type="action"> + <condition var1="tw_filename" op="modified" /> + <action function="page">flashimage_confirm</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">install</action> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="template" name="footer" /> + </page> + + <page name="flashimage_confirm"> + <object type="template" name="header" /> + + <object type="partitionlist"> + <highlight color="%fileselector_highlight_color%" /> + <placement x="%listbox_x%" y="%row1_header_y%" w="%listbox_width%" h="%flash_list_height%" /> + <header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" /> + <fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" /> + <text>Select Partition to Flash Image:</text> + <icon selected="radio_true" unselected="radio_false" /> + <separator color="%fileselector_separatorcolor%" height="%fileselector_separatorheight%" /> + <background color="%listbox_background%" /> + <font resource="filelist" spacing="%fileselector_spacing%" color="%text_color%" highlightcolor="%fileselector_highlight_font_color%" /> + <data name="tw_flash_partition" /> + <listtype name="flashimg" /> + </object> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row8_text_y%" placement="5" /> + <text>Folder:</text> + </object> + + <object type="text" color="%text_color%"> + <font resource="mediumfont" /> + <placement x="%center_x%" y="%row9_text_y%" placement="5" /> + <text>%tw_zip_location%</text> + </object> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row10_text_y%" placement="5" /> + <text>File to flash:</text> + </object> + + <object type="text" color="%text_color%"> + <font resource="mediumfont" /> + <placement x="%center_x%" y="%row11_text_y%" placement="5" /> + <text>%tw_file%</text> + </object> + + <object type="slider"> + <placement x="%slider_x%" y="%slider_y%" placement="5" /> + <resource base="slider" used="slider-used" touch="slider-touch" /> + <actions> + <action function="set">tw_back=flashimage_confirm</action> + <action function="set">tw_action=flashimage</action> + <action function="set">tw_has_action2=0</action> + <action function="set">tw_action_text1=Flashing Image...</action> + <action function="set">tw_action_text2=</action> + <action function="set">tw_complete_text1=Image Flashed</action> + <action function="page">action_page</action> + </actions> + <action function="flashimage"></action> + </object> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%slider_text_y%" placement="4" /> + <text>Swipe to Confirm Flash</text> + </object> + + <object type="action"> + <touch key="back" /> + <actions> + <action function="set">tw_clear_destination=install_image</action> + <action function="page">clear_vars</action> + </actions> + </object> + + <object type="action"> + <touch key="home" /> + <actions> + <action function="set">tw_clear_destination=main2</action> + <action function="page">clear_vars</action> + </actions> + </object> + + <object type="template" name="footer" /> + </page> + <page name="clear_vars"> <object type="action"> <action function="set">tw_operation_state=0</action> 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 @@ <font resource="font" color="%button_text_color%" /> <text>Install</text> <image resource="main_button" /> - <actions> - <action function="queueclear"></action> - <action function="page">install</action> - </actions> + <action function="page">install_select</action> </object> <object type="button"> @@ -95,6 +92,45 @@ <object type="template" name="footer" /> </page> + <page name="install_select"> + <object type="template" name="twrpheader" /> + + <object type="template" name="header" /> + + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%col1_x%" y="%row1_home_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Install Zips</text> + <image resource="main_button" /> + <actions> + <action function="queueclear"></action> + <action function="page">install</action> + </actions> + </object> + + <object type="button"> + <highlight color="%highlight_color%" /> + <placement x="%col2_x%" y="%row1_home_y%" /> + <font resource="font" color="%button_text_color%" /> + <text>Install Images</text> + <image resource="main_button" /> + <action function="page">install_image</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">main</action> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="template" name="footer" /> + </page> + <page name="install"> <object type="template" name="header" /> @@ -145,7 +181,7 @@ <object type="action"> <touch key="back" /> - <action function="page">main</action> + <action function="page">install_select</action> </object> <object type="action"> @@ -385,6 +421,143 @@ </object> </page> + <page name="install_image"> + <object type="template" name="header" /> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row1_header_y%" placement="5" /> + <text>Select Image to Install</text> + </object> + + <object type="button"> + <highlight color="%highlight_color%" /> + <fill color="%button_fill_color%" /> + <placement x="%col1_x%" y="%row1_text_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" /> + <font resource="font" color="%button_text_color%" /> + <text>Storage: %tw_storage_display_name% (%tw_storage_free_size% MB)</text> + <actions> + <action function="set">tw_back=install_image</action> + <action function="page">selectstorage</action> + </actions> + </object> + + <object type="fileselector"> + <highlight color="%fileselector_highlight_color%" /> + <placement x="%fileselector_x%" y="%row3_text_y%" w="%fileselector_width%" h="%fileselector_install_height%" /> + <header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" /> + <fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" /> + <text>%tw_zip_location%</text> + <separator color="%fileselector_separatorcolor%" height="%fileselector_separatorheight%" /> + <sort name="tw_gui_sort_order" /> + <icon folder="folder_icon" file="file_icon" /> + <background color="%fileselector_background%" /> + <font resource="filelist" spacing="%fileselector_spacing%" color="%text_color%" highlightcolor="%fileselector_highlight_font_color%" /> + <filter extn=".img" folders="1" files="1" /> + <path name="tw_zip_location" default="/sdcard" /> + <data name="tw_filename" /> + <selection name="tw_file" /> + </object> + + <object type="template" name="sort_options" /> + + <object type="action"> + <condition var1="tw_filename" op="modified" /> + <action function="page">flashimage_confirm</action> + </object> + + <object type="action"> + <touch key="back" /> + <action function="page">install_select</action> + </object> + + <object type="action"> + <touch key="home" /> + <action function="page">main</action> + </object> + + <object type="template" name="footer" /> + </page> + + <page name="flashimage_confirm"> + <object type="template" name="header" /> + + <object type="partitionlist"> + <highlight color="%fileselector_highlight_color%" /> + <placement x="%listbox_x%" y="%row1_header_y%" w="%listbox_width%" h="%flash_list_height%" /> + <header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" /> + <fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" /> + <text>Select Partition to Flash Image:</text> + <icon selected="radio_true" unselected="radio_false" /> + <separator color="%fileselector_separatorcolor%" height="%fileselector_separatorheight%" /> + <background color="%listbox_background%" /> + <font resource="filelist" spacing="%fileselector_spacing%" color="%text_color%" highlightcolor="%fileselector_highlight_font_color%" /> + <data name="tw_flash_partition" /> + <listtype name="flashimg" /> + </object> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row8_text_y%" placement="5" /> + <text>Folder:</text> + </object> + + <object type="text" color="%text_color%"> + <font resource="mediumfont" /> + <placement x="%center_x%" y="%row9_text_y%" placement="5" /> + <text>%tw_zip_location%</text> + </object> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%row10_text_y%" placement="5" /> + <text>File to flash:</text> + </object> + + <object type="text" color="%text_color%"> + <font resource="mediumfont" /> + <placement x="%center_x%" y="%row11_text_y%" placement="5" /> + <text>%tw_file%</text> + </object> + + <object type="slider"> + <placement x="%slider_x%" y="%slider_y%" placement="5" /> + <resource base="slider" used="slider-used" touch="slider-touch" /> + <actions> + <action function="set">tw_back=flashimage_confirm</action> + <action function="set">tw_action=flashimage</action> + <action function="set">tw_has_action2=0</action> + <action function="set">tw_action_text1=Flashing Image...</action> + <action function="set">tw_action_text2=</action> + <action function="set">tw_complete_text1=Image Flashed</action> + <action function="page">action_page</action> + </actions> + <action function="flashimage"></action> + </object> + + <object type="text" color="%text_color%"> + <font resource="font" /> + <placement x="%center_x%" y="%slider_text_y%" placement="4" /> + <text>Swipe to Confirm Flash</text> + </object> + + <object type="action"> + <touch key="back" /> + <actions> + <action function="set">tw_clear_destination=install_image</action> + <action function="page">clear_vars</action> + </actions> + </object> + + <object type="action"> + <touch key="home" /> + <actions> + <action function="set">tw_clear_destination=main2</action> + <action function="page">clear_vars</action> + </actions> + </object> + </page> + <page name="clear_vars"> <object type="action"> <action function="set">tw_operation_state=0</action> diff --git a/gui/objects.hpp b/gui/objects.hpp index 44c2b364e..a89f48680 100644 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -285,7 +285,7 @@ protected: int doAction(Action action); bool needsToRunInSeparateThread(const Action& action); void simulate_progress_bar(void); - int flash_zip(std::string filename, std::string pageName, int* wipe_cache); + int flash_zip(std::string filename, int* wipe_cache); void reinject_after_flash(); void operation_start(const string operation_name); void operation_end(const int operation_status); @@ -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; }; @@ -362,13 +363,12 @@ public: ActionThread(); ~ActionThread(); - void threadActions(GUIAction *act, size_t start_index); + void threadActions(GUIAction *act); void run(void *data); private: struct ThreadData { GUIAction *act; - size_t start_index; }; pthread_t m_thread; 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<listSize; i++) + mList.at(i).selected = 0; + } if (mList.at(actualSelection).selected) mList.at(actualSelection).selected = 0; else |