1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Barry Wardell 2008-02-27 17:42:51 +00:00
parent 43cf1d509b
commit ca57699ed5

View file

@ -932,13 +932,15 @@ static bool show_search_progress(bool init, int count)
{ {
static int last_tick = 0; static int last_tick = 0;
/* Don't show splashes for 1/2 second after starting search */
if (init) if (init)
{ {
last_tick = current_tick; last_tick = current_tick + HZ/2;
return true; 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, gui_syncsplash(0, str(LANG_PLAYLIST_SEARCH_MSG), count,
str(LANG_OFF_ABORT)); str(LANG_OFF_ABORT));
@ -1052,13 +1054,15 @@ static int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs,
#endif #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) #if !defined(HAVE_FLASH_STORAGE)
/* Non-flash devices might have a pause while the disk spins up so give ata_disk_is_active()
some feedback so the user knows that something is happening */ #else
gui_syncsplash(0, str(LANG_PLAYLIST_SEARCH_MSG), true
0, csi->name);
#endif #endif
, 0);
} }
if (c->currtable == allsubentries) 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 (init && !tcs->ramsearch)
{ {
if (!show_search_progress(false, i)) if (!show_search_progress(false, total_count))
{ {
tagcache_search_finish(tcs); tagcache_search_finish(tcs);
return current_entry_count; return current_entry_count;