Adapt pictureflow and random_folder_advance_config to make use of the new goto-wps exit feature.

For pictureflow a menu item is added, but the key press that works in the filetree works also (unless it's already remapped),
rfa will go to the wps after selecting "Play Shuffled", as it needs to exit then anyway.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21681 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-07-05 22:15:04 +00:00
parent df6f955a82
commit f4c31ae309
2 changed files with 56 additions and 52 deletions

View file

@ -54,6 +54,8 @@ PLUGIN_HEADER
#define PF_CONTEXT ACTION_STD_CONTEXT #define PF_CONTEXT ACTION_STD_CONTEXT
#define PF_BACK ACTION_STD_CANCEL #define PF_BACK ACTION_STD_CANCEL
#define PF_MENU ACTION_STD_MENU #define PF_MENU ACTION_STD_MENU
#define PF_WPS ACTION_TREE_WPS
#define PF_QUIT (LAST_ACTION_PLACEHOLDER + 1) #define PF_QUIT (LAST_ACTION_PLACEHOLDER + 1)
#if defined(HAVE_SCROLLWHEEL) || CONFIG_KEYPAD == IRIVER_H10_PAD || \ #if defined(HAVE_SCROLLWHEEL) || CONFIG_KEYPAD == IRIVER_H10_PAD || \
@ -2013,6 +2015,10 @@ void update_scroll_animation(void)
void cleanup(void *parameter) void cleanup(void *parameter)
{ {
(void) parameter; (void) parameter;
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false);
#endif
end_pf_thread();
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */ backlight_use_settings(); /* backlight control in lib/helper.c */
@ -2141,6 +2147,7 @@ int settings_menu(void)
Show the main menu Show the main menu
*/ */
enum { enum {
PF_GOTO_WPS,
#if PF_PLAYBACK_CAPABLE #if PF_PLAYBACK_CAPABLE
PF_MENU_PLAYBACK_CONTROL, PF_MENU_PLAYBACK_CONTROL,
#endif #endif
@ -2159,12 +2166,15 @@ int main_menu(void)
#endif #endif
MENUITEM_STRINGLIST(main_menu,"PictureFlow Main Menu",NULL, MENUITEM_STRINGLIST(main_menu,"PictureFlow Main Menu",NULL,
"Go to WPS",
#if PF_PLAYBACK_CAPABLE #if PF_PLAYBACK_CAPABLE
"Playback Control", "Playback Control",
#endif #endif
"Settings", "Return", "Quit"); "Settings", "Return", "Quit");
while (1) { while (1) {
switch (rb->do_menu(&main_menu,&selection, NULL, false)) { switch (rb->do_menu(&main_menu,&selection, NULL, false)) {
case PF_GOTO_WPS: /* WPS */
return -2;
#if PF_PLAYBACK_CAPABLE #if PF_PLAYBACK_CAPABLE
case PF_MENU_PLAYBACK_CONTROL: /* Playback Control */ case PF_MENU_PLAYBACK_CONTROL: /* Playback Control */
playback_control(NULL); playback_control(NULL);
@ -2174,10 +2184,8 @@ int main_menu(void)
result = settings_menu(); result = settings_menu();
if ( result != 0 ) return result; if ( result != 0 ) return result;
break; break;
case PF_MENU_RETURN: case PF_MENU_RETURN:
return 0; return 0;
case PF_MENU_QUIT: case PF_MENU_QUIT:
return -1; return -1;
@ -2405,6 +2413,7 @@ play:
old_shuffle = shuffle; old_shuffle = shuffle;
} }
#endif #endif
/** /**
Draw the current album name Draw the current album name
*/ */
@ -2661,7 +2670,8 @@ int main(void)
switch (button) { switch (button) {
case PF_QUIT: case PF_QUIT:
return PLUGIN_OK; return PLUGIN_OK;
case PF_WPS:
return PLUGIN_GOTO_WPS;
case PF_BACK: case PF_BACK:
if ( pf_state == pf_show_tracks ) if ( pf_state == pf_show_tracks )
{ {
@ -2673,12 +2683,12 @@ int main(void)
if (pf_state == pf_idle || pf_state == pf_scrolling) if (pf_state == pf_idle || pf_state == pf_scrolling)
return PLUGIN_OK; return PLUGIN_OK;
break; break;
case PF_MENU: case PF_MENU:
#ifdef USEGSLIB #ifdef USEGSLIB
grey_show(false); grey_show(false);
#endif #endif
ret = main_menu(); ret = main_menu();
if ( ret == -2 ) return PLUGIN_GOTO_WPS;
if ( ret == -1 ) return PLUGIN_OK; if ( ret == -1 ) return PLUGIN_OK;
if ( ret != 0 ) return ret; if ( ret != 0 ) return ret;
#ifdef USEGSLIB #ifdef USEGSLIB
@ -2713,7 +2723,6 @@ int main(void)
#endif #endif
} }
break; break;
default: default:
if (rb->default_event_handler_ex(button, cleanup, NULL) if (rb->default_event_handler_ex(button, cleanup, NULL)
== SYS_USB_CONNECTED) == SYS_USB_CONNECTED)
@ -2752,9 +2761,6 @@ enum plugin_status plugin_start(const void *parameter)
#endif #endif
#endif #endif
ret = main(); ret = main();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false);
#endif
if ( ret == PLUGIN_OK ) { if ( ret == PLUGIN_OK ) {
if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS,
CONFIG_VERSION)) CONFIG_VERSION))
@ -2764,7 +2770,6 @@ enum plugin_status plugin_start(const void *parameter)
} }
} }
end_pf_thread();
cleanup(NULL); cleanup(NULL);
return ret; return ret;
} }

View file

@ -535,10 +535,8 @@ int start_shuffled_play(void)
return 1; return 1;
} }
int main_menu(void) enum plugin_status main_menu(void)
{ {
bool exit = false;
MENUITEM_STRINGLIST(menu, "Main Menu", NULL, MENUITEM_STRINGLIST(menu, "Main Menu", NULL,
"Generate Folder List", "Generate Folder List",
"Edit Folder List", "Edit Folder List",
@ -547,69 +545,72 @@ int main_menu(void)
"Play Shuffled", "Play Shuffled",
"Quit"); "Quit");
switch (rb->do_menu(&menu, NULL, NULL, false)) while (true)
{ {
case 0: /* generate */ switch (rb->do_menu(&menu, NULL, NULL, false))
{
case 0: /* generate */
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true); rb->cpu_boost(true);
#endif #endif
generate(); generate();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false); rb->cpu_boost(false);
#endif #endif
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
rb->remote_backlight_on(); rb->remote_backlight_on();
#endif #endif
rb->backlight_on(); rb->backlight_on();
break; break;
case 1: case 1:
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true); rb->cpu_boost(true);
#endif #endif
if (edit_list() < 0) if (edit_list() < 0)
exit = true; return PLUGIN_OK;
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false); rb->cpu_boost(false);
#endif #endif
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
rb->remote_backlight_on(); rb->remote_backlight_on();
#endif #endif
rb->backlight_on(); rb->backlight_on();
break; break;
case 2: /* export to textfile */ case 2: /* export to textfile */
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true); rb->cpu_boost(true);
#endif #endif
export_list_to_file_text(); export_list_to_file_text();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false); rb->cpu_boost(false);
#endif #endif
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
rb->remote_backlight_on(); rb->remote_backlight_on();
#endif #endif
rb->backlight_on(); rb->backlight_on();
break; break;
case 3: /* import from textfile */ case 3: /* import from textfile */
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true); rb->cpu_boost(true);
#endif #endif
import_list_from_file_text(); import_list_from_file_text();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false); rb->cpu_boost(false);
#endif #endif
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
rb->remote_backlight_on(); rb->remote_backlight_on();
#endif #endif
rb->backlight_on(); rb->backlight_on();
break; break;
case 4: case 4:
start_shuffled_play(); if (!start_shuffled_play())
exit=true; return PLUGIN_ERROR;
break; else
case 5: return PLUGIN_GOTO_WPS;
return 1; case 5:
return PLUGIN_OK;
}
} }
return exit?1:0;
} }
enum plugin_status plugin_start(const void* parameter) enum plugin_status plugin_start(const void* parameter)
@ -618,7 +619,5 @@ enum plugin_status plugin_start(const void* parameter)
abort = false; abort = false;
while (!main_menu()) return main_menu();
;
return PLUGIN_OK;
} }