summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2021-03-15 23:29:24 +0100
committerSolomon Peachy <pizza@shaftnet.org>2021-03-16 13:05:12 +0000
commit576b56b35a2bb74b77f5b399189ee6e16de9f4c9 (patch)
tree07bb42e906a7e1fb9a62dc094f8df7116fbc1bea
parent46085c897854d145b5313c009fb70af428f0e6bd (diff)
downloadrockbox-576b56b35a2bb74b77f5b399189ee6e16de9f4c9.tar.gz
rockbox-576b56b35a2bb74b77f5b399189ee6e16de9f4c9.zip
Offer function to Clear List & Play Shuffled when playback is stopped
(as per multiple user requests) When playback is stopped, Rockbox will display an option to clear the current playlist and add selected tracks in random order, if Shuffled Adding options are enabled in Settings. Insert options will not be displayed anymore when playback is stopped to lessen confusion. Change-Id: I5e5819149027e63e5c6f30213e838c0d7e7de8d5
-rw-r--r--apps/lang/english.lang14
-rw-r--r--apps/onplay.c38
-rw-r--r--manual/working_with_playlists/main.tex5
3 files changed, 40 insertions, 17 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 80a29601a0..8365e9d265 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -15673,4 +15673,18 @@
15673 <voice> 15673 <voice>
15674 *: "In Submenu" 15674 *: "In Submenu"
15675 </voice> 15675 </voice>
15676</phrase>
15677<phrase>
15678 id: LANG_CLEAR_LIST_AND_PLAY_SHUFFLED
15679 desc: in onplay menu. Replace current playlist with selected tracks in random order.
15680 user: core
15681 <source>
15682 *: "Clear List & Play Shuffled"
15683 </source>
15684 <dest>
15685 *: "Clear List & Play Shuffled"
15686 </dest>
15687 <voice>
15688 *: "Clear List & Play Shuffled"
15689 </voice>
15676</phrase> \ No newline at end of file 15690</phrase> \ No newline at end of file
diff --git a/apps/onplay.c b/apps/onplay.c
index be92a2909a..d72f592f2e 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -481,13 +481,9 @@ static bool add_to_playlist(int position, bool queue)
481 bool new_playlist = false; 481 bool new_playlist = false;
482 if (!(audio_status() & AUDIO_STATUS_PLAY)) 482 if (!(audio_status() & AUDIO_STATUS_PLAY))
483 { 483 {
484 new_playlist = true;
484 if (position == PLAYLIST_REPLACE) 485 if (position == PLAYLIST_REPLACE)
485 {
486 new_playlist = true;
487 position = PLAYLIST_INSERT; 486 position = PLAYLIST_INSERT;
488 }
489 else if (global_status.resume_index == -1 || playlist_resume() == -1)
490 new_playlist = true;
491 } 487 }
492 488
493 const char *lines[] = { 489 const char *lines[] = {
@@ -569,7 +565,9 @@ static bool view_playlist(void)
569 565
570static int playlist_insert_func(void *param) 566static int playlist_insert_func(void *param)
571{ 567{
572 if (((intptr_t)param == PLAYLIST_REPLACE) && !warn_on_pl_erase()) 568 if (((intptr_t)param == PLAYLIST_REPLACE ||
569 ((intptr_t)param == PLAYLIST_INSERT_SHUFFLED && !(audio_status() & AUDIO_STATUS_PLAY))) &&
570 !warn_on_pl_erase())
573 return 0; 571 return 0;
574 add_to_playlist((intptr_t)param, false); 572 add_to_playlist((intptr_t)param, false);
575 return 0; 573 return 0;
@@ -592,7 +590,7 @@ static int treeplaylist_callback(int action,
592/* insert items */ 590/* insert items */
593MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT), 591MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT),
594 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT, 592 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT,
595 treeplaylist_callback, Icon_Playlist); 593 treeplaylist_wplayback_callback, Icon_Playlist);
596MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST), 594MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST),
597 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_FIRST, 595 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_FIRST,
598 treeplaylist_wplayback_callback, Icon_Playlist); 596 treeplaylist_wplayback_callback, Icon_Playlist);
@@ -677,6 +675,11 @@ MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_CLEAR_LIST_AND_
677 playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE, 675 playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE,
678 NULL, Icon_Playlist); 676 NULL, Icon_Playlist);
679 677
678MENUITEM_FUNCTION(replace_shuf_pl_item, MENU_FUNC_USEPARAM,
679 ID2P(LANG_CLEAR_LIST_AND_PLAY_SHUFFLED), playlist_insert_func,
680 (intptr_t*)PLAYLIST_INSERT_SHUFFLED,
681 treeplaylist_callback, Icon_Playlist);
682
680MAKE_ONPLAYMENU(tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST), 683MAKE_ONPLAYMENU(tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST),
681 treeplaylist_callback, Icon_Playlist, 684 treeplaylist_callback, Icon_Playlist,
682 685
@@ -698,7 +701,8 @@ MAKE_ONPLAYMENU(tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST),
698 &queue_menu, 701 &queue_menu,
699 702
700 /* replace */ 703 /* replace */
701 &replace_pl_item 704 &replace_pl_item,
705 &replace_shuf_pl_item
702 ); 706 );
703static int treeplaylist_callback(int action, 707static int treeplaylist_callback(int action,
704 const struct menu_item_ex *this_item, 708 const struct menu_item_ex *this_item,
@@ -715,11 +719,6 @@ static int treeplaylist_callback(int action,
715 (selected_file_attr & ATTR_DIRECTORY)) 719 (selected_file_attr & ATTR_DIRECTORY))
716 return action; 720 return action;
717 } 721 }
718 else if (this_item == &i_pl_item &&
719 global_status.resume_index != -1)
720 {
721 return action;
722 }
723 else if ((this_item == &q_pl_item || 722 else if ((this_item == &q_pl_item ||
724 this_item == &q_first_pl_item || 723 this_item == &q_first_pl_item ||
725 this_item == &q_last_pl_item) && 724 this_item == &q_last_pl_item) &&
@@ -731,9 +730,16 @@ static int treeplaylist_callback(int action,
731 else if (this_item == &i_shuf_pl_item) 730 else if (this_item == &i_shuf_pl_item)
732 { 731 {
733 if (global_settings.show_shuffled_adding_options && 732 if (global_settings.show_shuffled_adding_options &&
734 (global_status.resume_index != -1) && 733 (audio_status() & AUDIO_STATUS_PLAY))
735 ((audio_status() & AUDIO_STATUS_PLAY) || 734 {
736 (selected_file_attr & ATTR_DIRECTORY) || 735 return action;
736 }
737 }
738 else if (this_item == &replace_shuf_pl_item)
739 {
740 if (global_settings.show_shuffled_adding_options &&
741 !(audio_status() & AUDIO_STATUS_PLAY) &&
742 ((selected_file_attr & ATTR_DIRECTORY) ||
737 ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))) 743 ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U)))
738 { 744 {
739 return action; 745 return action;
diff --git a/manual/working_with_playlists/main.tex b/manual/working_with_playlists/main.tex
index 8bc233d346..4a8a0174ab 100644
--- a/manual/working_with_playlists/main.tex
+++ b/manual/working_with_playlists/main.tex
@@ -95,8 +95,11 @@ have not been added yet, immediately after the currently playing track.
95 95
96\item [Insert Last Shuffled.] Add tracks in a random order to the end of the playlist. 96\item [Insert Last Shuffled.] Add tracks in a random order to the end of the playlist.
97 97
98\item [Clear List \& Play Next.] Replaces all tracks in the dynamic playlist. 98\item [Clear List \& Play Next.] Replace all tracks in the dynamic playlist.
99If a track is currently playing, it is only removed once it’s finished playing. 99If a track is currently playing, it is only removed once it’s finished playing.
100
101\item [Clear List \& Play Shuffled.] Replace dynamic playlist with selected tracks
102in random order. Available, if playback is stopped.
100\end{description} 103\end{description}
101 104
102There are also options for adding tracks only temporarily to the dynamic playlist. 105There are also options for adding tracks only temporarily to the dynamic playlist.