Avoid confirmation text going off screen, show percent progress on install screen, keep selector visible during install/delete.

This commit is contained in:
Steven Smith 2015-01-20 21:16:34 -08:00
parent da078148bd
commit afd51caf8d
3 changed files with 8 additions and 8 deletions

View File

@ -28,16 +28,14 @@ int main(int argc, char **argv) {
} }
} else { } else {
if(mode == INSTALL) { if(mode == INSTALL) {
if(uiPromptOperation(mode, targetInstall)) { if(uiPromptOperation(mode)) {
screen_clear_all();
uiDisplayResult(true, app_install(destination, targetInstall, &uiDisplayInstallProgress)); uiDisplayResult(true, app_install(destination, targetInstall, &uiDisplayInstallProgress));
} }
free(targetInstall); free(targetInstall);
} else { } else {
char* str = sdprintf("%08lx - %s, %s, %s", targetDelete.uniqueId, targetDelete.productCode, app_get_platform_name(targetDelete.platform), app_get_category_name(targetDelete.category)); 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)) { if(uiPromptOperation(mode)) {
screen_clear_all();
uiDisplayDeleting(); uiDisplayDeleting();
uiDisplayResult(false, app_delete(destination, targetDelete)); uiDisplayResult(false, app_delete(destination, targetDelete));
} }

View File

@ -308,13 +308,14 @@ UIResult uiSelectTitle(App* selected, MediaType* destination, Mode* mode) {
} }
bool uiDisplayInstallProgress(int progress) { bool uiDisplayInstallProgress(int progress) {
char* msg = strdup("Installing: [ ]"); char* msg = sdprintf("Installing: [ ] %03d%%", progress);
const char* cancel = "Press B to cancel."; const char* cancel = "Press B to cancel.";
for(int pos = 13; pos < 13 + (progress / 4); pos++) { for(int pos = 13; pos < 13 + (progress / 4); pos++) {
msg[pos] = '|'; msg[pos] = '|';
} }
screen_begin_draw_info(); 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(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_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(); screen_end_draw();
@ -329,6 +330,7 @@ bool uiDisplayInstallProgress(int progress) {
void uiDisplayDeleting() { void uiDisplayDeleting() {
const char* msg = "Deleting title..."; const char* msg = "Deleting title...";
screen_begin_draw_info(); 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(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_end_draw();
screen_swap_buffers(); screen_swap_buffers();
@ -350,8 +352,8 @@ void uiDisplayResult(bool install, bool state) {
} }
} }
bool uiPromptOperation(Mode mode, char* name) { bool uiPromptOperation(Mode mode) {
char* msg = sdprintf("%s %s?", mode == INSTALL ? "Install" : "Delete", name); char* msg = sdprintf("%s the selected title?", mode == INSTALL ? "Install" : "Delete");
const char* prompt = "Press A to confirm, B to cancel."; const char* prompt = "Press A to confirm, B to cancel.";
while(platform_is_running()) { while(platform_is_running()) {
input_poll(); input_poll();

View File

@ -21,6 +21,6 @@ UIResult uiSelectTitle(App* selected, MediaType* destination, Mode* mode);
bool uiDisplayInstallProgress(int progress); bool uiDisplayInstallProgress(int progress);
void uiDisplayDeleting(); void uiDisplayDeleting();
void uiDisplayResult(bool install, bool state); void uiDisplayResult(bool install, bool state);
bool uiPromptOperation(Mode mode, char* name); bool uiPromptOperation(Mode mode);
#endif #endif