From c2e86cd0d919a5ec93014359ebf1340593fdc84a Mon Sep 17 00:00:00 2001 From: Tomas Salfischberger Date: Sat, 4 Mar 2006 23:53:09 +0000 Subject: [PATCH] Patch FS#4759 by Jonathan Gordon - searching in playlists. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8906 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 12 +++++ apps/onplay.c | 9 +++- apps/playlist_viewer.c | 110 +++++++++++++++++++++++++++++++++++++++++ apps/playlist_viewer.h | 1 + 4 files changed, 130 insertions(+), 2 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index efb0a942f9..bc355f00e3 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -3784,3 +3784,15 @@ desc: splash when user selects an invalid colour eng: "Invalid colour" voice: "" new: + +id: LANG_SEARCH_IN_PLAYLIST +desc: in playlist menu. +eng: "Search In Playlist" +voice: +new: + +id: LANG_PLAYLIST_SEARCH_MSG +desc: splash number of tracks inserted +eng: "Searching... %d found (%s)" +voice: "" +new: diff --git a/apps/onplay.c b/apps/onplay.c index 88607f7754..be11b9a2da 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -243,8 +243,8 @@ static bool view_playlist(void) /* Sub-menu for playlist options */ static bool playlist_options(void) { - struct menu_item items[12]; - struct playlist_args args[12]; /* increase these 2 if you add entries! */ + struct menu_item items[13]; + struct playlist_args args[13]; /* increase these 2 if you add entries! */ int m, i=0, pstart=0, result; bool ret = false; @@ -265,6 +265,11 @@ static bool playlist_options(void) i++; pstart++; + items[i].desc = ID2P(LANG_SEARCH_IN_PLAYLIST); + items[i].function = search_playlist; + i++; + pstart++; + items[i].desc = ID2P(LANG_SAVE_DYNAMIC_PLAYLIST); items[i].function = save_playlist; i++; diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index ddc238cb27..422c0047ff 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -804,3 +804,113 @@ exit: playlist_close(viewer.playlist); return ret; } +char * playlist_search_callback_name(int selected_item, void * data, char *buffer) +{ + int *found_indicies = (int*)data; + static struct playlist_track_info track; + playlist_get_track_info(viewer.playlist,found_indicies[selected_item],&track); + format_name(buffer,track.filename); + return(buffer); +} + + +void playlist_search_callback_icons(int selected_item, void * data, ICON * icon) +{ + (void)selected_item; + (void)data; +#ifdef HAVE_LCD_BITMAP + *icon=0; +#else + *icon=-1; +#endif +} +bool search_playlist(void) +{ + char search_str[32] = ""; + bool ret = false, exit = false; + int i, playlist_count; + int found_indicies[MAX_PLAYLIST_ENTRIES],found_indicies_count = 0; + int button; + struct gui_synclist playlist_lists; + struct playlist_track_info track; + + if (!playlist_viewer_init(&viewer, 0, false)) + return ret; + if (kbd_input(search_str,sizeof(search_str)) == -1) + return ret; + lcd_clear_display(); + playlist_count = playlist_amount_ex(viewer.playlist); + for (i=0;(i