diff options
Diffstat (limited to 'apps/onplay.c')
-rw-r--r-- | apps/onplay.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index d468c0a545..a259e88c58 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -138,7 +138,7 @@ static bool clipboard_clip(struct clipboard *clip, const char *path, | |||
138 | static int bookmark_load_menu_wrapper(void) | 138 | static int bookmark_load_menu_wrapper(void) |
139 | { | 139 | { |
140 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ | 140 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ |
141 | pop_current_activity_without_refresh(); /* when called from ctxt menu */ | 141 | pop_current_activity_without_refresh(); /* when called from ctxt menu */ |
142 | 142 | ||
143 | return bookmark_load_menu(); | 143 | return bookmark_load_menu(); |
144 | } | 144 | } |
@@ -211,6 +211,13 @@ static void playing_time(void) | |||
211 | plugin_load(PLUGIN_APPS_DIR"/playing_time.rock", NULL); | 211 | plugin_load(PLUGIN_APPS_DIR"/playing_time.rock", NULL); |
212 | } | 212 | } |
213 | 213 | ||
214 | #ifdef HAVE_ALBUMART | ||
215 | static void view_album_art(void) | ||
216 | { | ||
217 | plugin_load(VIEWERS_DIR"/imageviewer.rock", NULL); | ||
218 | } | ||
219 | #endif | ||
220 | |||
214 | MENUITEM_FUNCTION(wps_view_cur_playlist_item, 0, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), | 221 | MENUITEM_FUNCTION(wps_view_cur_playlist_item, 0, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), |
215 | wps_view_cur_playlist, NULL, Icon_NOICON); | 222 | wps_view_cur_playlist, NULL, Icon_NOICON); |
216 | MENUITEM_FUNCTION(search_playlist_item, 0, ID2P(LANG_SEARCH_IN_PLAYLIST), | 223 | MENUITEM_FUNCTION(search_playlist_item, 0, ID2P(LANG_SEARCH_IN_PLAYLIST), |
@@ -302,7 +309,7 @@ static int add_to_playlist(void* arg) | |||
302 | 309 | ||
303 | /* warn if replacing the playlist */ | 310 | /* warn if replacing the playlist */ |
304 | if (new_playlist && !warn_on_pl_erase()) | 311 | if (new_playlist && !warn_on_pl_erase()) |
305 | return 0; | 312 | return 1; |
306 | 313 | ||
307 | splash(0, ID2P(LANG_WAIT)); | 314 | splash(0, ID2P(LANG_WAIT)); |
308 | 315 | ||
@@ -340,7 +347,7 @@ static int add_to_playlist(void* arg) | |||
340 | } | 347 | } |
341 | 348 | ||
342 | playlist_set_modified(NULL, true); | 349 | playlist_set_modified(NULL, true); |
343 | return false; | 350 | return 0; |
344 | } | 351 | } |
345 | 352 | ||
346 | static bool view_playlist(void) | 353 | static bool view_playlist(void) |
@@ -689,7 +696,7 @@ MENUITEM_FUNCTION(view_cue_item, 0, ID2P(LANG_BROWSE_CUESHEET), | |||
689 | static int browse_id3_wrapper(void) | 696 | static int browse_id3_wrapper(void) |
690 | { | 697 | { |
691 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ | 698 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ |
692 | pop_current_activity_without_refresh(); /* when called from ctxt menu */ | 699 | pop_current_activity_without_refresh(); /* when called from ctxt menu */ |
693 | 700 | ||
694 | if (browse_id3(audio_current_track(), | 701 | if (browse_id3(audio_current_track(), |
695 | playlist_get_display_index(), | 702 | playlist_get_display_index(), |
@@ -705,6 +712,10 @@ MENUITEM_FUNCTION(browse_id3_item, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_MENU_SHOW_I | |||
705 | MENUITEM_FUNCTION(pitch_screen_item, 0, ID2P(LANG_PITCH), | 712 | MENUITEM_FUNCTION(pitch_screen_item, 0, ID2P(LANG_PITCH), |
706 | gui_syncpitchscreen_run, NULL, Icon_Audio); | 713 | gui_syncpitchscreen_run, NULL, Icon_Audio); |
707 | #endif | 714 | #endif |
715 | #ifdef HAVE_ALBUMART | ||
716 | MENUITEM_FUNCTION(view_album_art_item, 0, ID2P(LANG_VIEW_ALBUMART), | ||
717 | view_album_art, NULL, Icon_NOICON); | ||
718 | #endif | ||
708 | 719 | ||
709 | static int clipboard_delete_selected_fileobject(void) | 720 | static int clipboard_delete_selected_fileobject(void) |
710 | { | 721 | { |
@@ -806,6 +817,10 @@ static bool onplay_load_plugin(void *param) | |||
806 | if (!prepare_database_sel(param)) | 817 | if (!prepare_database_sel(param)) |
807 | return false; | 818 | return false; |
808 | #endif | 819 | #endif |
820 | |||
821 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ | ||
822 | pop_current_activity_without_refresh(); /* when called from ctxt menu */ | ||
823 | |||
809 | int ret = filetype_load_plugin((const char*)param, selected_file.path); | 824 | int ret = filetype_load_plugin((const char*)param, selected_file.path); |
810 | if (ret == PLUGIN_USB_CONNECTED) | 825 | if (ret == PLUGIN_USB_CONNECTED) |
811 | onplay_result = ONPLAY_RELOAD_DIR; | 826 | onplay_result = ONPLAY_RELOAD_DIR; |
@@ -1024,6 +1039,9 @@ MAKE_ONPLAYMENU( wps_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE), | |||
1024 | #ifdef HAVE_PITCHCONTROL | 1039 | #ifdef HAVE_PITCHCONTROL |
1025 | &pitch_screen_item, | 1040 | &pitch_screen_item, |
1026 | #endif | 1041 | #endif |
1042 | #ifdef HAVE_ALBUMART | ||
1043 | &view_album_art_item, | ||
1044 | #endif | ||
1027 | ); | 1045 | ); |
1028 | 1046 | ||
1029 | MENUITEM_FUNCTION(view_playlist_item, 0, ID2P(LANG_VIEW), | 1047 | MENUITEM_FUNCTION(view_playlist_item, 0, ID2P(LANG_VIEW), |
@@ -1251,7 +1269,7 @@ static int execute_hotkey(bool is_wps) | |||
1251 | } | 1269 | } |
1252 | #endif /* HOTKEY */ | 1270 | #endif /* HOTKEY */ |
1253 | 1271 | ||
1254 | int onplay(char* file, int attr, int from_context, bool hotkey) | 1272 | int onplay(char* file, int attr, int from_context, bool hotkey, int customaction) |
1255 | { | 1273 | { |
1256 | const struct menu_item_ex *menu; | 1274 | const struct menu_item_ex *menu; |
1257 | onplay_result = ONPLAY_OK; | 1275 | onplay_result = ONPLAY_OK; |
@@ -1290,6 +1308,14 @@ int onplay(char* file, int attr, int from_context, bool hotkey) | |||
1290 | #else | 1308 | #else |
1291 | (void)hotkey; | 1309 | (void)hotkey; |
1292 | #endif | 1310 | #endif |
1311 | if (customaction == ONPLAY_CUSTOMACTION_SHUFFLE_SONGS) | ||
1312 | { | ||
1313 | int returnCode = add_to_playlist(&addtopl_replace_shuffled); | ||
1314 | if (returnCode == 1) | ||
1315 | // User did not want to erase his current playlist, so let's show again the database main menu | ||
1316 | return ONPLAY_RELOAD_DIR; | ||
1317 | return ONPLAY_START_PLAY; | ||
1318 | } | ||
1293 | 1319 | ||
1294 | push_current_activity(ACTIVITY_CONTEXTMENU); | 1320 | push_current_activity(ACTIVITY_CONTEXTMENU); |
1295 | if (from_context == CONTEXT_WPS) | 1321 | if (from_context == CONTEXT_WPS) |
@@ -1299,7 +1325,7 @@ int onplay(char* file, int attr, int from_context, bool hotkey) | |||
1299 | menu_selection = do_menu(menu, NULL, NULL, false); | 1325 | menu_selection = do_menu(menu, NULL, NULL, false); |
1300 | 1326 | ||
1301 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* Activity may have been */ | 1327 | if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* Activity may have been */ |
1302 | pop_current_activity(); /* popped already by menu item */ | 1328 | pop_current_activity(); /* popped already by menu item */ |
1303 | 1329 | ||
1304 | 1330 | ||
1305 | if (menu_selection == GO_TO_WPS) | 1331 | if (menu_selection == GO_TO_WPS) |