summaryrefslogtreecommitdiff
path: root/apps/onplay.c
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2021-03-09 03:57:23 +0100
committerSolomon Peachy <pizza@shaftnet.org>2021-03-09 11:18:22 +0000
commit3b9a803a5b4f1e94339e7bb9724400a096900306 (patch)
treeab10bf8356e66f85f4089ba8d5ba9d4485656b34 /apps/onplay.c
parent13178d23b82ffde13fdbf8e36cfa0358f22e8dc3 (diff)
downloadrockbox-3b9a803a5b4f1e94339e7bb9724400a096900306.tar.gz
rockbox-3b9a803a5b4f1e94339e7bb9724400a096900306.zip
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
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c29
1 files changed, 23 insertions, 6 deletions
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),
477/* CONTEXT_[TREE|ID3DB] playlist options */ 477/* CONTEXT_[TREE|ID3DB] playlist options */
478static bool add_to_playlist(int position, bool queue) 478static bool add_to_playlist(int position, bool queue)
479{ 479{
480 bool new_playlist = !(audio_status() & AUDIO_STATUS_PLAY) && (global_status.resume_index == -1 || playlist_resume() == -1); 480 bool new_playlist = false;
481 if (!(audio_status() & AUDIO_STATUS_PLAY))
482 {
483 if (position == PLAYLIST_REPLACE)
484 {
485 new_playlist = true;
486 position = PLAYLIST_INSERT;
487 }
488 else if (global_status.resume_index == -1 || playlist_resume() == -1)
489 new_playlist = true;
490 }
491
481 const char *lines[] = { 492 const char *lines[] = {
482 ID2P(LANG_RECURSE_DIRECTORY_QUESTION), 493 ID2P(LANG_RECURSE_DIRECTORY_QUESTION),
483 selected_file 494 selected_file
@@ -594,7 +605,7 @@ static int treeplaylist_callback(int action,
594/* insert items */ 605/* insert items */
595MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT), 606MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT),
596 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT, 607 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT,
597 NULL, Icon_Playlist); 608 treeplaylist_callback, Icon_Playlist);
598MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST), 609MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST),
599 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_FIRST, 610 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_FIRST,
600 treeplaylist_wplayback_callback, Icon_Playlist); 611 treeplaylist_wplayback_callback, Icon_Playlist);
@@ -630,7 +641,7 @@ MENUITEM_FUNCTION(q_last_shuf_pl_item, MENU_FUNC_USEPARAM,
630/* replace playlist */ 641/* replace playlist */
631MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_REPLACE), 642MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_REPLACE),
632 playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE, 643 playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE,
633 treeplaylist_wplayback_callback, Icon_Playlist); 644 NULL, Icon_Playlist);
634 645
635/* others */ 646/* others */
636MENUITEM_FUNCTION(view_playlist_item, 0, ID2P(LANG_VIEW), 647MENUITEM_FUNCTION(view_playlist_item, 0, ID2P(LANG_VIEW),
@@ -680,11 +691,17 @@ static int treeplaylist_callback(int action,
680 return action; 691 return action;
681 } 692 }
682 } 693 }
694 else if (this_item == &i_pl_item)
695 {
696 if (global_status.resume_index != -1)
697 return action;
698 }
683 else if (this_item == &i_shuf_pl_item) 699 else if (this_item == &i_shuf_pl_item)
684 { 700 {
685 if ((audio_status() & AUDIO_STATUS_PLAY) || 701 if ((global_status.resume_index != -1) &&
686 (selected_file_attr & ATTR_DIRECTORY) || 702 ((audio_status() & AUDIO_STATUS_PLAY) ||
687 ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U)) 703 (selected_file_attr & ATTR_DIRECTORY) ||
704 ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U)))
688 { 705 {
689 return action; 706 return action;
690 } 707 }