Lead user through database initialisation
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12678 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
99b2742cd0
commit
8137489e2b
6 changed files with 100 additions and 13 deletions
|
@ -10701,3 +10701,25 @@
|
|||
*: "Alarm Wake up Screen"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_BUILDING_DATABASE
|
||||
desc: splash database building progress
|
||||
user:
|
||||
<source>
|
||||
*: "Building database... %d found (OFF for menu)"
|
||||
h100,h120,h300: "Building database... %d found (STOP for menu)"
|
||||
ipod*: "Building database... %d found (PLAY/PAUSE for menu)"
|
||||
x5: "Building database... %d found (Long PLAY for menu)"
|
||||
h10: "Building database... %d found (PREV for menu)"
|
||||
</source>
|
||||
<dest>
|
||||
*: "Building database... %d found (OFF for menu)"
|
||||
h100,h120,h300: "Building database... %d found (STOP for menu)"
|
||||
ipod*: "Building database... %d found (PLAY/PAUSE for menu)"
|
||||
x5: "Building database... %d found (Long PLAY for menu)"
|
||||
h10: "Building database... %d found (PREV for menu)"
|
||||
</dest>
|
||||
<voice>
|
||||
*: ""
|
||||
</voice>
|
||||
</phrase>
|
||||
|
|
|
@ -207,10 +207,12 @@ static void init_tagcache(void)
|
|||
{
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
gui_syncsplash(0, true, "%s [%d/%d]",
|
||||
str(LANG_TAGCACHE_INIT), ret, 7);
|
||||
str(LANG_TAGCACHE_INIT), ret,
|
||||
tagcache_get_max_commit_step());
|
||||
#else
|
||||
lcd_double_height(false);
|
||||
snprintf(buf, sizeof(buf), " TC [%d/%d]", ret, 7);
|
||||
snprintf(buf, sizeof(buf), " TC [%d/%d]", ret,
|
||||
tagcache_get_max_commit_step());
|
||||
lcd_puts(0, 1, buf);
|
||||
#endif
|
||||
clear = true;
|
||||
|
|
|
@ -45,14 +45,27 @@
|
|||
/***********************************/
|
||||
/* TAGCACHE MENU */
|
||||
#ifdef HAVE_TAGCACHE
|
||||
|
||||
static void tagcache_rebuild_with_splash(void)
|
||||
{
|
||||
tagcache_rebuild();
|
||||
gui_syncsplash(HZ*2, true, str(LANG_TAGCACHE_FORCE_UPDATE_SPLASH));
|
||||
}
|
||||
|
||||
static void tagcache_update_with_splash(void)
|
||||
{
|
||||
tagcache_update();
|
||||
gui_syncsplash(HZ*2, true, str(LANG_TAGCACHE_FORCE_UPDATE_SPLASH));
|
||||
}
|
||||
|
||||
#ifdef HAVE_TC_RAMCACHE
|
||||
MENUITEM_SETTING(tagcache_ram, &global_settings.tagcache_ram, NULL);
|
||||
#endif
|
||||
MENUITEM_SETTING(tagcache_autoupdate, &global_settings.tagcache_autoupdate, NULL);
|
||||
MENUITEM_FUNCTION(tc_init, ID2P(LANG_TAGCACHE_FORCE_UPDATE),
|
||||
(int(*)(void))tagcache_rebuild, NULL, Icon_NOICON);
|
||||
(int(*)(void))tagcache_rebuild_with_splash, NULL, Icon_NOICON);
|
||||
MENUITEM_FUNCTION(tc_update, ID2P(LANG_TAGCACHE_UPDATE),
|
||||
(int(*)(void))tagcache_update, NULL, Icon_NOICON);
|
||||
(int(*)(void))tagcache_update_with_splash, NULL, Icon_NOICON);
|
||||
MENUITEM_SETTING(runtimedb, &global_settings.runtimedb, NULL);
|
||||
MENUITEM_FUNCTION(tc_export, ID2P(LANG_TAGCACHE_EXPORT),
|
||||
(int(*)(void))tagtree_export, NULL, Icon_NOICON);
|
||||
|
|
|
@ -61,6 +61,9 @@
|
|||
#ifdef HAVE_RTC_ALARM
|
||||
#include "rtc.h"
|
||||
#endif
|
||||
#ifdef HAVE_TAGCACHE
|
||||
#include "tagcache.h"
|
||||
#endif
|
||||
|
||||
struct root_items {
|
||||
int (*function)(void* param);
|
||||
|
@ -99,11 +102,58 @@ static int browser(void* param)
|
|||
break;
|
||||
#ifdef HAVE_TAGCACHE
|
||||
case GO_TO_DBBROWSER:
|
||||
if ((last_screen != GO_TO_ROOT) && !tagcache_is_usable())
|
||||
if (!tagcache_is_usable())
|
||||
{
|
||||
gui_syncsplash(HZ, true, str(LANG_TAGCACHE_BUSY));
|
||||
return GO_TO_PREVIOUS;
|
||||
/* Re-init if required */
|
||||
struct tagcache_stat *stat = tagcache_get_stat();
|
||||
if (!stat->ready && !stat->commit_delayed && stat->processed_entries == 0)
|
||||
{
|
||||
/* Prompt the user */
|
||||
char *lines[]={str(LANG_TAGCACHE_BUSY), str(LANG_TAGCACHE_FORCE_UPDATE)};
|
||||
struct text_message message={lines, 2};
|
||||
if(gui_syncyesno_run(&message, NULL, NULL) == YESNO_NO)
|
||||
return GO_TO_PREVIOUS;
|
||||
int i;
|
||||
FOR_NB_SCREENS(i)
|
||||
screens[i].clear_display();
|
||||
|
||||
/* Start initialisation */
|
||||
tagcache_rebuild();
|
||||
}
|
||||
|
||||
/* Now display progress until it's ready or the user exits */
|
||||
while(!tagcache_is_usable())
|
||||
{
|
||||
gui_syncstatusbar_draw(&statusbars, false);
|
||||
stat = tagcache_get_stat();
|
||||
|
||||
/* Maybe just needs to reboot due to delayed commit */
|
||||
if (stat->commit_delayed)
|
||||
{
|
||||
gui_syncsplash(HZ*2, true, str(LANG_PLEASE_REBOOT));
|
||||
break;
|
||||
}
|
||||
|
||||
/* Display building progress */
|
||||
if (stat->commit_step > 0)
|
||||
{
|
||||
gui_syncsplash(0, true, "%s [%d/%d]",
|
||||
str(LANG_TAGCACHE_INIT), stat->commit_step,
|
||||
tagcache_get_max_commit_step());
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_syncsplash(0, true, str(LANG_BUILDING_DATABASE),
|
||||
stat->processed_entries);
|
||||
}
|
||||
|
||||
/* Allow user to exit */
|
||||
if (action_userabort(HZ/2))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!tagcache_is_usable())
|
||||
return GO_TO_PREVIOUS;
|
||||
filter = SHOW_ID3DB;
|
||||
tc->dirlevel = last_db_dirlevel;
|
||||
break;
|
||||
|
|
|
@ -3904,16 +3904,12 @@ bool tagcache_update(void)
|
|||
return false;
|
||||
|
||||
queue_post(&tagcache_queue, Q_UPDATE, 0);
|
||||
gui_syncsplash(HZ*2, true, str(LANG_TAGCACHE_FORCE_UPDATE_SPLASH));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool tagcache_rebuild(void)
|
||||
bool tagcache_rebuild()
|
||||
{
|
||||
queue_post(&tagcache_queue, Q_REBUILD, 0);
|
||||
gui_syncsplash(HZ*2, true, str(LANG_TAGCACHE_FORCE_UPDATE_SPLASH));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3974,4 +3970,8 @@ int tagcache_get_commit_step(void)
|
|||
{
|
||||
return tc_stat.commit_step;
|
||||
}
|
||||
int tagcache_get_max_commit_step(void)
|
||||
{
|
||||
return 8; /* To be written, better hard-coded here than in the UI */
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,6 @@ void tagcache_start_scan(void);
|
|||
void tagcache_stop_scan(void);
|
||||
bool tagcache_update(void);
|
||||
bool tagcache_rebuild(void);
|
||||
|
||||
int tagcache_get_max_commit_step(void);
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue