diff options
Diffstat (limited to 'apps/plugins/test_codec.c')
-rw-r--r-- | apps/plugins/test_codec.c | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 4c0739f660..50d3fc93ef 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c | |||
@@ -19,6 +19,8 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "lib/pluginlib_touchscreen.h" | ||
23 | #include "lib/pluginlib_exit.h" | ||
22 | 24 | ||
23 | /* All swcodec targets have BUTTON_SELECT apart from the H10 and M3 */ | 25 | /* All swcodec targets have BUTTON_SELECT apart from the H10 and M3 */ |
24 | 26 | ||
@@ -42,7 +44,7 @@ | |||
42 | #elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD | 44 | #elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD |
43 | #define TESTCODEC_EXITBUTTON BUTTON_BACK | 45 | #define TESTCODEC_EXITBUTTON BUTTON_BACK |
44 | #elif defined(HAVE_TOUCHSCREEN) | 46 | #elif defined(HAVE_TOUCHSCREEN) |
45 | #define TESTCODEC_EXITBUTTON BUTTON_TOPLEFT | 47 | #define TESTCODEC_EXITBUTTON (BUTTON_BOTTOMMIDDLE|BUTTON_REL) |
46 | #else | 48 | #else |
47 | #define TESTCODEC_EXITBUTTON BUTTON_SELECT | 49 | #define TESTCODEC_EXITBUTTON BUTTON_SELECT |
48 | #endif | 50 | #endif |
@@ -807,6 +809,54 @@ exit: | |||
807 | return res; | 809 | return res; |
808 | } | 810 | } |
809 | 811 | ||
812 | #ifdef HAVE_TOUCHSCREEN | ||
813 | void cleanup(void) | ||
814 | { | ||
815 | rb->screens[0]->set_viewport(NULL); | ||
816 | } | ||
817 | #endif | ||
818 | |||
819 | |||
820 | static struct touchbutton button[] = { | ||
821 | { | ||
822 | .action = ACTION_STD_OK, | ||
823 | .title = "OK", | ||
824 | /* viewport runtime initialized, rest false/NULL */ | ||
825 | } | ||
826 | }; | ||
827 | |||
828 | void plugin_quit(void) | ||
829 | { | ||
830 | int btn; | ||
831 | #ifdef HAVE_TOUCHSCREEN | ||
832 | struct viewport *vp = &button[0].vp; | ||
833 | struct screen *lcd = rb->screens[SCREEN_MAIN]; | ||
834 | rb->viewport_set_defaults(vp, SCREEN_MAIN); | ||
835 | const int border = 10; | ||
836 | const int height = 50; | ||
837 | |||
838 | lcd->set_viewport(vp); | ||
839 | /* button matches the bottom center in the grid */ | ||
840 | vp->x = lcd->lcdwidth/3; | ||
841 | vp->width = lcd->lcdwidth/3; | ||
842 | vp->height = height; | ||
843 | vp->y = lcd->lcdheight - height - border; | ||
844 | |||
845 | touchbutton_draw(button, ARRAYLEN(button)); | ||
846 | lcd->update_viewport(); | ||
847 | if (rb->touchscreen_get_mode() == TOUCHSCREEN_POINT) | ||
848 | { | ||
849 | while (codec_action != CODEC_ACTION_HALT && | ||
850 | touchbutton_get(button, ARRAYLEN(button)) != ACTION_STD_OK); | ||
851 | } | ||
852 | else | ||
853 | #endif | ||
854 | do { | ||
855 | btn = rb->button_get(true); | ||
856 | exit_on_usb(btn); | ||
857 | } while (codec_action != CODEC_ACTION_HALT && btn != TESTCODEC_EXITBUTTON); | ||
858 | } | ||
859 | |||
810 | /* plugin entry point */ | 860 | /* plugin entry point */ |
811 | enum plugin_status plugin_start(const void* parameter) | 861 | enum plugin_status plugin_start(const void* parameter) |
812 | { | 862 | { |
@@ -839,6 +889,10 @@ enum plugin_status plugin_start(const void* parameter) | |||
839 | rb->lcd_clear_display(); | 889 | rb->lcd_clear_display(); |
840 | rb->lcd_update(); | 890 | rb->lcd_update(); |
841 | 891 | ||
892 | #ifdef HAVE_TOUCHSCREEN | ||
893 | rb->touchscreen_set_mode(rb->global_settings->touch_mode); | ||
894 | #endif | ||
895 | |||
842 | enum | 896 | enum |
843 | { | 897 | { |
844 | SPEED_TEST = 0, | 898 | SPEED_TEST = 0, |
@@ -980,10 +1034,8 @@ menu: | |||
980 | close_wav(); | 1034 | close_wav(); |
981 | log_text("Wrote /test.wav",true); | 1035 | log_text("Wrote /test.wav",true); |
982 | } | 1036 | } |
983 | |||
984 | while (codec_action != CODEC_ACTION_HALT && | ||
985 | rb->button_get(true) != TESTCODEC_EXITBUTTON); | ||
986 | } | 1037 | } |
1038 | plugin_quit(); | ||
987 | 1039 | ||
988 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 1040 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
989 | if(boost) | 1041 | if(boost) |