summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/lang/english.lang14
-rw-r--r--apps/onplay.c38
2 files changed, 36 insertions, 16 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;