diff options
Diffstat (limited to 'apps/onplay.c')
-rw-r--r-- | apps/onplay.c | 38 |
1 files changed, 22 insertions, 16 deletions
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 | ||
570 | static int playlist_insert_func(void *param) | 566 | static 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 */ |
593 | MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT), | 591 | MENUITEM_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); |
596 | MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST), | 594 | MENUITEM_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 | ||
678 | MENUITEM_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 | |||
680 | MAKE_ONPLAYMENU(tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST), | 683 | MAKE_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 | ); |
703 | static int treeplaylist_callback(int action, | 707 | static 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; |