diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/wps.c | 11 | ||||
-rw-r--r-- | apps/menus/playlist_menu.c | 12 | ||||
-rw-r--r-- | apps/onplay.c | 8 | ||||
-rw-r--r-- | apps/onplay.h | 3 | ||||
-rw-r--r-- | apps/playlist_viewer.c | 32 | ||||
-rw-r--r-- | apps/playlist_viewer.h | 10 | ||||
-rw-r--r-- | apps/root_menu.c | 18 | ||||
-rw-r--r-- | apps/root_menu.h | 1 |
8 files changed, 60 insertions, 35 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index fb703062cd..6afed43213 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -859,11 +859,14 @@ long gui_wps_show(void) | |||
859 | case ACTION_WPS_CONTEXT: | 859 | case ACTION_WPS_CONTEXT: |
860 | { | 860 | { |
861 | gwps_leave_wps(); | 861 | gwps_leave_wps(); |
862 | int retval = onplay(wps_state.id3->path, | ||
863 | FILE_ATTR_AUDIO, CONTEXT_WPS); | ||
862 | /* if music is stopped in the context menu we want to exit the wps */ | 864 | /* if music is stopped in the context menu we want to exit the wps */ |
863 | if (onplay(wps_state.id3->path, | 865 | if (retval == ONPLAY_MAINMENU |
864 | FILE_ATTR_AUDIO, CONTEXT_WPS) == ONPLAY_MAINMENU | ||
865 | || !audio_status()) | 866 | || !audio_status()) |
866 | return GO_TO_ROOT; | 867 | return GO_TO_ROOT; |
868 | else if (retval == ONPLAY_PLAYLIST) | ||
869 | return GO_TO_PLAYLIST_VIEWER; | ||
867 | restore = true; | 870 | restore = true; |
868 | } | 871 | } |
869 | break; | 872 | break; |
@@ -1150,9 +1153,7 @@ long gui_wps_show(void) | |||
1150 | break; | 1153 | break; |
1151 | case ACTION_WPS_VIEW_PLAYLIST: | 1154 | case ACTION_WPS_VIEW_PLAYLIST: |
1152 | gwps_leave_wps(); | 1155 | gwps_leave_wps(); |
1153 | if (playlist_viewer()) /* true if USB connected */ | 1156 | return GO_TO_PLAYLIST_VIEWER; |
1154 | return GO_TO_ROOT; | ||
1155 | restore = true; | ||
1156 | break; | 1157 | break; |
1157 | default: | 1158 | default: |
1158 | if(default_event_handler(button) == SYS_USB_CONNECTED) | 1159 | if(default_event_handler(button) == SYS_USB_CONNECTED) |
diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c index 87a61a9b83..aa4a0604ba 100644 --- a/apps/menus/playlist_menu.c +++ b/apps/menus/playlist_menu.c | |||
@@ -60,10 +60,16 @@ int save_playlist_screen(struct playlist_info* playlist) | |||
60 | 60 | ||
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
63 | |||
64 | static int playlist_view_(void) | ||
65 | { | ||
66 | return GO_TO_PLAYLIST_VIEWER; | ||
67 | } | ||
68 | |||
63 | MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST), | 69 | MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST), |
64 | (int(*)(void))create_playlist, NULL, NULL, Icon_NOICON); | 70 | (int(*)(void))create_playlist, NULL, NULL, Icon_NOICON); |
65 | MENUITEM_FUNCTION(view_playlist, 0, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), | 71 | MENUITEM_FUNCTION(view_cur_playlist, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), |
66 | (int(*)(void))playlist_viewer, NULL, NULL, Icon_NOICON); | 72 | (int(*)(void))playlist_view_, NULL, NULL, Icon_NOICON); |
67 | MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), | 73 | MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), |
68 | (int(*)(void*))save_playlist_screen, | 74 | (int(*)(void*))save_playlist_screen, |
69 | NULL, NULL, Icon_NOICON); | 75 | NULL, NULL, Icon_NOICON); |
@@ -78,5 +84,5 @@ MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL, | |||
78 | &recursive_dir_insert, &warn_on_erase); | 84 | &recursive_dir_insert, &warn_on_erase); |
79 | MAKE_MENU(playlist_options, ID2P(LANG_PLAYLISTS), NULL, | 85 | MAKE_MENU(playlist_options, ID2P(LANG_PLAYLISTS), NULL, |
80 | Icon_Playlist, | 86 | Icon_Playlist, |
81 | &create_playlist_item, &view_playlist, &save_playlist, &catalog); | 87 | &create_playlist_item, &view_cur_playlist, &save_playlist, &catalog); |
82 | 88 | ||
diff --git a/apps/onplay.c b/apps/onplay.c index da3900ddc8..8bff92f760 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -137,15 +137,13 @@ static bool shuffle_playlist(void) | |||
137 | 137 | ||
138 | return false; | 138 | return false; |
139 | } | 139 | } |
140 | |||
141 | static bool save_playlist(void) | 140 | static bool save_playlist(void) |
142 | { | 141 | { |
143 | save_playlist_screen(NULL); | 142 | save_playlist_screen(NULL); |
144 | return false; | 143 | return false; |
145 | } | 144 | } |
146 | 145 | ||
147 | MENUITEM_FUNCTION(playlist_viewer_item, 0, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), | 146 | extern struct menu_item_ex view_cur_playlist; /* from playlist_menu.c */ |
148 | playlist_viewer, NULL, NULL, Icon_Playlist); | ||
149 | MENUITEM_FUNCTION(search_playlist_item, 0, ID2P(LANG_SEARCH_IN_PLAYLIST), | 147 | MENUITEM_FUNCTION(search_playlist_item, 0, ID2P(LANG_SEARCH_IN_PLAYLIST), |
150 | search_playlist, NULL, NULL, Icon_Playlist); | 148 | search_playlist, NULL, NULL, Icon_Playlist); |
151 | MENUITEM_FUNCTION(playlist_save_item, 0, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), | 149 | MENUITEM_FUNCTION(playlist_save_item, 0, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), |
@@ -154,7 +152,7 @@ MENUITEM_FUNCTION(reshuffle_item, 0, ID2P(LANG_SHUFFLE_PLAYLIST), | |||
154 | shuffle_playlist, NULL, NULL, Icon_Playlist); | 152 | shuffle_playlist, NULL, NULL, Icon_Playlist); |
155 | MAKE_ONPLAYMENU( wps_playlist_menu, ID2P(LANG_PLAYLIST), | 153 | MAKE_ONPLAYMENU( wps_playlist_menu, ID2P(LANG_PLAYLIST), |
156 | NULL, Icon_Playlist, | 154 | NULL, Icon_Playlist, |
157 | &playlist_viewer_item, &search_playlist_item, | 155 | &view_cur_playlist, &search_playlist_item, |
158 | &playlist_save_item, &reshuffle_item | 156 | &playlist_save_item, &reshuffle_item |
159 | ); | 157 | ); |
160 | 158 | ||
@@ -1188,6 +1186,8 @@ int onplay(char* file, int attr, int from) | |||
1188 | case GO_TO_ROOT: | 1186 | case GO_TO_ROOT: |
1189 | case GO_TO_MAINMENU: | 1187 | case GO_TO_MAINMENU: |
1190 | return ONPLAY_MAINMENU; | 1188 | return ONPLAY_MAINMENU; |
1189 | case GO_TO_PLAYLIST_VIEWER: | ||
1190 | return ONPLAY_PLAYLIST; | ||
1191 | default: | 1191 | default: |
1192 | return onplay_result; | 1192 | return onplay_result; |
1193 | } | 1193 | } |
diff --git a/apps/onplay.h b/apps/onplay.h index 23886df315..b0f1a187a3 100644 --- a/apps/onplay.h +++ b/apps/onplay.h | |||
@@ -27,7 +27,8 @@ enum { | |||
27 | ONPLAY_MAINMENU = -1, | 27 | ONPLAY_MAINMENU = -1, |
28 | ONPLAY_OK = 0, | 28 | ONPLAY_OK = 0, |
29 | ONPLAY_RELOAD_DIR, | 29 | ONPLAY_RELOAD_DIR, |
30 | ONPLAY_START_PLAY | 30 | ONPLAY_START_PLAY, |
31 | ONPLAY_PLAYLIST, | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | #endif | 34 | #endif |
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 0a247fa01d..e2be36ce5d 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c | |||
@@ -448,7 +448,8 @@ static int onplay_menu(int index) | |||
448 | playlist_buffer_get_track(&viewer.buffer, index); | 448 | playlist_buffer_get_track(&viewer.buffer, index); |
449 | MENUITEM_STRINGLIST(menu_items, ID2P(LANG_PLAYLIST), NULL, | 449 | MENUITEM_STRINGLIST(menu_items, ID2P(LANG_PLAYLIST), NULL, |
450 | ID2P(LANG_REMOVE), ID2P(LANG_MOVE), | 450 | ID2P(LANG_REMOVE), ID2P(LANG_MOVE), |
451 | ID2P(LANG_CATALOG_ADD_TO), ID2P(LANG_CATALOG_ADD_TO_NEW)); | 451 | ID2P(LANG_CATALOG_ADD_TO), ID2P(LANG_CATALOG_ADD_TO_NEW), |
452 | ID2P(LANG_PLAYLISTVIEWER_SETTINGS)); | ||
452 | bool current = (current_track->index == viewer.current_playing_track); | 453 | bool current = (current_track->index == viewer.current_playing_track); |
453 | 454 | ||
454 | result = do_menu(&menu_items, NULL, NULL, false); | 455 | result = do_menu(&menu_items, NULL, NULL, false); |
@@ -503,6 +504,10 @@ static int onplay_menu(int index) | |||
503 | result==3, NULL); | 504 | result==3, NULL); |
504 | ret = 0; | 505 | ret = 0; |
505 | break; | 506 | break; |
507 | case 4: /* playlist viewer settings */ | ||
508 | /* true on usb connect */ | ||
509 | ret = viewer_menu() ? -1 : 0; | ||
510 | break; | ||
506 | } | 511 | } |
507 | } | 512 | } |
508 | return ret; | 513 | return ret; |
@@ -531,7 +536,7 @@ static int save_playlist_func(void) | |||
531 | } | 536 | } |
532 | 537 | ||
533 | /* View current playlist */ | 538 | /* View current playlist */ |
534 | bool playlist_viewer(void) | 539 | enum playlist_viewer_result playlist_viewer(void) |
535 | { | 540 | { |
536 | return playlist_viewer_ex(NULL); | 541 | return playlist_viewer_ex(NULL); |
537 | } | 542 | } |
@@ -606,9 +611,9 @@ static enum themable_icons playlist_callback_icons(int selected_item, | |||
606 | 611 | ||
607 | /* Main viewer function. Filename identifies playlist to be viewed. If NULL, | 612 | /* Main viewer function. Filename identifies playlist to be viewed. If NULL, |
608 | view current playlist. */ | 613 | view current playlist. */ |
609 | bool playlist_viewer_ex(const char* filename) | 614 | enum playlist_viewer_result playlist_viewer_ex(const char* filename) |
610 | { | 615 | { |
611 | bool ret = false; /* return value */ | 616 | enum playlist_viewer_result ret = PLAYLIST_VIEWER_OK; |
612 | bool exit=false; /* exit viewer */ | 617 | bool exit=false; /* exit viewer */ |
613 | int button; | 618 | int button; |
614 | struct gui_synclist playlist_lists; | 619 | struct gui_synclist playlist_lists; |
@@ -730,7 +735,7 @@ bool playlist_viewer_ex(const char* filename) | |||
730 | 735 | ||
731 | if (ret_val < 0) | 736 | if (ret_val < 0) |
732 | { | 737 | { |
733 | ret = true; | 738 | ret = PLAYLIST_VIEWER_USB; |
734 | goto exit; | 739 | goto exit; |
735 | } | 740 | } |
736 | else if (ret_val > 0) | 741 | else if (ret_val > 0) |
@@ -747,23 +752,12 @@ bool playlist_viewer_ex(const char* filename) | |||
747 | break; | 752 | break; |
748 | } | 753 | } |
749 | case ACTION_STD_MENU: | 754 | case ACTION_STD_MENU: |
750 | if (viewer_menu()) | 755 | ret = PLAYLIST_VIEWER_MAINMENU; |
751 | { | 756 | goto exit; |
752 | ret = true; | ||
753 | goto exit; | ||
754 | } | ||
755 | gui_synclist_set_icon_callback( | ||
756 | &playlist_lists, | ||
757 | global_settings.playlist_viewer_icons? | ||
758 | &playlist_callback_icons:NULL | ||
759 | ); | ||
760 | gui_synclist_draw(&playlist_lists); | ||
761 | break; | ||
762 | |||
763 | default: | 757 | default: |
764 | if(default_event_handler(button) == SYS_USB_CONNECTED) | 758 | if(default_event_handler(button) == SYS_USB_CONNECTED) |
765 | { | 759 | { |
766 | ret = true; | 760 | ret = PLAYLIST_VIEWER_USB; |
767 | goto exit; | 761 | goto exit; |
768 | } | 762 | } |
769 | break; | 763 | break; |
diff --git a/apps/playlist_viewer.h b/apps/playlist_viewer.h index 8526d032e7..97f5b0baef 100644 --- a/apps/playlist_viewer.h +++ b/apps/playlist_viewer.h | |||
@@ -23,8 +23,14 @@ | |||
23 | #ifndef _PLAYLIST_VIEWER_H_ | 23 | #ifndef _PLAYLIST_VIEWER_H_ |
24 | #define _PLAYLIST_VIEWER_H_ | 24 | #define _PLAYLIST_VIEWER_H_ |
25 | 25 | ||
26 | bool playlist_viewer(void); | 26 | enum playlist_viewer_result playlist_viewer(void); |
27 | bool playlist_viewer_ex(const char* filename); | 27 | enum playlist_viewer_result playlist_viewer_ex(const char* filename); |
28 | bool search_playlist(void); | 28 | bool search_playlist(void); |
29 | 29 | ||
30 | enum playlist_viewer_result { | ||
31 | PLAYLIST_VIEWER_OK, | ||
32 | PLAYLIST_VIEWER_USB, | ||
33 | PLAYLIST_VIEWER_MAINMENU, | ||
34 | }; | ||
35 | |||
30 | #endif | 36 | #endif |
diff --git a/apps/root_menu.c b/apps/root_menu.c index 01ba3a072d..5124375490 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include "wps.h" | 60 | #include "wps.h" |
61 | #include "bookmark.h" | 61 | #include "bookmark.h" |
62 | #include "playlist.h" | 62 | #include "playlist.h" |
63 | #include "playlist_viewer.h" | ||
63 | #include "menus/exported_menus.h" | 64 | #include "menus/exported_menus.h" |
64 | #ifdef HAVE_RTC_ALARM | 65 | #ifdef HAVE_RTC_ALARM |
65 | #include "rtc.h" | 66 | #include "rtc.h" |
@@ -313,6 +314,20 @@ static int radio(void* param) | |||
313 | } | 314 | } |
314 | #endif | 315 | #endif |
315 | 316 | ||
317 | static int playlist_view(void * param) | ||
318 | { | ||
319 | (void)param; | ||
320 | switch (playlist_viewer()) | ||
321 | { | ||
322 | case PLAYLIST_VIEWER_MAINMENU: | ||
323 | case PLAYLIST_VIEWER_USB: | ||
324 | return GO_TO_ROOT; | ||
325 | case PLAYLIST_VIEWER_OK: | ||
326 | return GO_TO_PREVIOUS; | ||
327 | } | ||
328 | return GO_TO_PREVIOUS; | ||
329 | } | ||
330 | |||
316 | static int load_bmarks(void* param) | 331 | static int load_bmarks(void* param) |
317 | { | 332 | { |
318 | (void)param; | 333 | (void)param; |
@@ -381,7 +396,8 @@ static const struct root_items items[] = { | |||
381 | #endif | 396 | #endif |
382 | 397 | ||
383 | [GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu }, | 398 | [GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu }, |
384 | [GO_TO_BROWSEPLUGINS] = { plugins_menu, NULL, NULL }, | 399 | [GO_TO_BROWSEPLUGINS] = { plugins_menu, NULL, NULL }, |
400 | [GO_TO_PLAYLIST_VIEWER] = { playlist_view, NULL, NULL }, | ||
385 | 401 | ||
386 | }; | 402 | }; |
387 | static const int nb_items = sizeof(items)/sizeof(*items); | 403 | static const int nb_items = sizeof(items)/sizeof(*items); |
diff --git a/apps/root_menu.h b/apps/root_menu.h index 10904829d1..4113b64495 100644 --- a/apps/root_menu.h +++ b/apps/root_menu.h | |||
@@ -52,6 +52,7 @@ enum { | |||
52 | will need editing if this is the case. */ | 52 | will need editing if this is the case. */ |
53 | GO_TO_BROWSEPLUGINS, | 53 | GO_TO_BROWSEPLUGINS, |
54 | GO_TO_TIMESCREEN, | 54 | GO_TO_TIMESCREEN, |
55 | GO_TO_PLAYLIST_VIEWER, | ||
55 | }; | 56 | }; |
56 | 57 | ||
57 | extern const struct menu_item_ex root_menu_; | 58 | extern const struct menu_item_ex root_menu_; |