From ca57699ed5d110d738cb9dc3a156c5897efbc7b6 Mon Sep 17 00:00:00 2001 From: Barry Wardell Date: Wed, 27 Feb 2008 17:42:51 +0000 Subject: [PATCH] More improvement to the display of Searching... splashes in the tagtree: 1) Only show splashes on searches after 1/2 second has passed. This avoids splashes for very short searches. 2) Update the splash a little more frequently for better feedback. 3) Fix a bug where the number of items found was reported wrongly a lot of the time. 4) Display the splash straight away if the disk needs to spin up because it's definitely going to be waiting at least a couple of seconds then. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16432 a1c6a512-1295-4272-9138-f99709370657 --- apps/tagtree.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/tagtree.c b/apps/tagtree.c index abd3902a7d..942c196718 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -932,13 +932,15 @@ static bool show_search_progress(bool init, int count) { static int last_tick = 0; + /* Don't show splashes for 1/2 second after starting search */ if (init) { - last_tick = current_tick; + last_tick = current_tick + HZ/2; return true; } - if (current_tick - last_tick > HZ/4) + /* Update progress every 1/10 of a second */ + if (current_tick - last_tick > HZ/10) { gui_syncsplash(0, str(LANG_PLAYLIST_SEARCH_MSG), count, str(LANG_OFF_ABORT)); @@ -1052,13 +1054,15 @@ static int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs, #endif ) { - show_search_progress(true, 0); + /* Show search progress straight away if the disk needs to spin up, + otherwise show it after the normal 1/2 second delay */ + show_search_progress( #if !defined(HAVE_FLASH_STORAGE) - /* Non-flash devices might have a pause while the disk spins up so give - some feedback so the user knows that something is happening */ - gui_syncsplash(0, str(LANG_PLAYLIST_SEARCH_MSG), - 0, csi->name); + ata_disk_is_active() +#else + true #endif + , 0); } if (c->currtable == allsubentries) @@ -1232,7 +1236,7 @@ static int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs, if (init && !tcs->ramsearch) { - if (!show_search_progress(false, i)) + if (!show_search_progress(false, total_count)) { tagcache_search_finish(tcs); return current_entry_count;