From 8fd0378c6fff3297e106250f7235839068def7f7 Mon Sep 17 00:00:00 2001 From: Tomas Salfischberger Date: Thu, 23 Jun 2005 15:49:36 +0000 Subject: Added a "Shuffle playlist" option to the context menu. Someone on the forum came up with it, and I liked the idea :) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6842 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 6 ++++++ apps/onplay.c | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 4549d6c041..b8b4e2d827 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -3105,3 +3105,9 @@ desc: in settings_menu eng: "Backlight fade out" voice: "Backlight fade out" new: + +id: LANG_SHUFFLE_PLAYLIST +desc: in playlist menu, shuffles the playlist. +eng: "Shuffle playlist" +voice: "Shuffle playlist" +new: diff --git a/apps/onplay.c b/apps/onplay.c index d262eced3d..7655a8e075 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -134,6 +134,18 @@ static bool list_viewers(void) return false; } +static bool shuffle_playlist(void) +{ + int seed, index; + + seed = playlist_get_seed(NULL); + index = playlist_get_first_index(NULL); + + playlist_shuffle(seed, index); + + return false; +} + static bool save_playlist(void) { char filename[MAX_PATH+1]; @@ -237,8 +249,8 @@ static bool view_playlist(void) /* Sub-menu for playlist options */ static bool playlist_options(void) { - struct menu_item items[10]; - struct playlist_args args[10]; /* increase these 2 if you add entries! */ + struct menu_item items[11]; + struct playlist_args args[11]; /* increase these 2 if you add entries! */ int m, i=0, pstart=0, result; bool ret = false; @@ -262,6 +274,11 @@ static bool playlist_options(void) items[i].function = save_playlist; i++; pstart++; + + items[i].desc = ID2P(LANG_SHUFFLE_PLAYLIST); + items[i].function = shuffle_playlist; + i++; + pstart++; } if (context == CONTEXT_TREE) -- cgit v1.2.3