summaryrefslogtreecommitdiff
path: root/apps/onplay.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c154
1 files changed, 107 insertions, 47 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index 35d9a82bfd..be92a2909a 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -582,22 +582,8 @@ static int playlist_queue_func(void *param)
582} 582}
583 583
584static int treeplaylist_wplayback_callback(int action, 584static int treeplaylist_wplayback_callback(int action,
585 const struct menu_item_ex* this_item, 585 const struct menu_item_ex* this_item,
586 struct gui_synclist *this_list) 586 struct gui_synclist *this_list);
587{
588 (void)this_item;
589 (void)this_list;
590 switch (action)
591 {
592 case ACTION_REQUEST_MENUITEM:
593 if (audio_status() & AUDIO_STATUS_PLAY)
594 return action;
595 else
596 return ACTION_EXIT_MENUITEM;
597 break;
598 }
599 return action;
600}
601 587
602static int treeplaylist_callback(int action, 588static int treeplaylist_callback(int action,
603 const struct menu_item_ex *this_item, 589 const struct menu_item_ex *this_item,
@@ -624,40 +610,95 @@ MENUITEM_FUNCTION(i_last_shuf_pl_item, MENU_FUNC_USEPARAM,
624/* queue items */ 610/* queue items */
625MENUITEM_FUNCTION(q_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE), 611MENUITEM_FUNCTION(q_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE),
626 playlist_queue_func, (intptr_t*)PLAYLIST_INSERT, 612 playlist_queue_func, (intptr_t*)PLAYLIST_INSERT,
627 treeplaylist_wplayback_callback, Icon_Playlist); 613 treeplaylist_callback, Icon_Playlist);
628MENUITEM_FUNCTION(q_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_FIRST), 614MENUITEM_FUNCTION(q_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_FIRST),
629 playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_FIRST, 615 playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_FIRST,
630 treeplaylist_wplayback_callback, Icon_Playlist); 616 treeplaylist_callback, Icon_Playlist);
631MENUITEM_FUNCTION(q_last_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST), 617MENUITEM_FUNCTION(q_last_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST),
632 playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_LAST, 618 playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_LAST,
633 treeplaylist_wplayback_callback, Icon_Playlist); 619 treeplaylist_callback, Icon_Playlist);
634MENUITEM_FUNCTION(q_shuf_pl_item, MENU_FUNC_USEPARAM, 620MENUITEM_FUNCTION(q_shuf_pl_item, MENU_FUNC_USEPARAM,
635 ID2P(LANG_QUEUE_SHUFFLED), playlist_queue_func, 621 ID2P(LANG_QUEUE_SHUFFLED), playlist_queue_func,
636 (intptr_t*)PLAYLIST_INSERT_SHUFFLED, 622 (intptr_t*)PLAYLIST_INSERT_SHUFFLED,
637 treeplaylist_wplayback_callback, Icon_Playlist); 623 treeplaylist_callback, Icon_Playlist);
638MENUITEM_FUNCTION(q_last_shuf_pl_item, MENU_FUNC_USEPARAM, 624MENUITEM_FUNCTION(q_last_shuf_pl_item, MENU_FUNC_USEPARAM,
639 ID2P(LANG_QUEUE_LAST_SHUFFLED), playlist_queue_func, 625 ID2P(LANG_QUEUE_LAST_SHUFFLED), playlist_queue_func,
640 (intptr_t*)PLAYLIST_INSERT_LAST_SHUFFLED, 626 (intptr_t*)PLAYLIST_INSERT_LAST_SHUFFLED,
641 treeplaylist_callback, Icon_Playlist); 627 treeplaylist_callback, Icon_Playlist);
628
629/* queue items in submenu */
630MENUITEM_FUNCTION(q_pl_submenu_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE),
631 playlist_queue_func, (intptr_t*)PLAYLIST_INSERT,
632 NULL, Icon_Playlist);
633MENUITEM_FUNCTION(q_first_pl_submenu_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_FIRST),
634 playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_FIRST,
635 NULL, Icon_Playlist);
636MENUITEM_FUNCTION(q_last_pl_submenu_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST),
637 playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_LAST,
638 NULL, Icon_Playlist);
639MENUITEM_FUNCTION(q_shuf_pl_submenu_item, MENU_FUNC_USEPARAM,
640 ID2P(LANG_QUEUE_SHUFFLED), playlist_queue_func,
641 (intptr_t*)PLAYLIST_INSERT_SHUFFLED,
642 treeplaylist_callback, Icon_Playlist);
643MENUITEM_FUNCTION(q_last_shuf_pl_submenu_item, MENU_FUNC_USEPARAM,
644 ID2P(LANG_QUEUE_LAST_SHUFFLED), playlist_queue_func,
645 (intptr_t*)PLAYLIST_INSERT_LAST_SHUFFLED,
646 treeplaylist_callback, Icon_Playlist);
647
648MAKE_ONPLAYMENU(queue_menu, ID2P(LANG_QUEUE_MENU),
649 treeplaylist_wplayback_callback, Icon_Playlist,
650 &q_pl_submenu_item,
651 &q_first_pl_submenu_item,
652 &q_last_pl_submenu_item,
653 &q_shuf_pl_submenu_item,
654 &q_last_shuf_pl_submenu_item);
655
656static int treeplaylist_wplayback_callback(int action,
657 const struct menu_item_ex* this_item,
658 struct gui_synclist *this_list)
659{
660 (void)this_list;
661 switch (action)
662 {
663 case ACTION_REQUEST_MENUITEM:
664 if ((audio_status() & AUDIO_STATUS_PLAY) &&
665 (this_item != &queue_menu ||
666 global_settings.show_queue_options == QUEUE_SHOW_IN_SUBMENU))
667 return action;
668 else
669 return ACTION_EXIT_MENUITEM;
670 break;
671 }
672 return action;
673}
674
642/* replace playlist */ 675/* replace playlist */
643MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_CLEAR_LIST_AND_PLAY_NEXT), 676MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_CLEAR_LIST_AND_PLAY_NEXT),
644 playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE, 677 playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE,
645 NULL, Icon_Playlist); 678 NULL, Icon_Playlist);
646 679
680MAKE_ONPLAYMENU(tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST),
681 treeplaylist_callback, Icon_Playlist,
647 682
648MAKE_ONPLAYMENU( tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST), 683 /* insert */
649 treeplaylist_callback, Icon_Playlist, 684 &i_pl_item,
685 &i_first_pl_item,
686 &i_last_pl_item,
687 &i_shuf_pl_item,
688 &i_last_shuf_pl_item,
650 689
651 /* insert */ 690 /* queue */
652 &i_pl_item, &i_first_pl_item, &i_last_pl_item, 691 &q_pl_item,
653 &i_shuf_pl_item, &i_last_shuf_pl_item, 692 &q_first_pl_item,
654 /* queue */ 693 &q_last_pl_item,
694 &q_shuf_pl_item,
695 &q_last_shuf_pl_item,
655 696
656 &q_pl_item, &q_first_pl_item, &q_last_pl_item, 697 /* Queue submenu */
657 &q_shuf_pl_item, &q_last_shuf_pl_item, 698 &queue_menu,
658 699
659 /* replace */ 700 /* replace */
660 &replace_pl_item 701 &replace_pl_item
661 ); 702 );
662static int treeplaylist_callback(int action, 703static int treeplaylist_callback(int action,
663 const struct menu_item_ex *this_item, 704 const struct menu_item_ex *this_item,
@@ -669,36 +710,55 @@ static int treeplaylist_callback(int action,
669 case ACTION_REQUEST_MENUITEM: 710 case ACTION_REQUEST_MENUITEM:
670 if (this_item == &tree_playlist_menu) 711 if (this_item == &tree_playlist_menu)
671 { 712 {
672 if (((selected_file_attr & FILE_ATTR_MASK) == 713 if ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO ||
673 FILE_ATTR_AUDIO) || 714 (selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U ||
674 ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U)|| 715 (selected_file_attr & ATTR_DIRECTORY))
675 (selected_file_attr & ATTR_DIRECTORY)) 716 return action;
676 {
677 return action;
678 }
679 } 717 }
680 else if (this_item == &i_pl_item) 718 else if (this_item == &i_pl_item &&
719 global_status.resume_index != -1)
681 { 720 {
682 if (global_status.resume_index != -1) 721 return action;
683 return action; 722 }
723 else if ((this_item == &q_pl_item ||
724 this_item == &q_first_pl_item ||
725 this_item == &q_last_pl_item) &&
726 global_settings.show_queue_options == QUEUE_SHOW_AT_TOPLEVEL &&
727 (audio_status() & AUDIO_STATUS_PLAY))
728 {
729 return action;
684 } 730 }
685 else if (this_item == &i_shuf_pl_item) 731 else if (this_item == &i_shuf_pl_item)
686 { 732 {
687 if ((global_status.resume_index != -1) && 733 if (global_settings.show_shuffled_adding_options &&
688 ((audio_status() & AUDIO_STATUS_PLAY) || 734 (global_status.resume_index != -1) &&
689 (selected_file_attr & ATTR_DIRECTORY) || 735 ((audio_status() & AUDIO_STATUS_PLAY) ||
690 ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))) 736 (selected_file_attr & ATTR_DIRECTORY) ||
737 ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U)))
738 {
739 return action;
740 }
741 }
742 else if (this_item == &q_shuf_pl_submenu_item ||
743 (this_item == &q_shuf_pl_item &&
744 global_settings.show_queue_options == QUEUE_SHOW_AT_TOPLEVEL))
745 {
746 if (global_settings.show_shuffled_adding_options &&
747 (audio_status() & AUDIO_STATUS_PLAY))
691 { 748 {
692 return action; 749 return action;
693 } 750 }
694 } 751 }
695 else if (this_item == &i_last_shuf_pl_item || 752 else if (this_item == &i_last_shuf_pl_item ||
696 this_item == &q_last_shuf_pl_item) 753 this_item == &q_last_shuf_pl_submenu_item ||
754 (this_item == &q_last_shuf_pl_item &&
755 global_settings.show_queue_options == QUEUE_SHOW_AT_TOPLEVEL))
697 { 756 {
698 if ((playlist_amount() > 0) && 757 if (global_settings.show_shuffled_adding_options &&
758 (playlist_amount() > 0) &&
699 (audio_status() & AUDIO_STATUS_PLAY) && 759 (audio_status() & AUDIO_STATUS_PLAY) &&
700 ((selected_file_attr & ATTR_DIRECTORY) || 760 ((selected_file_attr & ATTR_DIRECTORY) ||
701 ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))) 761 ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U)))
702 { 762 {
703 return action; 763 return action;
704 } 764 }