Show 'Play Next' option when playback is stopped

1) The Insert functionality was changed in abebc6b to not delete
unfinished dynamic playlists anymore. "Play Next" has now been
added as an option when playback is stopped. The behavior of
"Play Next" as such has not changed and it is now the consistent
way to replace a current playlist in all playback modes.

2) The 'Insert' and 'Insert Shuffle' options will now only be
displayed if there is a resumable dynamic playlist

Change-Id: Ib5c5469b9e2c583ab06e0f47a922c24e5adf6b5f
This commit is contained in:
Christian Soffke 2021-03-09 03:57:23 +01:00 committed by Solomon Peachy
parent 13178d23b8
commit 3b9a803a5b
2 changed files with 35 additions and 22 deletions

View file

@ -477,7 +477,18 @@ MAKE_ONPLAYMENU( wps_playlist_menu, ID2P(LANG_PLAYLIST),
/* CONTEXT_[TREE|ID3DB] playlist options */
static bool add_to_playlist(int position, bool queue)
{
bool new_playlist = !(audio_status() & AUDIO_STATUS_PLAY) && (global_status.resume_index == -1 || playlist_resume() == -1);
bool new_playlist = false;
if (!(audio_status() & AUDIO_STATUS_PLAY))
{
if (position == PLAYLIST_REPLACE)
{
new_playlist = true;
position = PLAYLIST_INSERT;
}
else if (global_status.resume_index == -1 || playlist_resume() == -1)
new_playlist = true;
}
const char *lines[] = {
ID2P(LANG_RECURSE_DIRECTORY_QUESTION),
selected_file
@ -594,7 +605,7 @@ static int treeplaylist_callback(int action,
/* insert items */
MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT),
playlist_insert_func, (intptr_t*)PLAYLIST_INSERT,
NULL, Icon_Playlist);
treeplaylist_callback, Icon_Playlist);
MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST),
playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_FIRST,
treeplaylist_wplayback_callback, Icon_Playlist);
@ -630,7 +641,7 @@ MENUITEM_FUNCTION(q_last_shuf_pl_item, MENU_FUNC_USEPARAM,
/* replace playlist */
MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_REPLACE),
playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE,
treeplaylist_wplayback_callback, Icon_Playlist);
NULL, Icon_Playlist);
/* others */
MENUITEM_FUNCTION(view_playlist_item, 0, ID2P(LANG_VIEW),
@ -680,11 +691,17 @@ static int treeplaylist_callback(int action,
return action;
}
}
else if (this_item == &i_pl_item)
{
if (global_status.resume_index != -1)
return action;
}
else if (this_item == &i_shuf_pl_item)
{
if ((audio_status() & AUDIO_STATUS_PLAY) ||
(selected_file_attr & ATTR_DIRECTORY) ||
((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))
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)))
{
return action;
}

View file

@ -48,10 +48,10 @@ song.
rather than erasing the current
playlist, see the section below on how to add music to a playlist.}
\subsubsection{By using Insert and Queue functions}
If a dynamic playlist has finished playing, the \setting{Insert} and
\setting{Queue} functions as described in \ref{ref:playlist_submenu} will
\emph{replace} the playlist with the selected tracks instead of adding to it.
\subsubsection{By using the Play Next function}
The \setting{Play Next} function as described in \ref{ref:playlist_submenu} will
\emph{replace} the dynamic playlist with the selected tracks. If a track is
currently playing, it is only removed once its finished playing.
\subsubsection{\label{ref:playlist_catalogue}By using the Playlist catalogue}
The \setting{Playlist catalogue} makes it possible to modify and create
@ -79,10 +79,7 @@ in the \setting{Main Menu}. The created playlist will be named
\screenshot{rockbox_interface/images/ss-playlist-menu}{The Playlist Submenu}{}
The \setting{Playlist Submenu} is a submenu in the \setting{Context Menu} (see
\reference{ref:Contextmenu}), it allows you to put tracks into a
``dynamic playlist''. If the current playlist has finished playing, Rockbox will
create a new dynamic playlist and put the selected track(s) into it.
If there is music currently playing, Rockbox will put the
selected track(s) into the current playlist. The place in which the newly
``dynamic playlist''. The place in which the newly
selected tracks are added to the playlist is determined by the following
options:
@ -90,8 +87,7 @@ options:
\item [Insert.] Add track(s) immediately after any tracks added via the most
recent \setting{Insert} operation. If no tracks have yet been added via an
\setting{Insert}, new tracks will be added immediately after the current
playing track. If a dynamic playlist has finished playing,
it will be \emph{replaced} by the selected track(s).
playing track.
\item [Insert Next.] Add track(s) immediately after current playing
track, no matter what else has been inserted.
@ -115,8 +111,8 @@ options:
\item [Queue Last Shuffled.] Queue tracks in a random order at the end of the playlist.
\item [Play Next.] Replaces all but the current playing track with track(s).
Current playing track is queued.
\item [Play Next.] Replaces all tracks in the dynamic playlist.
If a track is currently playing, it is only removed once its finished playing.
\end{description}
The \setting{Playlist Submenu} can be used to add either single tracks or