From 3ef49d9c5e92579dcb7e51e081b27fddf8c7b9b4 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Fri, 26 May 2023 03:24:45 +0200 Subject: PictureFlow: Make Shuffle options available The "Playing Next..." menu couldn't display any options for shuffling tracks of an album before Change-Id: I54f4497394fb29877bf8bce0ef95a27c82eb2279 --- apps/onplay.c | 7 ++----- apps/onplay.h | 2 +- apps/playlist_viewer.c | 2 +- apps/plugin.h | 4 ++-- apps/plugins/pictureflow/pictureflow.c | 14 ++++++++------ apps/shortcuts.c | 5 ++++- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/apps/onplay.c b/apps/onplay.c index 3e52aab003..341da62840 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -828,15 +828,12 @@ static int treeplaylist_callback(int action, return action; } -void onplay_show_playlist_menu(const char* path, void (*playlist_insert_cb)) +void onplay_show_playlist_menu(const char* path, int attr, void (*playlist_insert_cb)) { context = CONTEXT_STD; ctx_current_playlist_insert = playlist_insert_cb; selected_file = path; - if (dir_exists(path)) - selected_file_attr = ATTR_DIRECTORY; - else - selected_file_attr = filetype_get_attr(path); + selected_file_attr = attr; in_queue_submenu = false; do_menu(&tree_playlist_menu, NULL, NULL, false); } diff --git a/apps/onplay.h b/apps/onplay.h index 144fb80df1..ea1c2e6c38 100644 --- a/apps/onplay.h +++ b/apps/onplay.h @@ -78,6 +78,6 @@ const struct hotkey_assignment *get_hotkey(int action); /* needed for the playlist viewer.. eventually clean this up */ void onplay_show_playlist_cat_menu(const char* track_name, int attr, void (*add_to_pl_cb)); -void onplay_show_playlist_menu(const char* path, void (*playlist_insert_cb)); +void onplay_show_playlist_menu(const char* path, int attr, void (*playlist_insert_cb)); #endif diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index e3a3b1bea7..28b919b008 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -634,7 +634,7 @@ static enum pv_onplay_result onplay_menu(int index) { case 0: /* playlist */ - onplay_show_playlist_menu(current_track->name, NULL); + onplay_show_playlist_menu(current_track->name, FILE_ATTR_AUDIO, NULL); ret = PV_ONPLAY_UNCHANGED; break; case 1: diff --git a/apps/plugin.h b/apps/plugin.h index 9e94fe697e..ad8822ed72 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -162,7 +162,7 @@ int plugin_open(const char *plugin, const char *parameter); * when this happens please take the opportunity to sort in * any new functions "waiting" at the end of the list. */ -#define PLUGIN_API_VERSION 268 +#define PLUGIN_API_VERSION 269 /* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ @@ -495,7 +495,7 @@ struct plugin_api { void (*set_current_file)(const char* path); void (*set_dirfilter)(int l_dirfilter); - void (*onplay_show_playlist_menu)(const char* path, void (*playlist_insert_cb)); + void (*onplay_show_playlist_menu)(const char* path, int attr, void (*playlist_insert_cb)); void (*onplay_show_playlist_cat_menu)(const char* track_name, int attr, void (*add_to_pl_cb)); bool (*browse_id3)(struct mp3entry *id3, diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 75504cf17e..b21faf1dd8 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -4188,7 +4188,7 @@ static int context_menu(void) { char album_name[MAX_PATH]; char *file_name = get_track_filename(show_tracks_while_browsing ? 0 : pf_tracks.sel); - int attr; + int attr = FILE_ATTR_AUDIO; enum { PF_CURRENT_PLAYLIST = 0, @@ -4205,13 +4205,15 @@ static int context_menu(void) NULL, NULL, false)) { case PF_CURRENT_PLAYLIST: - rb->onplay_show_playlist_menu(file_name, - &pf_current_playlist_insert); + if (insert_whole_album && pf_tracks.count > 1) + { + attr = ATTR_DIRECTORY; + file_name = NULL; + } + rb->onplay_show_playlist_menu(file_name, attr, &pf_current_playlist_insert); return 0; case PF_CATALOG: - if (!insert_whole_album) - attr = FILE_ATTR_AUDIO; - else + if (insert_whole_album) { /* add a leading slash so that catalog_add_to_a_playlist later prefills the name when creating a new playlist */ diff --git a/apps/shortcuts.c b/apps/shortcuts.c index 2e10bad00f..b52ff4a741 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c @@ -640,7 +640,10 @@ int do_shortcut_menu(void *ignored) } else { - onplay_show_playlist_menu(sc->u.path, NULL); + onplay_show_playlist_menu(sc->u.path, + dir_exists(sc->u.path) ? ATTR_DIRECTORY : + filetype_get_attr(sc->u.path), + NULL); } break; case SHORTCUT_FILE: -- cgit v1.2.3