diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-07-05 22:15:04 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-07-05 22:15:04 +0000 |
commit | f4c31ae3094665fc5c71e98e185aa712ebdb9598 (patch) | |
tree | 38ff3320233fbb4e9cc936fedc1d48d63aa4a5e1 | |
parent | df6f955a82bce03650f24f562926ae9e7ffa58d4 (diff) | |
download | rockbox-f4c31ae3094665fc5c71e98e185aa712ebdb9598.tar.gz rockbox-f4c31ae3094665fc5c71e98e185aa712ebdb9598.zip |
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
-rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 23 | ||||
-rw-r--r-- | apps/plugins/random_folder_advance_config.c | 85 |
2 files changed, 56 insertions, 52 deletions
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index b3cc7e4fb4..496e9c94df 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c | |||
@@ -54,6 +54,8 @@ PLUGIN_HEADER | |||
54 | #define PF_CONTEXT ACTION_STD_CONTEXT | 54 | #define PF_CONTEXT ACTION_STD_CONTEXT |
55 | #define PF_BACK ACTION_STD_CANCEL | 55 | #define PF_BACK ACTION_STD_CANCEL |
56 | #define PF_MENU ACTION_STD_MENU | 56 | #define PF_MENU ACTION_STD_MENU |
57 | #define PF_WPS ACTION_TREE_WPS | ||
58 | |||
57 | #define PF_QUIT (LAST_ACTION_PLACEHOLDER + 1) | 59 | #define PF_QUIT (LAST_ACTION_PLACEHOLDER + 1) |
58 | 60 | ||
59 | #if defined(HAVE_SCROLLWHEEL) || CONFIG_KEYPAD == IRIVER_H10_PAD || \ | 61 | #if defined(HAVE_SCROLLWHEEL) || CONFIG_KEYPAD == IRIVER_H10_PAD || \ |
@@ -2013,6 +2015,10 @@ void update_scroll_animation(void) | |||
2013 | void cleanup(void *parameter) | 2015 | void cleanup(void *parameter) |
2014 | { | 2016 | { |
2015 | (void) parameter; | 2017 | (void) parameter; |
2018 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
2019 | rb->cpu_boost(false); | ||
2020 | #endif | ||
2021 | end_pf_thread(); | ||
2016 | /* Turn on backlight timeout (revert to settings) */ | 2022 | /* Turn on backlight timeout (revert to settings) */ |
2017 | backlight_use_settings(); /* backlight control in lib/helper.c */ | 2023 | backlight_use_settings(); /* backlight control in lib/helper.c */ |
2018 | 2024 | ||
@@ -2141,6 +2147,7 @@ int settings_menu(void) | |||
2141 | Show the main menu | 2147 | Show the main menu |
2142 | */ | 2148 | */ |
2143 | enum { | 2149 | enum { |
2150 | PF_GOTO_WPS, | ||
2144 | #if PF_PLAYBACK_CAPABLE | 2151 | #if PF_PLAYBACK_CAPABLE |
2145 | PF_MENU_PLAYBACK_CONTROL, | 2152 | PF_MENU_PLAYBACK_CONTROL, |
2146 | #endif | 2153 | #endif |
@@ -2159,12 +2166,15 @@ int main_menu(void) | |||
2159 | #endif | 2166 | #endif |
2160 | 2167 | ||
2161 | MENUITEM_STRINGLIST(main_menu,"PictureFlow Main Menu",NULL, | 2168 | MENUITEM_STRINGLIST(main_menu,"PictureFlow Main Menu",NULL, |
2169 | "Go to WPS", | ||
2162 | #if PF_PLAYBACK_CAPABLE | 2170 | #if PF_PLAYBACK_CAPABLE |
2163 | "Playback Control", | 2171 | "Playback Control", |
2164 | #endif | 2172 | #endif |
2165 | "Settings", "Return", "Quit"); | 2173 | "Settings", "Return", "Quit"); |
2166 | while (1) { | 2174 | while (1) { |
2167 | switch (rb->do_menu(&main_menu,&selection, NULL, false)) { | 2175 | switch (rb->do_menu(&main_menu,&selection, NULL, false)) { |
2176 | case PF_GOTO_WPS: /* WPS */ | ||
2177 | return -2; | ||
2168 | #if PF_PLAYBACK_CAPABLE | 2178 | #if PF_PLAYBACK_CAPABLE |
2169 | case PF_MENU_PLAYBACK_CONTROL: /* Playback Control */ | 2179 | case PF_MENU_PLAYBACK_CONTROL: /* Playback Control */ |
2170 | playback_control(NULL); | 2180 | playback_control(NULL); |
@@ -2174,10 +2184,8 @@ int main_menu(void) | |||
2174 | result = settings_menu(); | 2184 | result = settings_menu(); |
2175 | if ( result != 0 ) return result; | 2185 | if ( result != 0 ) return result; |
2176 | break; | 2186 | break; |
2177 | |||
2178 | case PF_MENU_RETURN: | 2187 | case PF_MENU_RETURN: |
2179 | return 0; | 2188 | return 0; |
2180 | |||
2181 | case PF_MENU_QUIT: | 2189 | case PF_MENU_QUIT: |
2182 | return -1; | 2190 | return -1; |
2183 | 2191 | ||
@@ -2405,6 +2413,7 @@ play: | |||
2405 | old_shuffle = shuffle; | 2413 | old_shuffle = shuffle; |
2406 | } | 2414 | } |
2407 | #endif | 2415 | #endif |
2416 | |||
2408 | /** | 2417 | /** |
2409 | Draw the current album name | 2418 | Draw the current album name |
2410 | */ | 2419 | */ |
@@ -2661,7 +2670,8 @@ int main(void) | |||
2661 | switch (button) { | 2670 | switch (button) { |
2662 | case PF_QUIT: | 2671 | case PF_QUIT: |
2663 | return PLUGIN_OK; | 2672 | return PLUGIN_OK; |
2664 | 2673 | case PF_WPS: | |
2674 | return PLUGIN_GOTO_WPS; | ||
2665 | case PF_BACK: | 2675 | case PF_BACK: |
2666 | if ( pf_state == pf_show_tracks ) | 2676 | if ( pf_state == pf_show_tracks ) |
2667 | { | 2677 | { |
@@ -2673,12 +2683,12 @@ int main(void) | |||
2673 | if (pf_state == pf_idle || pf_state == pf_scrolling) | 2683 | if (pf_state == pf_idle || pf_state == pf_scrolling) |
2674 | return PLUGIN_OK; | 2684 | return PLUGIN_OK; |
2675 | break; | 2685 | break; |
2676 | |||
2677 | case PF_MENU: | 2686 | case PF_MENU: |
2678 | #ifdef USEGSLIB | 2687 | #ifdef USEGSLIB |
2679 | grey_show(false); | 2688 | grey_show(false); |
2680 | #endif | 2689 | #endif |
2681 | ret = main_menu(); | 2690 | ret = main_menu(); |
2691 | if ( ret == -2 ) return PLUGIN_GOTO_WPS; | ||
2682 | if ( ret == -1 ) return PLUGIN_OK; | 2692 | if ( ret == -1 ) return PLUGIN_OK; |
2683 | if ( ret != 0 ) return ret; | 2693 | if ( ret != 0 ) return ret; |
2684 | #ifdef USEGSLIB | 2694 | #ifdef USEGSLIB |
@@ -2713,7 +2723,6 @@ int main(void) | |||
2713 | #endif | 2723 | #endif |
2714 | } | 2724 | } |
2715 | break; | 2725 | break; |
2716 | |||
2717 | default: | 2726 | default: |
2718 | if (rb->default_event_handler_ex(button, cleanup, NULL) | 2727 | if (rb->default_event_handler_ex(button, cleanup, NULL) |
2719 | == SYS_USB_CONNECTED) | 2728 | == SYS_USB_CONNECTED) |
@@ -2752,9 +2761,6 @@ enum plugin_status plugin_start(const void *parameter) | |||
2752 | #endif | 2761 | #endif |
2753 | #endif | 2762 | #endif |
2754 | ret = main(); | 2763 | ret = main(); |
2755 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
2756 | rb->cpu_boost(false); | ||
2757 | #endif | ||
2758 | if ( ret == PLUGIN_OK ) { | 2764 | if ( ret == PLUGIN_OK ) { |
2759 | if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, | 2765 | if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, |
2760 | CONFIG_VERSION)) | 2766 | CONFIG_VERSION)) |
@@ -2764,7 +2770,6 @@ enum plugin_status plugin_start(const void *parameter) | |||
2764 | } | 2770 | } |
2765 | } | 2771 | } |
2766 | 2772 | ||
2767 | end_pf_thread(); | ||
2768 | cleanup(NULL); | 2773 | cleanup(NULL); |
2769 | return ret; | 2774 | return ret; |
2770 | } | 2775 | } |
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index 3c74b790f9..2d3959ac1f 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c | |||
@@ -535,10 +535,8 @@ int start_shuffled_play(void) | |||
535 | return 1; | 535 | return 1; |
536 | } | 536 | } |
537 | 537 | ||
538 | int main_menu(void) | 538 | enum plugin_status main_menu(void) |
539 | { | 539 | { |
540 | bool exit = false; | ||
541 | |||
542 | MENUITEM_STRINGLIST(menu, "Main Menu", NULL, | 540 | MENUITEM_STRINGLIST(menu, "Main Menu", NULL, |
543 | "Generate Folder List", | 541 | "Generate Folder List", |
544 | "Edit Folder List", | 542 | "Edit Folder List", |
@@ -547,69 +545,72 @@ int main_menu(void) | |||
547 | "Play Shuffled", | 545 | "Play Shuffled", |
548 | "Quit"); | 546 | "Quit"); |
549 | 547 | ||
550 | switch (rb->do_menu(&menu, NULL, NULL, false)) | 548 | while (true) |
551 | { | 549 | { |
552 | case 0: /* generate */ | 550 | switch (rb->do_menu(&menu, NULL, NULL, false)) |
551 | { | ||
552 | case 0: /* generate */ | ||
553 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 553 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
554 | rb->cpu_boost(true); | 554 | rb->cpu_boost(true); |
555 | #endif | 555 | #endif |
556 | generate(); | 556 | generate(); |
557 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 557 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
558 | rb->cpu_boost(false); | 558 | rb->cpu_boost(false); |
559 | #endif | 559 | #endif |
560 | #ifdef HAVE_REMOTE_LCD | 560 | #ifdef HAVE_REMOTE_LCD |
561 | rb->remote_backlight_on(); | 561 | rb->remote_backlight_on(); |
562 | #endif | 562 | #endif |
563 | rb->backlight_on(); | 563 | rb->backlight_on(); |
564 | break; | 564 | break; |
565 | case 1: | 565 | case 1: |
566 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 566 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
567 | rb->cpu_boost(true); | 567 | rb->cpu_boost(true); |
568 | #endif | 568 | #endif |
569 | if (edit_list() < 0) | 569 | if (edit_list() < 0) |
570 | exit = true; | 570 | return PLUGIN_OK; |
571 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 571 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
572 | rb->cpu_boost(false); | 572 | rb->cpu_boost(false); |
573 | #endif | 573 | #endif |
574 | #ifdef HAVE_REMOTE_LCD | 574 | #ifdef HAVE_REMOTE_LCD |
575 | rb->remote_backlight_on(); | 575 | rb->remote_backlight_on(); |
576 | #endif | 576 | #endif |
577 | rb->backlight_on(); | 577 | rb->backlight_on(); |
578 | break; | 578 | break; |
579 | case 2: /* export to textfile */ | 579 | case 2: /* export to textfile */ |
580 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 580 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
581 | rb->cpu_boost(true); | 581 | rb->cpu_boost(true); |
582 | #endif | 582 | #endif |
583 | export_list_to_file_text(); | 583 | export_list_to_file_text(); |
584 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 584 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
585 | rb->cpu_boost(false); | 585 | rb->cpu_boost(false); |
586 | #endif | 586 | #endif |
587 | #ifdef HAVE_REMOTE_LCD | 587 | #ifdef HAVE_REMOTE_LCD |
588 | rb->remote_backlight_on(); | 588 | rb->remote_backlight_on(); |
589 | #endif | 589 | #endif |
590 | rb->backlight_on(); | 590 | rb->backlight_on(); |
591 | break; | 591 | break; |
592 | case 3: /* import from textfile */ | 592 | case 3: /* import from textfile */ |
593 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 593 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
594 | rb->cpu_boost(true); | 594 | rb->cpu_boost(true); |
595 | #endif | 595 | #endif |
596 | import_list_from_file_text(); | 596 | import_list_from_file_text(); |
597 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 597 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
598 | rb->cpu_boost(false); | 598 | rb->cpu_boost(false); |
599 | #endif | 599 | #endif |
600 | #ifdef HAVE_REMOTE_LCD | 600 | #ifdef HAVE_REMOTE_LCD |
601 | rb->remote_backlight_on(); | 601 | rb->remote_backlight_on(); |
602 | #endif | 602 | #endif |
603 | rb->backlight_on(); | 603 | rb->backlight_on(); |
604 | break; | 604 | break; |
605 | case 4: | 605 | case 4: |
606 | start_shuffled_play(); | 606 | if (!start_shuffled_play()) |
607 | exit=true; | 607 | return PLUGIN_ERROR; |
608 | break; | 608 | else |
609 | case 5: | 609 | return PLUGIN_GOTO_WPS; |
610 | return 1; | 610 | case 5: |
611 | return PLUGIN_OK; | ||
612 | } | ||
611 | } | 613 | } |
612 | return exit?1:0; | ||
613 | } | 614 | } |
614 | 615 | ||
615 | enum plugin_status plugin_start(const void* parameter) | 616 | enum plugin_status plugin_start(const void* parameter) |
@@ -618,7 +619,5 @@ enum plugin_status plugin_start(const void* parameter) | |||
618 | 619 | ||
619 | abort = false; | 620 | abort = false; |
620 | 621 | ||
621 | while (!main_menu()) | 622 | return main_menu(); |
622 | ; | ||
623 | return PLUGIN_OK; | ||
624 | } | 623 | } |