From 2d8e0f7c907ee0d50e6e55fc9ed5f94a43ab5d67 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Fri, 12 Mar 2021 19:24:58 +0100 Subject: Customizable Current Playlist Submenu Options to add shuffled tracks and to queue tracks in the Current Playlist Submenu can now be hidden, or the latter can also be put into its own submenu. Users can customize this in Settings by going to "General Settings - Playlists -> Current Playlist" and choosing from "Show Shuffled Adding Options" (No / Yes) or "Show Queue Options" (No / Yes / In Submenu). Allows for the paring down of the set of choices to a minimum of the 4 more common ones for adding tracks to a dynamic playlist (coming from the current total of 11). Defaults have been set so that users have to actively modify their settings to notice any difference, which makes it unlikely that anybody's workflow would be negatively affected by this change. Change-Id: Ibe48fc4da2c79f54cd7272df8e1e3ba9955203e5 --- apps/lang/english.lang | 56 ++++++++++ apps/menus/playlist_menu.c | 22 ++-- apps/onplay.c | 154 ++++++++++++++++++-------- apps/settings.h | 8 ++ apps/settings_list.c | 9 ++ manual/appendix/config_file_options.tex | 4 + manual/configure_rockbox/playlist_options.tex | 40 ++++++- manual/main_menu/main.tex | 2 +- manual/working_with_playlists/main.tex | 8 +- 9 files changed, 242 insertions(+), 61 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 9b3f6712e4..80a29601a0 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -15618,3 +15618,59 @@ *: "Clear List & Play Next" + + id: LANG_QUEUE_MENU + desc: in onplay menu + user: core + + *: "Queue..." + + + *: "Queue..." + + + *: "Queue..." + + + + id: LANG_SHOW_QUEUE_OPTIONS + desc: in Current Playlist settings + user: core + + *: "Show Queue Options" + + + *: "Show Queue Options" + + + *: "Show Queue Options" + + + + id: LANG_SHOW_SHUFFLED_ADDING_OPTIONS + desc: in Current Playlist settings + user: core + + *: "Show Shuffled Adding Options" + + + *: "Show Shuffled Adding Options" + + + *: "Show Shuffled Adding Options" + + + + id: LANG_IN_SUBMENU + desc: in Settings + user: core + + *: "In Submenu" + + + *: "In Submenu" + + + *: "In Submenu" + + \ No newline at end of file diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c index b0d9a44a9e..dfb9d73d62 100644 --- a/apps/menus/playlist_menu.c +++ b/apps/menus/playlist_menu.c @@ -80,15 +80,14 @@ static int playlist_view_(void) playlist_viewer_ex(NULL); return 0; } -MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST), +MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST), create_playlist, NULL, NULL, Icon_NOICON); MENUITEM_FUNCTION(view_cur_playlist, 0, - ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), + ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_view_, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), +MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist_screen, NULL, NULL, Icon_NOICON); MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL); -MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL); static int clear_catalog_directory(void) { catalog_set_directory(NULL); @@ -96,22 +95,29 @@ static int clear_catalog_directory(void) splash(HZ, ID2P(LANG_RESET_DONE_CLEAR)); return false; } -MENUITEM_FUNCTION(clear_catalog_directory_item, 0, ID2P(LANG_RESET_PLAYLISTCAT_DIR), +MENUITEM_FUNCTION(clear_catalog_directory_item, 0, ID2P(LANG_RESET_PLAYLISTCAT_DIR), clear_catalog_directory, NULL, NULL, Icon_file_view_menu); /* Playlist viewer settings submenu */ MENUITEM_SETTING(show_icons, &global_settings.playlist_viewer_icons, NULL); MENUITEM_SETTING(show_indices, &global_settings.playlist_viewer_indices, NULL); -MENUITEM_SETTING(track_display, +MENUITEM_SETTING(track_display, &global_settings.playlist_viewer_track_display, NULL); -MAKE_MENU(viewer_settings_menu, ID2P(LANG_PLAYLISTVIEWER_SETTINGS), +MAKE_MENU(viewer_settings_menu, ID2P(LANG_PLAYLISTVIEWER_SETTINGS), NULL, Icon_Playlist, &show_icons, &show_indices, &track_display); +/* Current Playlist submenu */ +MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL); +MENUITEM_SETTING(show_shuffled_adding_options, &global_settings.show_shuffled_adding_options, NULL); +MENUITEM_SETTING(show_queue_options, &global_settings.show_queue_options, NULL); +MAKE_MENU(currentplaylist_settings_menu, ID2P(LANG_CURRENT_PLAYLIST), + NULL, Icon_Playlist, + &warn_on_erase, &show_shuffled_adding_options, &show_queue_options); MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL, Icon_Playlist, - &viewer_settings_menu, &recursive_dir_insert, &warn_on_erase); + &viewer_settings_menu, &recursive_dir_insert, ¤tplaylist_settings_menu); MAKE_MENU(playlist_options, ID2P(LANG_PLAYLISTS), NULL, Icon_Playlist, &create_playlist_item, &view_cur_playlist, 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) } static int treeplaylist_wplayback_callback(int action, - const struct menu_item_ex* this_item, - struct gui_synclist *this_list) -{ - (void)this_item; - (void)this_list; - switch (action) - { - case ACTION_REQUEST_MENUITEM: - if (audio_status() & AUDIO_STATUS_PLAY) - return action; - else - return ACTION_EXIT_MENUITEM; - break; - } - return action; -} + const struct menu_item_ex* this_item, + struct gui_synclist *this_list); static int treeplaylist_callback(int action, const struct menu_item_ex *this_item, @@ -624,40 +610,95 @@ MENUITEM_FUNCTION(i_last_shuf_pl_item, MENU_FUNC_USEPARAM, /* queue items */ MENUITEM_FUNCTION(q_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE), playlist_queue_func, (intptr_t*)PLAYLIST_INSERT, - treeplaylist_wplayback_callback, Icon_Playlist); + treeplaylist_callback, Icon_Playlist); MENUITEM_FUNCTION(q_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_FIRST), playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_FIRST, - treeplaylist_wplayback_callback, Icon_Playlist); + treeplaylist_callback, Icon_Playlist); MENUITEM_FUNCTION(q_last_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST), playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_LAST, - treeplaylist_wplayback_callback, Icon_Playlist); + treeplaylist_callback, Icon_Playlist); MENUITEM_FUNCTION(q_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_SHUFFLED), playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_SHUFFLED, - treeplaylist_wplayback_callback, Icon_Playlist); + treeplaylist_callback, Icon_Playlist); MENUITEM_FUNCTION(q_last_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST_SHUFFLED), playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_LAST_SHUFFLED, treeplaylist_callback, Icon_Playlist); + +/* queue items in submenu */ +MENUITEM_FUNCTION(q_pl_submenu_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE), + playlist_queue_func, (intptr_t*)PLAYLIST_INSERT, + NULL, Icon_Playlist); +MENUITEM_FUNCTION(q_first_pl_submenu_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_FIRST), + playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_FIRST, + NULL, Icon_Playlist); +MENUITEM_FUNCTION(q_last_pl_submenu_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST), + playlist_queue_func, (intptr_t*)PLAYLIST_INSERT_LAST, + NULL, Icon_Playlist); +MENUITEM_FUNCTION(q_shuf_pl_submenu_item, MENU_FUNC_USEPARAM, + ID2P(LANG_QUEUE_SHUFFLED), playlist_queue_func, + (intptr_t*)PLAYLIST_INSERT_SHUFFLED, + treeplaylist_callback, Icon_Playlist); +MENUITEM_FUNCTION(q_last_shuf_pl_submenu_item, MENU_FUNC_USEPARAM, + ID2P(LANG_QUEUE_LAST_SHUFFLED), playlist_queue_func, + (intptr_t*)PLAYLIST_INSERT_LAST_SHUFFLED, + treeplaylist_callback, Icon_Playlist); + +MAKE_ONPLAYMENU(queue_menu, ID2P(LANG_QUEUE_MENU), + treeplaylist_wplayback_callback, Icon_Playlist, + &q_pl_submenu_item, + &q_first_pl_submenu_item, + &q_last_pl_submenu_item, + &q_shuf_pl_submenu_item, + &q_last_shuf_pl_submenu_item); + +static int treeplaylist_wplayback_callback(int action, + const struct menu_item_ex* this_item, + struct gui_synclist *this_list) +{ + (void)this_list; + switch (action) + { + case ACTION_REQUEST_MENUITEM: + if ((audio_status() & AUDIO_STATUS_PLAY) && + (this_item != &queue_menu || + global_settings.show_queue_options == QUEUE_SHOW_IN_SUBMENU)) + return action; + else + return ACTION_EXIT_MENUITEM; + break; + } + return action; +} + /* replace playlist */ MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_CLEAR_LIST_AND_PLAY_NEXT), playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE, NULL, Icon_Playlist); +MAKE_ONPLAYMENU(tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST), + treeplaylist_callback, Icon_Playlist, -MAKE_ONPLAYMENU( tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST), - treeplaylist_callback, Icon_Playlist, + /* insert */ + &i_pl_item, + &i_first_pl_item, + &i_last_pl_item, + &i_shuf_pl_item, + &i_last_shuf_pl_item, - /* insert */ - &i_pl_item, &i_first_pl_item, &i_last_pl_item, - &i_shuf_pl_item, &i_last_shuf_pl_item, - /* queue */ + /* queue */ + &q_pl_item, + &q_first_pl_item, + &q_last_pl_item, + &q_shuf_pl_item, + &q_last_shuf_pl_item, - &q_pl_item, &q_first_pl_item, &q_last_pl_item, - &q_shuf_pl_item, &q_last_shuf_pl_item, + /* Queue submenu */ + &queue_menu, - /* replace */ - &replace_pl_item + /* replace */ + &replace_pl_item ); static int treeplaylist_callback(int action, const struct menu_item_ex *this_item, @@ -669,36 +710,55 @@ static int treeplaylist_callback(int action, case ACTION_REQUEST_MENUITEM: if (this_item == &tree_playlist_menu) { - if (((selected_file_attr & FILE_ATTR_MASK) == - FILE_ATTR_AUDIO) || - ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U)|| - (selected_file_attr & ATTR_DIRECTORY)) - { - return action; - } + if ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO || + (selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U || + (selected_file_attr & ATTR_DIRECTORY)) + return action; } - else if (this_item == &i_pl_item) + else if (this_item == &i_pl_item && + global_status.resume_index != -1) { - if (global_status.resume_index != -1) - return action; + return action; + } + else if ((this_item == &q_pl_item || + this_item == &q_first_pl_item || + this_item == &q_last_pl_item) && + global_settings.show_queue_options == QUEUE_SHOW_AT_TOPLEVEL && + (audio_status() & AUDIO_STATUS_PLAY)) + { + return action; } else if (this_item == &i_shuf_pl_item) { - if ((global_status.resume_index != -1) && - ((audio_status() & AUDIO_STATUS_PLAY) || - (selected_file_attr & ATTR_DIRECTORY) || - ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))) + if (global_settings.show_shuffled_adding_options && + (global_status.resume_index != -1) && + ((audio_status() & AUDIO_STATUS_PLAY) || + (selected_file_attr & ATTR_DIRECTORY) || + ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))) + { + return action; + } + } + else if (this_item == &q_shuf_pl_submenu_item || + (this_item == &q_shuf_pl_item && + global_settings.show_queue_options == QUEUE_SHOW_AT_TOPLEVEL)) + { + if (global_settings.show_shuffled_adding_options && + (audio_status() & AUDIO_STATUS_PLAY)) { return action; } } else if (this_item == &i_last_shuf_pl_item || - this_item == &q_last_shuf_pl_item) + this_item == &q_last_shuf_pl_submenu_item || + (this_item == &q_last_shuf_pl_item && + global_settings.show_queue_options == QUEUE_SHOW_AT_TOPLEVEL)) { - if ((playlist_amount() > 0) && + if (global_settings.show_shuffled_adding_options && + (playlist_amount() > 0) && (audio_status() & AUDIO_STATUS_PLAY) && ((selected_file_attr & ATTR_DIRECTORY) || - ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))) + ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))) { return action; } diff --git a/apps/settings.h b/apps/settings.h index 60f2b44588..cc60617de4 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -109,6 +109,12 @@ enum NUM_REPEAT_MODES }; +enum +{ + QUEUE_HIDE = 0, + QUEUE_SHOW_AT_TOPLEVEL, + QUEUE_SHOW_IN_SUBMENU +}; /* dir filter options */ /* Note: Any new filter modes need to be added before NUM_FILTER_MODES. @@ -574,6 +580,8 @@ struct user_settings bool fade_on_stop; /* fade on pause/unpause/stop */ bool playlist_shuffle; bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */ + bool show_shuffled_adding_options; /* whether to display options for adding shuffled tracks to dynamic playlist */ + int show_queue_options; /* how and whether to display options to queue tracks */ /* playlist viewer settings */ bool playlist_viewer_icons; /* display icons on viewer */ diff --git a/apps/settings_list.c b/apps/settings_list.c index cf52f26080..e5c02f6bf3 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -1788,6 +1788,15 @@ const struct settings_list settings[] = { OFFON_SETTING(0, warnon_erase_dynplaylist, LANG_WARN_ERASEDYNPLAYLIST_MENU, true, "warn when erasing dynamic playlist",NULL), + OFFON_SETTING(0, show_shuffled_adding_options, LANG_SHOW_SHUFFLED_ADDING_OPTIONS, true, + "show shuffled adding options", NULL), + CHOICE_SETTING(0, show_queue_options, LANG_SHOW_QUEUE_OPTIONS, 1, + "show queue options", "off,on,in submenu", + NULL, 3, + ID2P(LANG_SET_BOOL_NO), + ID2P(LANG_SET_BOOL_YES), + ID2P(LANG_IN_SUBMENU)), + #ifdef HAVE_BACKLIGHT #ifdef HAS_BUTTON_HOLD CHOICE_SETTING(0, backlight_on_button_hold, LANG_BACKLIGHT_ON_BUTTON_HOLD, diff --git a/manual/appendix/config_file_options.tex b/manual/appendix/config_file_options.tex index 87e8a2ab96..abf6cf7f96 100644 --- a/manual/appendix/config_file_options.tex +++ b/manual/appendix/config_file_options.tex @@ -143,6 +143,10 @@ & on, off & N/A\\ warn when erasing dynamic playlist & on, off & N/A\\ + show shuffled adding options + & off, on & N/A\\ + show queue options + & off, on, in submenu & N/A\\ cuesheet support & on, off & N/A\\ folder navigation & off, on, random & N/A\\ diff --git a/manual/configure_rockbox/playlist_options.tex b/manual/configure_rockbox/playlist_options.tex index 35a2648f70..bd493d6e4b 100644 --- a/manual/configure_rockbox/playlist_options.tex +++ b/manual/configure_rockbox/playlist_options.tex @@ -1,14 +1,46 @@ % $Id:$ % -\section{\label{ref:PlaylistOptions}Playlist} -The \setting{Playlist} sub menu allows you to configure settings +\section{\label{ref:PlaylistOptions}Playlists} + +The \setting{Playlists} submenu allows you to configure settings related to playlists. + + \begin{description} + +\item[Playlist Viewer Settings.] + This submenu contains settings related to the Playlist Viewer. + \begin{description} + \item[Show Icons.] This toggles display of the icon for the currently + selected playlist entry and the icon for moving a playlist entry + \item[Show Indices.] This toggles display of the line numbering for + the playlist + \item[Track Display.] This toggles between filename only and full path + for playlist entries + \end{description} + \item[Recursively Insert Directories.] - If set to \setting{On}, then when a directory is inserted or queued into a + If set to \setting{On}, then when a directory is inserted or queued into a dynamic playlist, all subdirectories will also be inserted. If set to \setting{Ask}, Rockbox will prompt the user about whether to include sub-directories. -\item[Warn When Erasing Dynamic Playlist.] +\item[Current Playlist.] + This submenu contains settings related to the current dynamic playlist. + \begin{description} + + \item[Warn When Erasing Dynamic Playlist.] If set to \setting{Yes}, Rockbox will provide a warning if the user attempts to take an action that will cause Rockbox to erase the current dynamic playlist. + + \item[Show Shuffled Adding Options.] + If set to \setting{No}, Rockbox will not offer to add shuffled tracks + in the \setting{Current Playlist submenu}. + + \item[Show Queue Options.] + If set to \setting{No}, Rockbox will not display the options to queue items in + the \setting{Current Playlist submenu}. + If set to \setting{In Submenu}, Rockbox will move the options into a + separate submenu. + + \end{description} + \end{description} diff --git a/manual/main_menu/main.tex b/manual/main_menu/main.tex index 7a83c61935..bdb422e10a 100644 --- a/manual/main_menu/main.tex +++ b/manual/main_menu/main.tex @@ -163,7 +163,7 @@ The details of this menu are covered in the \setting{Playlist} menu. Both automatically and manually created playlists can be edited using this menu. -\subsection{The Playlist Catalogue Context Menu} +\subsection{\label{ref:playlistcatalogue_contextmenu}The Playlist Catalogue Context Menu} \begin{description} \item[Create Playlist:] diff --git a/manual/working_with_playlists/main.tex b/manual/working_with_playlists/main.tex index 16995caf78..8bc233d346 100644 --- a/manual/working_with_playlists/main.tex +++ b/manual/working_with_playlists/main.tex @@ -71,7 +71,7 @@ the selected track or directory. \subsubsection{By using the Main Menu} To create a playlist containing some or all of the music on your \dap{}, you can use the \setting{Create Playlist} command in the \setting{Playlist Catalogue Context Menu} -(see \reference{ref:Contextmenu}). +(see \reference{ref:playlistcatalogue_contextmenu}). \subsection{Adding music to playlists} @@ -116,6 +116,12 @@ to the playlist file (see \reference{ref:playlistoptions}). \item [Queue Last Shuffled.] Corresponds to \setting{Insert Last Shuffled}. \end{description} +\note{You can hide the options to add shuffled tracks or to queue tracks, if you wish. +The latter can also be put into its own submenu. Simply go to +\setting{Settings} $\rightarrow$ \setting{General Settings} $\rightarrow$ \setting{Playlists} +$\rightarrow$ \setting{Current Playlist} and select either \setting{Show Shuffled Adding Options} +or \setting{Show Queue Options} to customize the displayed set of options.} + The \setting{Current Playlist Submenu} can be used to add either single tracks or entire directories to a playlist. If the \setting{Current Playlist Submenu} is invoked on a single track, it will put only that track into the playlist. -- cgit v1.2.3