diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-04-09 15:55:10 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-05-14 16:05:45 +0100 |
commit | 70087fb9f383af48c5fecb1aa275f4a68cda3298 (patch) | |
tree | 59ebc73356039b6f7f072b309eed914adf84572f /apps | |
parent | 7363d65f10ac1b14f6e924ea6b78da355efaa936 (diff) | |
download | rockbox-70087fb9f383af48c5fecb1aa275f4a68cda3298.tar.gz rockbox-70087fb9f383af48c5fecb1aa275f4a68cda3298.zip |
apps: Change playlist context menu behavior, fix FS#13336
Rename the "Clear List & Play" options to simply Play and Play
Shuffled, and change their behavior slightly. Previously they
would leave the current song playing, but now they will start
playing the first song of the new playlist immediately.
Shuffle options are now consistently hidden whenever a single
file is selected.
Fixes FS#13336 -- Play Shuffled is now always displayed where
applicable, regardless of playback state.
Change-Id: Idd454b4f9ab2c98cda3ce0389add747a3273fb42
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/english.lang | 44 | ||||
-rw-r--r-- | apps/onplay.c | 273 |
2 files changed, 154 insertions, 163 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index c843471831..4689660176 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -15807,16 +15807,16 @@ | |||
15807 | </phrase> | 15807 | </phrase> |
15808 | <phrase> | 15808 | <phrase> |
15809 | id: LANG_CLEAR_LIST_AND_PLAY_NEXT | 15809 | id: LANG_CLEAR_LIST_AND_PLAY_NEXT |
15810 | desc: in onplay menu. Replace current playlist with selected tracks | 15810 | desc: deprecated |
15811 | user: core | 15811 | user: core |
15812 | <source> | 15812 | <source> |
15813 | *: "Clear List & Play Next" | 15813 | *: "" |
15814 | </source> | 15814 | </source> |
15815 | <dest> | 15815 | <dest> |
15816 | *: "Clear List & Play Next" | 15816 | *: "" |
15817 | </dest> | 15817 | </dest> |
15818 | <voice> | 15818 | <voice> |
15819 | *: "Clear List & Play Next" | 15819 | *: "" |
15820 | </voice> | 15820 | </voice> |
15821 | </phrase> | 15821 | </phrase> |
15822 | <phrase> | 15822 | <phrase> |
@@ -15877,16 +15877,16 @@ | |||
15877 | </phrase> | 15877 | </phrase> |
15878 | <phrase> | 15878 | <phrase> |
15879 | id: LANG_CLEAR_LIST_AND_PLAY_SHUFFLED | 15879 | id: LANG_CLEAR_LIST_AND_PLAY_SHUFFLED |
15880 | desc: in onplay menu. Replace current playlist with selected tracks in random order. | 15880 | desc: deprecated |
15881 | user: core | 15881 | user: core |
15882 | <source> | 15882 | <source> |
15883 | *: "Clear List & Play Shuffled" | 15883 | *: "" |
15884 | </source> | 15884 | </source> |
15885 | <dest> | 15885 | <dest> |
15886 | *: "Clear List & Play Shuffled" | 15886 | *: "" |
15887 | </dest> | 15887 | </dest> |
15888 | <voice> | 15888 | <voice> |
15889 | *: "Clear List & Play Shuffled" | 15889 | *: "" |
15890 | </voice> | 15890 | </voice> |
15891 | </phrase> | 15891 | </phrase> |
15892 | <phrase> | 15892 | <phrase> |
@@ -16326,3 +16326,31 @@ | |||
16326 | *: "Track Info" | 16326 | *: "Track Info" |
16327 | </voice> | 16327 | </voice> |
16328 | </phrase> | 16328 | </phrase> |
16329 | <phrase> | ||
16330 | id: LANG_PLAY | ||
16331 | desc: play selected file/directory, in playlist context menu | ||
16332 | user: core | ||
16333 | <source> | ||
16334 | *: "Play" | ||
16335 | </source> | ||
16336 | <dest> | ||
16337 | *: "Play" | ||
16338 | </dest> | ||
16339 | <voice> | ||
16340 | *: "Play" | ||
16341 | </voice> | ||
16342 | </phrase> | ||
16343 | <phrase> | ||
16344 | id: LANG_PLAY_SHUFFLED | ||
16345 | desc: play selected files in shuffled order, in playlist context menu | ||
16346 | user: core | ||
16347 | <source> | ||
16348 | *: "Play Shuffled" | ||
16349 | </source> | ||
16350 | <dest> | ||
16351 | *: "Play Shuffled" | ||
16352 | </dest> | ||
16353 | <voice> | ||
16354 | *: "Play Shuffled" | ||
16355 | </voice> | ||
16356 | </phrase> | ||
diff --git a/apps/onplay.c b/apps/onplay.c index a78cf7ceac..729fe40f0a 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -476,16 +476,40 @@ MAKE_ONPLAYMENU( wps_playlist_menu, ID2P(LANG_PLAYLIST), | |||
476 | &playlist_save_item, &reshuffle_item, &playing_time_item | 476 | &playlist_save_item, &reshuffle_item, &playing_time_item |
477 | ); | 477 | ); |
478 | 478 | ||
479 | /* argument for add_to_playlist (for use by menu callbacks) */ | ||
480 | struct add_to_pl_param | ||
481 | { | ||
482 | int8_t position; | ||
483 | unsigned int queue: 1; | ||
484 | unsigned int replace: 1; | ||
485 | }; | ||
486 | |||
487 | static struct add_to_pl_param addtopl_insert = {PLAYLIST_INSERT, 0, 0}; | ||
488 | static struct add_to_pl_param addtopl_insert_first = {PLAYLIST_INSERT_FIRST, 0, 0}; | ||
489 | static struct add_to_pl_param addtopl_insert_last = {PLAYLIST_INSERT_LAST, 0, 0}; | ||
490 | static struct add_to_pl_param addtopl_insert_shuf = {PLAYLIST_INSERT_SHUFFLED, 0, 0}; | ||
491 | static struct add_to_pl_param addtopl_insert_last_shuf = {PLAYLIST_INSERT_LAST_SHUFFLED, 0, 0}; | ||
492 | |||
493 | static struct add_to_pl_param addtopl_queue = {PLAYLIST_INSERT, 1, 0}; | ||
494 | static struct add_to_pl_param addtopl_queue_first = {PLAYLIST_INSERT_FIRST, 1, 0}; | ||
495 | static struct add_to_pl_param addtopl_queue_last = {PLAYLIST_INSERT_LAST, 1, 0}; | ||
496 | static struct add_to_pl_param addtopl_queue_shuf = {PLAYLIST_INSERT_SHUFFLED, 1, 0}; | ||
497 | static struct add_to_pl_param addtopl_queue_last_shuf = {PLAYLIST_INSERT_LAST_SHUFFLED, 1, 0}; | ||
498 | |||
499 | static struct add_to_pl_param addtopl_replace = {PLAYLIST_INSERT, 0, 1}; | ||
500 | static struct add_to_pl_param addtopl_replace_shuffled = {PLAYLIST_INSERT_SHUFFLED, 0, 1}; | ||
501 | |||
479 | /* CONTEXT_[TREE|ID3DB|STD] playlist options */ | 502 | /* CONTEXT_[TREE|ID3DB|STD] playlist options */ |
480 | static bool add_to_playlist(int position, bool queue) | 503 | static int add_to_playlist(void* arg) |
481 | { | 504 | { |
482 | bool new_playlist = false; | 505 | struct add_to_pl_param* param = arg; |
483 | if (!(audio_status() & AUDIO_STATUS_PLAY)) | 506 | int position = param->position; |
484 | { | 507 | bool new_playlist = param->replace ? true : false; |
485 | new_playlist = true; | 508 | bool queue = param->queue ? true : false; |
486 | if (position == PLAYLIST_REPLACE) | 509 | |
487 | position = PLAYLIST_INSERT; | 510 | /* warn if replacing the playlist */ |
488 | } | 511 | if (new_playlist && !warn_on_pl_erase()) |
512 | return 0; | ||
489 | 513 | ||
490 | const char *lines[] = { | 514 | const char *lines[] = { |
491 | ID2P(LANG_RECURSE_DIRECTORY_QUESTION), | 515 | ID2P(LANG_RECURSE_DIRECTORY_QUESTION), |
@@ -568,121 +592,59 @@ static bool view_playlist(void) | |||
568 | return result; | 592 | return result; |
569 | } | 593 | } |
570 | 594 | ||
571 | static int playlist_insert_func(void *param) | ||
572 | { | ||
573 | if (((intptr_t)param == PLAYLIST_REPLACE || | ||
574 | (((intptr_t)param == PLAYLIST_INSERT_SHUFFLED || (intptr_t)param == PLAYLIST_INSERT) | ||
575 | && !(audio_status() & AUDIO_STATUS_PLAY))) && !warn_on_pl_erase()) | ||
576 | return 0; | ||
577 | add_to_playlist((intptr_t)param, false); | ||
578 | return 0; | ||
579 | } | ||
580 | |||
581 | static int playlist_queue_func(void *param) | ||
582 | { | ||
583 | add_to_playlist((intptr_t)param, true); | ||
584 | return 0; | ||
585 | } | ||
586 | |||
587 | static int treeplaylist_wplayback_callback(int action, | ||
588 | const struct menu_item_ex* this_item, | ||
589 | struct gui_synclist *this_list); | ||
590 | |||
591 | static int treeplaylist_callback(int action, | 595 | static int treeplaylist_callback(int action, |
592 | const struct menu_item_ex *this_item, | 596 | const struct menu_item_ex *this_item, |
593 | struct gui_synclist *this_list); | 597 | struct gui_synclist *this_list); |
594 | 598 | ||
595 | /* insert items */ | 599 | /* insert items */ |
596 | MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT), | 600 | MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT), |
597 | playlist_insert_func, (intptr_t*)PLAYLIST_INSERT, | 601 | add_to_playlist, &addtopl_insert, |
598 | treeplaylist_wplayback_callback, Icon_Playlist); | 602 | treeplaylist_callback, Icon_Playlist); |
599 | MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST), | 603 | MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST), |
600 | playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_FIRST, | 604 | add_to_playlist, &addtopl_insert_first, |
601 | treeplaylist_wplayback_callback, Icon_Playlist); | 605 | treeplaylist_callback, Icon_Playlist); |
602 | MENUITEM_FUNCTION(i_last_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_LAST), | 606 | MENUITEM_FUNCTION(i_last_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_LAST), |
603 | playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_LAST, | 607 | add_to_playlist, &addtopl_insert_last, |
604 | treeplaylist_wplayback_callback, Icon_Playlist); | 608 | treeplaylist_callback, Icon_Playlist); |
605 | MENUITEM_FUNCTION(i_shuf_pl_item, MENU_FUNC_USEPARAM, | 609 | MENUITEM_FUNCTION(i_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_SHUFFLED), |
606 | ID2P(LANG_INSERT_SHUFFLED), playlist_insert_func, | 610 | add_to_playlist, &addtopl_insert_shuf, |
607 | (intptr_t*)PLAYLIST_INSERT_SHUFFLED, | ||
608 | treeplaylist_callback, Icon_Playlist); | 611 | treeplaylist_callback, Icon_Playlist); |
609 | MENUITEM_FUNCTION(i_last_shuf_pl_item, MENU_FUNC_USEPARAM, | 612 | MENUITEM_FUNCTION(i_last_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_LAST_SHUFFLED), |
610 | ID2P(LANG_INSERT_LAST_SHUFFLED), playlist_insert_func, | 613 | add_to_playlist, &addtopl_insert_last_shuf, |
611 | (intptr_t*)PLAYLIST_INSERT_LAST_SHUFFLED, | ||
612 | treeplaylist_callback, Icon_Playlist); | 614 | treeplaylist_callback, Icon_Playlist); |
613 | /* queue items */ | 615 | /* queue items */ |
614 | MENUITEM_FUNCTION(q_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE), | 616 | MENUITEM_FUNCTION(q_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE), |
615 | playlist_queue_func, (intptr_t*)PLAYLIST_INSERT, | 617 | add_to_playlist, &addtopl_queue, |
616 | treeplaylist_callback, Icon_Playlist); | 618 | treeplaylist_callback, Icon_Playlist); |
617 | MENUITEM_FUNCTION(q_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_FIRST), | 619 | MENUITEM_FUNCTION(q_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_FIRST), |
618 | playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_FIRST, | 620 | add_to_playlist, &addtopl_queue_first, |
619 | treeplaylist_callback, Icon_Playlist); | 621 | treeplaylist_callback, Icon_Playlist); |
620 | MENUITEM_FUNCTION(q_last_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST), | 622 | MENUITEM_FUNCTION(q_last_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST), |
621 | playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_LAST, | 623 | add_to_playlist, &addtopl_queue_last, |
622 | treeplaylist_callback, Icon_Playlist); | 624 | treeplaylist_callback, Icon_Playlist); |
623 | MENUITEM_FUNCTION(q_shuf_pl_item, MENU_FUNC_USEPARAM, | 625 | MENUITEM_FUNCTION(q_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_SHUFFLED), |
624 | ID2P(LANG_QUEUE_SHUFFLED), playlist_queue_func, | 626 | add_to_playlist, &addtopl_queue_shuf, |
625 | (intptr_t*)PLAYLIST_INSERT_SHUFFLED, | ||
626 | treeplaylist_callback, Icon_Playlist); | 627 | treeplaylist_callback, Icon_Playlist); |
627 | MENUITEM_FUNCTION(q_last_shuf_pl_item, MENU_FUNC_USEPARAM, | 628 | MENUITEM_FUNCTION(q_last_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST_SHUFFLED), |
628 | ID2P(LANG_QUEUE_LAST_SHUFFLED), playlist_queue_func, | 629 | add_to_playlist, &addtopl_queue_last_shuf, |
629 | (intptr_t*)PLAYLIST_INSERT_LAST_SHUFFLED, | ||
630 | treeplaylist_callback, Icon_Playlist); | ||
631 | |||
632 | /* queue items in submenu */ | ||
633 | MENUITEM_FUNCTION(q_pl_submenu_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE), | ||
634 | playlist_queue_func, (intptr_t*)PLAYLIST_INSERT, | ||
635 | NULL, Icon_Playlist); | ||
636 | MENUITEM_FUNCTION(q_first_pl_submenu_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_FIRST), | ||
637 | playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_FIRST, | ||
638 | NULL, Icon_Playlist); | ||
639 | MENUITEM_FUNCTION(q_last_pl_submenu_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST), | ||
640 | playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_LAST, | ||
641 | NULL, Icon_Playlist); | ||
642 | MENUITEM_FUNCTION(q_shuf_pl_submenu_item, MENU_FUNC_USEPARAM, | ||
643 | ID2P(LANG_QUEUE_SHUFFLED), playlist_queue_func, | ||
644 | (intptr_t*)PLAYLIST_INSERT_SHUFFLED, | ||
645 | treeplaylist_callback, Icon_Playlist); | ||
646 | MENUITEM_FUNCTION(q_last_shuf_pl_submenu_item, MENU_FUNC_USEPARAM, | ||
647 | ID2P(LANG_QUEUE_LAST_SHUFFLED), playlist_queue_func, | ||
648 | (intptr_t*)PLAYLIST_INSERT_LAST_SHUFFLED, | ||
649 | treeplaylist_callback, Icon_Playlist); | 630 | treeplaylist_callback, Icon_Playlist); |
650 | 631 | ||
632 | /* queue submenu */ | ||
651 | MAKE_ONPLAYMENU(queue_menu, ID2P(LANG_QUEUE_MENU), | 633 | MAKE_ONPLAYMENU(queue_menu, ID2P(LANG_QUEUE_MENU), |
652 | treeplaylist_wplayback_callback, Icon_Playlist, | 634 | treeplaylist_callback, Icon_Playlist, |
653 | &q_pl_submenu_item, | 635 | &q_pl_item, |
654 | &q_first_pl_submenu_item, | 636 | &q_first_pl_item, |
655 | &q_last_pl_submenu_item, | 637 | &q_last_pl_item, |
656 | &q_shuf_pl_submenu_item, | 638 | &q_shuf_pl_item, |
657 | &q_last_shuf_pl_submenu_item); | 639 | &q_last_shuf_pl_item); |
658 | |||
659 | static int treeplaylist_wplayback_callback(int action, | ||
660 | const struct menu_item_ex* this_item, | ||
661 | struct gui_synclist *this_list) | ||
662 | { | ||
663 | (void)this_list; | ||
664 | switch (action) | ||
665 | { | ||
666 | case ACTION_REQUEST_MENUITEM: | ||
667 | if ((audio_status() & AUDIO_STATUS_PLAY) && | ||
668 | (this_item != &queue_menu || | ||
669 | global_settings.show_queue_options == QUEUE_SHOW_IN_SUBMENU)) | ||
670 | return action; | ||
671 | else | ||
672 | return ACTION_EXIT_MENUITEM; | ||
673 | break; | ||
674 | } | ||
675 | return action; | ||
676 | } | ||
677 | 640 | ||
678 | /* replace playlist */ | 641 | /* replace playlist */ |
679 | MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_CLEAR_LIST_AND_PLAY_NEXT), | 642 | MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_PLAY), |
680 | playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE, | 643 | add_to_playlist, &addtopl_replace, |
681 | NULL, Icon_Playlist); | 644 | treeplaylist_callback, Icon_Playlist); |
682 | 645 | ||
683 | MENUITEM_FUNCTION(replace_shuf_pl_item, MENU_FUNC_USEPARAM, | 646 | MENUITEM_FUNCTION(replace_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_PLAY_SHUFFLED), |
684 | ID2P(LANG_CLEAR_LIST_AND_PLAY_SHUFFLED), playlist_insert_func, | 647 | add_to_playlist, &addtopl_replace_shuffled, |
685 | (intptr_t*)PLAYLIST_INSERT_SHUFFLED, | ||
686 | treeplaylist_callback, Icon_Playlist); | 648 | treeplaylist_callback, Icon_Playlist); |
687 | 649 | ||
688 | MAKE_ONPLAYMENU(tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST), | 650 | MAKE_ONPLAYMENU(tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST), |
@@ -713,70 +675,71 @@ static int treeplaylist_callback(int action, | |||
713 | const struct menu_item_ex *this_item, | 675 | const struct menu_item_ex *this_item, |
714 | struct gui_synclist *this_list) | 676 | struct gui_synclist *this_list) |
715 | { | 677 | { |
678 | static bool in_queue_submenu = false; | ||
679 | |||
716 | (void)this_list; | 680 | (void)this_list; |
717 | switch (action) | 681 | switch (action) |
718 | { | 682 | { |
719 | case ACTION_REQUEST_MENUITEM: | 683 | case ACTION_REQUEST_MENUITEM: |
720 | if (this_item == &tree_playlist_menu) | 684 | if (this_item == &tree_playlist_menu) |
721 | { | 685 | { |
722 | if ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO || | 686 | if ((selected_file_attr & FILE_ATTR_MASK) != FILE_ATTR_AUDIO && |
723 | (selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U || | 687 | (selected_file_attr & FILE_ATTR_MASK) != FILE_ATTR_M3U && |
724 | (selected_file_attr & ATTR_DIRECTORY)) | 688 | (selected_file_attr & ATTR_DIRECTORY) == 0) |
725 | return action; | 689 | return ACTION_EXIT_MENUITEM; |
726 | } | 690 | } |
727 | else if ((this_item == &q_pl_item || | 691 | else if (this_item == &queue_menu) |
728 | this_item == &q_first_pl_item || | 692 | { |
729 | this_item == &q_last_pl_item) && | 693 | if (global_settings.show_queue_options != QUEUE_SHOW_IN_SUBMENU) |
730 | global_settings.show_queue_options == QUEUE_SHOW_AT_TOPLEVEL && | 694 | return ACTION_EXIT_MENUITEM; |
731 | (audio_status() & AUDIO_STATUS_PLAY)) | 695 | |
732 | { | 696 | /* queueing options only work during playback */ |
733 | return action; | 697 | if (!(audio_status() & AUDIO_STATUS_PLAY)) |
734 | } | 698 | return ACTION_EXIT_MENUITEM; |
735 | else if (this_item == &i_shuf_pl_item) | 699 | } |
736 | { | 700 | else if ((this_item->flags & MENU_TYPE_MASK) == MT_FUNCTION_CALL && |
737 | if (global_settings.show_shuffled_adding_options && | 701 | this_item->function->function_w_param == add_to_playlist) |
738 | (audio_status() & AUDIO_STATUS_PLAY)) | 702 | { |
739 | { | 703 | struct add_to_pl_param *param = this_item->function->param; |
740 | return action; | 704 | |
741 | } | 705 | if (param->queue) |
742 | } | ||
743 | else if (this_item == &replace_shuf_pl_item) | ||
744 | { | 706 | { |
745 | if (global_settings.show_shuffled_adding_options && | 707 | if (global_settings.show_queue_options != QUEUE_SHOW_AT_TOPLEVEL && |
746 | !(audio_status() & AUDIO_STATUS_PLAY) && | 708 | !in_queue_submenu) |
747 | ((selected_file_attr & ATTR_DIRECTORY) || | 709 | return ACTION_EXIT_MENUITEM; |
748 | ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))) | ||
749 | { | ||
750 | return action; | ||
751 | } | ||
752 | } | 710 | } |
753 | else if (this_item == &q_shuf_pl_submenu_item || | 711 | |
754 | (this_item == &q_shuf_pl_item && | 712 | if (param->position == PLAYLIST_INSERT_SHUFFLED || |
755 | global_settings.show_queue_options == QUEUE_SHOW_AT_TOPLEVEL)) | 713 | param->position == PLAYLIST_INSERT_LAST_SHUFFLED) |
756 | { | 714 | { |
757 | if (global_settings.show_shuffled_adding_options && | 715 | if (!global_settings.show_shuffled_adding_options) |
758 | (audio_status() & AUDIO_STATUS_PLAY)) | 716 | return ACTION_EXIT_MENUITEM; |
759 | { | 717 | |
760 | return action; | 718 | if ((selected_file_attr & FILE_ATTR_MASK) != FILE_ATTR_M3U && |
761 | } | 719 | (selected_file_attr & ATTR_DIRECTORY) == 0) |
720 | return ACTION_EXIT_MENUITEM; | ||
762 | } | 721 | } |
763 | else if (this_item == &i_last_shuf_pl_item || | 722 | |
764 | this_item == &q_last_shuf_pl_submenu_item || | 723 | if (!param->replace) |
765 | (this_item == &q_last_shuf_pl_item && | ||
766 | global_settings.show_queue_options == QUEUE_SHOW_AT_TOPLEVEL)) | ||
767 | { | 724 | { |
768 | if (global_settings.show_shuffled_adding_options && | 725 | if (!(audio_status() & AUDIO_STATUS_PLAY)) |
769 | (playlist_amount() > 0) && | 726 | return ACTION_EXIT_MENUITEM; |
770 | (audio_status() & AUDIO_STATUS_PLAY) && | ||
771 | ((selected_file_attr & ATTR_DIRECTORY) || | ||
772 | ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))) | ||
773 | { | ||
774 | return action; | ||
775 | } | ||
776 | } | 727 | } |
777 | return ACTION_EXIT_MENUITEM; | 728 | } |
778 | break; | 729 | |
730 | break; | ||
731 | |||
732 | case ACTION_ENTER_MENUITEM: | ||
733 | if (this_item == &queue_menu) | ||
734 | in_queue_submenu = true; | ||
735 | break; | ||
736 | |||
737 | case ACTION_EXIT_MENUITEM: | ||
738 | if (this_item == &queue_menu) | ||
739 | in_queue_submenu = false; | ||
740 | break; | ||
779 | } | 741 | } |
742 | |||
780 | return action; | 743 | return action; |
781 | } | 744 | } |
782 | 745 | ||
@@ -1840,7 +1803,7 @@ static int playlist_insert_shuffled(void) | |||
1840 | (selected_file_attr & ATTR_DIRECTORY) || | 1803 | (selected_file_attr & ATTR_DIRECTORY) || |
1841 | ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U)) | 1804 | ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U)) |
1842 | { | 1805 | { |
1843 | playlist_insert_func((intptr_t*)PLAYLIST_INSERT_SHUFFLED); | 1806 | add_to_playlist(&addtopl_insert_shuf); |
1844 | return ONPLAY_START_PLAY; | 1807 | return ONPLAY_START_PLAY; |
1845 | } | 1808 | } |
1846 | 1809 | ||
@@ -1883,7 +1846,7 @@ static struct hotkey_assignment hotkey_items[] = { | |||
1883 | HOTKEY_FUNC(delete_item, NULL), | 1846 | HOTKEY_FUNC(delete_item, NULL), |
1884 | ONPLAY_RELOAD_DIR }, | 1847 | ONPLAY_RELOAD_DIR }, |
1885 | { HOTKEY_INSERT, LANG_INSERT, | 1848 | { HOTKEY_INSERT, LANG_INSERT, |
1886 | HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT), | 1849 | HOTKEY_FUNC(add_to_playlist, (intptr_t*)&addtopl_insert), |
1887 | ONPLAY_RELOAD_DIR }, | 1850 | ONPLAY_RELOAD_DIR }, |
1888 | { HOTKEY_INSERT_SHUFFLED, LANG_INSERT_SHUFFLED, | 1851 | { HOTKEY_INSERT_SHUFFLED, LANG_INSERT_SHUFFLED, |
1889 | HOTKEY_FUNC(playlist_insert_shuffled, NULL), | 1852 | HOTKEY_FUNC(playlist_insert_shuffled, NULL), |