From afd51caf8d23cfc19b847fa978da4c23b1a0e3d0 Mon Sep 17 00:00:00 2001 From: Steven Smith Date: Tue, 20 Jan 2015 21:16:34 -0800 Subject: [PATCH] Avoid confirmation text going off screen, show percent progress on install screen, keep selector visible during install/delete. --- source/main.cpp | 6 ++---- source/ui.cpp | 8 +++++--- source/ui.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/main.cpp b/source/main.cpp index 1ffd99b..4d4f556 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -28,16 +28,14 @@ int main(int argc, char **argv) { } } else { if(mode == INSTALL) { - if(uiPromptOperation(mode, targetInstall)) { - screen_clear_all(); + if(uiPromptOperation(mode)) { uiDisplayResult(true, app_install(destination, targetInstall, &uiDisplayInstallProgress)); } free(targetInstall); } else { char* str = sdprintf("%08lx - %s, %s, %s", targetDelete.uniqueId, targetDelete.productCode, app_get_platform_name(targetDelete.platform), app_get_category_name(targetDelete.category)); - if(uiPromptOperation(mode, str)) { - screen_clear_all(); + if(uiPromptOperation(mode)) { uiDisplayDeleting(); uiDisplayResult(false, app_delete(destination, targetDelete)); } diff --git a/source/ui.cpp b/source/ui.cpp index 996b238..3b0ca4d 100644 --- a/source/ui.cpp +++ b/source/ui.cpp @@ -308,13 +308,14 @@ UIResult uiSelectTitle(App* selected, MediaType* destination, Mode* mode) { } bool uiDisplayInstallProgress(int progress) { - char* msg = strdup("Installing: [ ]"); + char* msg = sdprintf("Installing: [ ] %03d%%", progress); const char* cancel = "Press B to cancel."; for(int pos = 13; pos < 13 + (progress / 4); pos++) { msg[pos] = '|'; } screen_begin_draw_info(); + screen_clear(0, 0, 0); screen_draw_string(msg, (screen_get_width() - screen_get_str_width(msg)) / 2, (screen_get_height() - screen_get_str_height(msg)) / 2, 255, 255, 255); screen_draw_string(cancel, (screen_get_width() - screen_get_str_width(cancel)) / 2, (screen_get_height() - screen_get_str_height(msg)) / 2 + (screen_get_str_height(msg) * 2), 255, 255, 255); screen_end_draw(); @@ -329,6 +330,7 @@ bool uiDisplayInstallProgress(int progress) { void uiDisplayDeleting() { const char* msg = "Deleting title..."; screen_begin_draw_info(); + screen_clear(0, 0, 0); screen_draw_string(msg, (screen_get_width() - screen_get_str_width(msg)) / 2, (screen_get_height() - screen_get_str_height(msg)) / 2, 255, 255, 255); screen_end_draw(); screen_swap_buffers(); @@ -350,8 +352,8 @@ void uiDisplayResult(bool install, bool state) { } } -bool uiPromptOperation(Mode mode, char* name) { - char* msg = sdprintf("%s %s?", mode == INSTALL ? "Install" : "Delete", name); +bool uiPromptOperation(Mode mode) { + char* msg = sdprintf("%s the selected title?", mode == INSTALL ? "Install" : "Delete"); const char* prompt = "Press A to confirm, B to cancel."; while(platform_is_running()) { input_poll(); diff --git a/source/ui.h b/source/ui.h index 903f4dd..c7f10d5 100644 --- a/source/ui.h +++ b/source/ui.h @@ -21,6 +21,6 @@ UIResult uiSelectTitle(App* selected, MediaType* destination, Mode* mode); bool uiDisplayInstallProgress(int progress); void uiDisplayDeleting(); void uiDisplayResult(bool install, bool state); -bool uiPromptOperation(Mode mode, char* name); +bool uiPromptOperation(Mode mode); #endif