Add a possibility for plugins to go directly to the WPS after exiting.

It only works for plugins executed via the filebrowser for now. Those
executed from the context menu or a simplelist (such as "Open With...") need additional hacking.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21680 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-07-05 22:12:42 +00:00
parent 9431ea8c65
commit df6f955a82
3 changed files with 52 additions and 31 deletions

View file

@ -552,22 +552,35 @@ int ft_enter(struct tree_context* c)
/* plugin file */ /* plugin file */
case FILE_ATTR_ROCK: case FILE_ATTR_ROCK:
{
int ret;
if (global_settings.party_mode && audio_status()) { if (global_settings.party_mode && audio_status()) {
splash(HZ, ID2P(LANG_PARTY_MODE)); splash(HZ, ID2P(LANG_PARTY_MODE));
break; break;
} }
ret = plugin_load(buf,NULL);
if (plugin_load(buf,NULL) == PLUGIN_USB_CONNECTED) switch (ret)
{ {
if(*c->dirfilter > NUM_FILTER_MODES) case PLUGIN_GOTO_WPS:
/* leave sub-browsers after usb, doing play = true;
otherwise might be confusing to the user */ break;
exit_func = true; case PLUGIN_USB_CONNECTED:
else if(*c->dirfilter > NUM_FILTER_MODES)
reload_dir = true; /* leave sub-browsers after usb, doing
otherwise might be confusing to the user */
exit_func = true;
else
reload_dir = true;
break;
/*
case PLUGIN_ERROR:
case PLUGIN_OK:
*/
default:
break;
} }
break; break;
}
case FILE_ATTR_CUE: case FILE_ATTR_CUE:
display_cuesheet_content(buf); display_cuesheet_content(buf);
break; break;
@ -584,8 +597,21 @@ int ft_enter(struct tree_context* c)
plugin = filetype_get_plugin(file); plugin = filetype_get_plugin(file);
if (plugin) if (plugin)
{ {
if (plugin_load(plugin,buf) == PLUGIN_USB_CONNECTED) switch (plugin_load(plugin,buf))
reload_dir = true; {
case PLUGIN_USB_CONNECTED:
reload_dir = true;
break;
case PLUGIN_GOTO_WPS:
play = true;
break;
/*
case PLUGIN_OK:
case PLUGIN_ERROR:
*/
default:
break;
}
} }
break; break;
} }

View file

@ -664,6 +664,7 @@ static const struct plugin_api rockbox_api = {
int plugin_load(const char* plugin, const void* parameter) int plugin_load(const char* plugin, const void* parameter)
{ {
int rc; int rc;
int i;
int oldbars; int oldbars;
struct plugin_header *hdr; struct plugin_header *hdr;
#ifdef SIMULATOR #ifdef SIMULATOR
@ -804,8 +805,6 @@ int plugin_load(const char* plugin, const void* parameter)
#endif /* LCD_DEPTH */ #endif /* LCD_DEPTH */
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
lcd_clear_display();
lcd_update();
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
#if LCD_REMOTE_DEPTH > 1 #if LCD_REMOTE_DEPTH > 1
@ -814,32 +813,27 @@ int plugin_load(const char* plugin, const void* parameter)
#else #else
lcd_remote_set_drawmode(DRMODE_SOLID); lcd_remote_set_drawmode(DRMODE_SOLID);
#endif #endif
lcd_remote_clear_display();
lcd_remote_update();
#endif #endif
if (rc != PLUGIN_GOTO_WPS)
{
FOR_NB_SCREENS(i)
{
screens[i].clear_display();
screens[i].update();
}
}
viewportmanager_set_statusbar(oldbars); viewportmanager_set_statusbar(oldbars);
if (pfn_tsr_exit == NULL) if (pfn_tsr_exit == NULL)
plugin_loaded = false; plugin_loaded = false;
sim_plugin_close(pd); sim_plugin_close(pd);
switch (rc) { if (rc == PLUGIN_ERROR)
case PLUGIN_OK: splash(HZ*2, str(LANG_PLUGIN_ERROR));
break;
case PLUGIN_USB_CONNECTED: return rc;
return PLUGIN_USB_CONNECTED;
default:
splash(HZ*2, str(LANG_PLUGIN_ERROR));
break;
}
return PLUGIN_OK;
} }
/* Returns a pointer to the portion of the plugin buffer that is not already /* Returns a pointer to the portion of the plugin buffer that is not already

View file

@ -139,6 +139,7 @@ void* plugin_get_buffer(size_t *buffer_size);
enum plugin_status { enum plugin_status {
PLUGIN_OK = 0, PLUGIN_OK = 0,
PLUGIN_USB_CONNECTED, PLUGIN_USB_CONNECTED,
PLUGIN_GOTO_WPS,
PLUGIN_ERROR = -1, PLUGIN_ERROR = -1,
}; };