From 54ec1f5f6db24ab90046b7cbab371c99e239f67e Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Sat, 12 Aug 2006 11:00:39 +0000 Subject: [PATCH] Better UI response with playlist operations. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10544 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 14 ++++++++++++++ apps/onplay.c | 2 ++ apps/playlist.c | 23 ++++++++++++++++++++++- apps/tagcache.c | 1 + apps/tagtree.c | 10 +++++++--- 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 50cdb20432..88b24ec567 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -9534,3 +9534,17 @@ *: "Split Filesize" + + id: LANG_LOADING_PERCENT + desc: splash number of percents loaded + user: + + *: "Loading... %d%% done (%s)" + + + *: "Loading... %d%% done (%s)" + + + *: "" + + diff --git a/apps/onplay.c b/apps/onplay.c index a5fb3fe41f..a81b096e79 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -172,6 +172,8 @@ static bool add_to_playlist(int position, bool queue) }; struct text_message message={lines, 2}; + gui_syncsplash(0, true, str(LANG_WAIT)); + if (new_playlist) playlist_create(NULL, NULL); diff --git a/apps/playlist.c b/apps/playlist.c index 6b35bb6c3f..a51e8f501c 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -1873,9 +1873,30 @@ int playlist_resume(void) char *str1 = NULL; char *str2 = NULL; char *str3 = NULL; - + unsigned long last_tick = current_tick; + for(count=0; count HZ/4) + { + gui_syncsplash(0, true, str(LANG_LOADING_PERCENT), + (total_read+count)*100/control_file_size, +#if CONFIG_KEYPAD == PLAYER_PAD + str(LANG_STOP_ABORT) +#else + str(LANG_OFF_ABORT) +#endif + ); + if (SETTINGS_CANCEL == button_get(false)) + { + /* FIXME: + * Not sure how to implement this, somebody more familiar + * with the code, please fix this. */ + } + last_tick = current_tick; + } + /* Are we on a new line? */ if((*p == '\n') || (*p == '\r')) { diff --git a/apps/tagcache.c b/apps/tagcache.c index ec713e29a4..4c324c8da3 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -2657,6 +2657,7 @@ bool tagcache_create_changelog(struct tagcache_search *tcs) } write(clfd, "\n", 1); + yield(); } close(clfd); diff --git a/apps/tagtree.c b/apps/tagtree.c index 25ac917bda..daa52646fa 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -526,7 +526,7 @@ bool show_search_progress(bool init, int count) return true; } - if (current_tick - last_tick > HZ/2) + if (current_tick - last_tick > HZ/4) { gui_syncsplash(0, true, str(LANG_PLAYLIST_SEARCH_MSG), count, #if CONFIG_KEYPAD == PLAYER_PAD @@ -538,6 +538,7 @@ bool show_search_progress(bool init, int count) if (SETTINGS_CANCEL == button_get(false)) return false; last_tick = current_tick; + yield(); } return true; @@ -993,6 +994,8 @@ bool insert_all_playlist(struct tree_context *c, int position, bool queue) if (playlist_insert_track(NULL, buf, position, queue, false) < 0) break; + + yield(); } playlist_sync(NULL); tagcache_search_finish(&tcs); @@ -1007,6 +1010,9 @@ bool tagtree_insert_selection_playlist(int position, bool queue) char buf[MAX_PATH]; int dirlevel = tc->dirlevel; + /* We need to set the table to allsubentries. */ + show_search_progress(true, 0); + dptr = tagtree_get_entry(tc, tc->selected_item); /* Insert a single track? */ @@ -1022,8 +1028,6 @@ bool tagtree_insert_selection_playlist(int position, bool queue) return true; } - /* We need to set the table to allsubentries. */ - show_search_progress(true, 0); if (dptr->newtable == navibrowse) { tagtree_enter(tc);