summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-04-22 19:26:37 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-05-14 16:05:46 +0100
commitd20071def023b9ddac34559951871e037bd59785 (patch)
treeacaba3fdd1b2db2a37ec1ba396672dae2521f831
parent70087fb9f383af48c5fecb1aa275f4a68cda3298 (diff)
downloadrockbox-d20071def023b9ddac34559951871e037bd59785.tar.gz
rockbox-d20071def023b9ddac34559951871e037bd59785.zip
apps: Add "keep current track when replacing playlist" setting
Add a setting that makes Play and Play Shuffled in the playlist context menu leave the current song (if any) playing when they replace the playlist. Default to on, since this was the behavior of the old "Clear List & Play Next" option. Change-Id: I1340aed5c28bb3244e36d0953b3308ae59681c97
-rw-r--r--apps/lang/english.lang14
-rw-r--r--apps/menus/playlist_menu.c7
-rw-r--r--apps/onplay.c13
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_list.c4
-rw-r--r--manual/configure_rockbox/playlist_options.tex6
-rw-r--r--manual/working_with_playlists/main.tex5
7 files changed, 45 insertions, 5 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 4689660176..3b505bb9a2 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -16354,3 +16354,17 @@
16354 *: "Play Shuffled" 16354 *: "Play Shuffled"
16355 </voice> 16355 </voice>
16356</phrase> 16356</phrase>
16357<phrase>
16358 id: LANG_KEEP_CURRENT_TRACK_ON_REPLACE
16359 desc: used in the playlist settings menu
16360 user: core
16361 <source>
16362 *: "Keep Current Track When Replacing Playlist"
16363 </source>
16364 <dest>
16365 *: "Keep Current Track When Replacing Playlist"
16366 </dest>
16367 <voice>
16368 *: "Keep Current Track When Replacing Playlist"
16369 </voice>
16370</phrase>
diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c
index b84abe0b37..e1e83d4311 100644
--- a/apps/menus/playlist_menu.c
+++ b/apps/menus/playlist_menu.c
@@ -169,12 +169,17 @@ MAKE_MENU(viewer_settings_menu, ID2P(LANG_PLAYLISTVIEWER_SETTINGS),
169 169
170/* Current Playlist submenu */ 170/* Current Playlist submenu */
171MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL); 171MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL);
172MENUITEM_SETTING(keep_current_track_on_replace, &global_settings.keep_current_track_on_replace_playlist, NULL);
172MENUITEM_SETTING(show_shuffled_adding_options, &global_settings.show_shuffled_adding_options, NULL); 173MENUITEM_SETTING(show_shuffled_adding_options, &global_settings.show_shuffled_adding_options, NULL);
173MENUITEM_SETTING(show_queue_options, &global_settings.show_queue_options, NULL); 174MENUITEM_SETTING(show_queue_options, &global_settings.show_queue_options, NULL);
174MENUITEM_SETTING(playlist_reload_after_save, &global_settings.playlist_reload_after_save, NULL); 175MENUITEM_SETTING(playlist_reload_after_save, &global_settings.playlist_reload_after_save, NULL);
175MAKE_MENU(currentplaylist_settings_menu, ID2P(LANG_CURRENT_PLAYLIST), 176MAKE_MENU(currentplaylist_settings_menu, ID2P(LANG_CURRENT_PLAYLIST),
176 NULL, Icon_Playlist, 177 NULL, Icon_Playlist,
177 &warn_on_erase, &show_shuffled_adding_options, &show_queue_options, &playlist_reload_after_save); 178 &warn_on_erase,
179 &keep_current_track_on_replace,
180 &show_shuffled_adding_options,
181 &show_queue_options,
182 &playlist_reload_after_save);
178 183
179MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL, 184MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL,
180 Icon_Playlist, 185 Icon_Playlist,
diff --git a/apps/onplay.c b/apps/onplay.c
index 729fe40f0a..4ffa6deece 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -504,8 +504,8 @@ static int add_to_playlist(void* arg)
504{ 504{
505 struct add_to_pl_param* param = arg; 505 struct add_to_pl_param* param = arg;
506 int position = param->position; 506 int position = param->position;
507 bool new_playlist = param->replace ? true : false; 507 bool new_playlist = !!param->replace;
508 bool queue = param->queue ? true : false; 508 bool queue = !!param->queue;
509 509
510 /* warn if replacing the playlist */ 510 /* warn if replacing the playlist */
511 if (new_playlist && !warn_on_pl_erase()) 511 if (new_playlist && !warn_on_pl_erase())
@@ -519,6 +519,15 @@ static int add_to_playlist(void* arg)
519 519
520 splash(0, ID2P(LANG_WAIT)); 520 splash(0, ID2P(LANG_WAIT));
521 521
522 if (new_playlist && global_settings.keep_current_track_on_replace_playlist)
523 {
524 if (audio_status() & AUDIO_STATUS_PLAY)
525 {
526 playlist_remove_all_tracks(NULL);
527 new_playlist = false;
528 }
529 }
530
522 if (new_playlist) 531 if (new_playlist)
523 playlist_create(NULL, NULL); 532 playlist_create(NULL, NULL);
524 533
diff --git a/apps/settings.h b/apps/settings.h
index 53d7d35cae..9af8e27e5e 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -607,6 +607,7 @@ struct user_settings
607 bool fade_on_stop; /* fade on pause/unpause/stop */ 607 bool fade_on_stop; /* fade on pause/unpause/stop */
608 bool playlist_shuffle; 608 bool playlist_shuffle;
609 bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */ 609 bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */
610 bool keep_current_track_on_replace_playlist;
610 bool show_shuffled_adding_options; /* whether to display options for adding shuffled tracks to dynamic playlist */ 611 bool show_shuffled_adding_options; /* whether to display options for adding shuffled tracks to dynamic playlist */
611 int show_queue_options; /* how and whether to display options to queue tracks */ 612 int show_queue_options; /* how and whether to display options to queue tracks */
612#ifdef HAVE_ALBUMART 613#ifdef HAVE_ALBUMART
diff --git a/apps/settings_list.c b/apps/settings_list.c
index c2dec49499..0e39a58b1a 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1753,9 +1753,11 @@ const struct settings_list settings[] = {
1753 ID2P(LANG_CODEPAGE_JAPANESE), 1753 ID2P(LANG_CODEPAGE_JAPANESE),
1754 ID2P(LANG_CODEPAGE_SIMPLIFIED), ID2P(LANG_CODEPAGE_KOREAN), 1754 ID2P(LANG_CODEPAGE_SIMPLIFIED), ID2P(LANG_CODEPAGE_KOREAN),
1755 ID2P(LANG_CODEPAGE_TRADITIONAL), ID2P(LANG_CODEPAGE_UTF8)), 1755 ID2P(LANG_CODEPAGE_TRADITIONAL), ID2P(LANG_CODEPAGE_UTF8)),
1756
1756 OFFON_SETTING(0, warnon_erase_dynplaylist, LANG_WARN_ERASEDYNPLAYLIST_MENU, 1757 OFFON_SETTING(0, warnon_erase_dynplaylist, LANG_WARN_ERASEDYNPLAYLIST_MENU,
1757 true, "warn when erasing dynamic playlist",NULL), 1758 true, "warn when erasing dynamic playlist",NULL),
1758 1759 OFFON_SETTING(0, keep_current_track_on_replace_playlist, LANG_KEEP_CURRENT_TRACK_ON_REPLACE,
1760 true, "keep current track when replacing playlist",NULL),
1759 OFFON_SETTING(0, show_shuffled_adding_options, LANG_SHOW_SHUFFLED_ADDING_OPTIONS, true, 1761 OFFON_SETTING(0, show_shuffled_adding_options, LANG_SHOW_SHUFFLED_ADDING_OPTIONS, true,
1760 "show shuffled adding options", NULL), 1762 "show shuffled adding options", NULL),
1761 CHOICE_SETTING(0, show_queue_options, LANG_SHOW_QUEUE_OPTIONS, 1, 1763 CHOICE_SETTING(0, show_queue_options, LANG_SHOW_QUEUE_OPTIONS, 1,
diff --git a/manual/configure_rockbox/playlist_options.tex b/manual/configure_rockbox/playlist_options.tex
index 4f6024127e..b29842ceed 100644
--- a/manual/configure_rockbox/playlist_options.tex
+++ b/manual/configure_rockbox/playlist_options.tex
@@ -31,6 +31,12 @@ related to playlists.
31 If set to \setting{Yes}, Rockbox will provide a warning if the user attempts to 31 If set to \setting{Yes}, Rockbox will provide a warning if the user attempts to
32 take an action that will cause Rockbox to erase the current dynamic playlist. 32 take an action that will cause Rockbox to erase the current dynamic playlist.
33 33
34 \item[Keep Current Track When Replacing Playlist.]
35 If set to \setting{Yes}, then \setting{Play} and \setting{Play Shuffled} in
36 the \setting{Current Playlist submenu} will allow the current track to finish
37 playing before the new tracks play. If set to \setting{No}, the current
38 track will be interrupted and new tracks will start playing immediately.
39
34 \item[Show Shuffled Adding Options.] 40 \item[Show Shuffled Adding Options.]
35 If set to \setting{No}, Rockbox will not offer to add shuffled tracks 41 If set to \setting{No}, Rockbox will not offer to add shuffled tracks
36 in the \setting{Current Playlist submenu}. 42 in the \setting{Current Playlist submenu}.
diff --git a/manual/working_with_playlists/main.tex b/manual/working_with_playlists/main.tex
index 0d1ab7ef04..8571aac61c 100644
--- a/manual/working_with_playlists/main.tex
+++ b/manual/working_with_playlists/main.tex
@@ -118,7 +118,10 @@ following two options will achieve that effect.
118 118
119\begin{description} 119\begin{description}
120\item [Play.] Replace all entries in the dynamic playlist with the selected 120\item [Play.] Replace all entries in the dynamic playlist with the selected
121 tracks and start playing the new playlist immediately. 121 tracks. If \setting{Keep Current Track When Replacing Playlist} is set to
122 \setting{Yes}, the new tracks will play after the current track finishes
123 playing; if no track is playing or the setting is \setting{No}, the new
124 tracks will begin playing immediately.
122 125
123\item [Play Shuffled.] Similar, except the tracks will be added to the new 126\item [Play Shuffled.] Similar, except the tracks will be added to the new
124 playlist in random order. 127 playlist in random order.