From 3b9a803a5b4f1e94339e7bb9724400a096900306 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Tue, 9 Mar 2021 03:57:23 +0100 Subject: Show 'Play Next' option when playback is stopped 1) The Insert functionality was changed in abebc6b to not delete unfinished dynamic playlists anymore. "Play Next" has now been added as an option when playback is stopped. The behavior of "Play Next" as such has not changed and it is now the consistent way to replace a current playlist in all playback modes. 2) The 'Insert' and 'Insert Shuffle' options will now only be displayed if there is a resumable dynamic playlist Change-Id: Ib5c5469b9e2c583ab06e0f47a922c24e5adf6b5f --- apps/onplay.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'apps/onplay.c') diff --git a/apps/onplay.c b/apps/onplay.c index e7f7e589db..6f29df57cb 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -477,7 +477,18 @@ MAKE_ONPLAYMENU( wps_playlist_menu, ID2P(LANG_PLAYLIST), /* CONTEXT_[TREE|ID3DB] playlist options */ static bool add_to_playlist(int position, bool queue) { - bool new_playlist = !(audio_status() & AUDIO_STATUS_PLAY) && (global_status.resume_index == -1 || playlist_resume() == -1); + bool new_playlist = false; + if (!(audio_status() & AUDIO_STATUS_PLAY)) + { + if (position == PLAYLIST_REPLACE) + { + new_playlist = true; + position = PLAYLIST_INSERT; + } + else if (global_status.resume_index == -1 || playlist_resume() == -1) + new_playlist = true; + } + const char *lines[] = { ID2P(LANG_RECURSE_DIRECTORY_QUESTION), selected_file @@ -594,7 +605,7 @@ static int treeplaylist_callback(int action, /* insert items */ MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT), playlist_insert_func, (intptr_t*)PLAYLIST_INSERT, - NULL, Icon_Playlist); + treeplaylist_callback, Icon_Playlist); MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST), playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_FIRST, treeplaylist_wplayback_callback, Icon_Playlist); @@ -630,7 +641,7 @@ MENUITEM_FUNCTION(q_last_shuf_pl_item, MENU_FUNC_USEPARAM, /* replace playlist */ MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_REPLACE), playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE, - treeplaylist_wplayback_callback, Icon_Playlist); + NULL, Icon_Playlist); /* others */ MENUITEM_FUNCTION(view_playlist_item, 0, ID2P(LANG_VIEW), @@ -680,11 +691,17 @@ static int treeplaylist_callback(int action, return action; } } + else if (this_item == &i_pl_item) + { + if (global_status.resume_index != -1) + return action; + } else if (this_item == &i_shuf_pl_item) { - if ((audio_status() & AUDIO_STATUS_PLAY) || - (selected_file_attr & ATTR_DIRECTORY) || - ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U)) + if ((global_status.resume_index != -1) && + ((audio_status() & AUDIO_STATUS_PLAY) || + (selected_file_attr & ATTR_DIRECTORY) || + ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))) { return action; } -- cgit v1.2.3