summaryrefslogtreecommitdiff
path: root/apps/onplay.c
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 /apps/onplay.c
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
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c13
1 files changed, 11 insertions, 2 deletions
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