summaryrefslogtreecommitdiff
path: root/apps/onplay.c
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2021-12-29 20:24:51 +0100
committerWilliam Wilgus <me.theuser@yahoo.com>2022-01-04 18:00:49 -0500
commite3b8b7fa80320f0c8bbc84d4364ea83b5991db20 (patch)
tree210ae8372dac52417bdcc938078589d6aebedacd /apps/onplay.c
parentbfe3dac3badd6ddd22f65237cbbd839f8feb4a17 (diff)
downloadrockbox-e3b8b7fa80320f0c8bbc84d4364ea83b5991db20.tar.gz
rockbox-e3b8b7fa80320f0c8bbc84d4364ea83b5991db20.zip
PictureFlow: Utilize "Current Playlist" menu (+ GS fixes)
When appending tracks, they were always inserted last. You can now choose from the usual options offered by the "Current Playlst" context menu to queue or to insert tracks at the requested position. The splash after appending that forced you to wait for 2s has been eliminated. Also fixes crashes on targets that use the grey_core lib if a splash showed up when playback was started, e.g. LANG_PLAYLIST_CONTROL_ACCESS_ERROR, or when PictureFlow quit. Change-Id: I661c59057b5315ba793ee1674f7a2ea1ffd7968d
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index 93c7c93624..61ef8acad5 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -69,6 +69,7 @@ static const char *selected_file = NULL;
69static char selected_file_path[MAX_PATH]; 69static char selected_file_path[MAX_PATH];
70static int selected_file_attr = 0; 70static int selected_file_attr = 0;
71static int onplay_result = ONPLAY_OK; 71static int onplay_result = ONPLAY_OK;
72static bool (*ctx_playlist_insert)(int position, bool queue, bool create_new);
72extern struct menu_item_ex file_menu; /* settings_menu.c */ 73extern struct menu_item_ex file_menu; /* settings_menu.c */
73 74
74/* redefine MAKE_MENU so the MENU_EXITAFTERTHISMENU flag can be added easily */ 75/* redefine MAKE_MENU so the MENU_EXITAFTERTHISMENU flag can be added easily */
@@ -474,7 +475,7 @@ MAKE_ONPLAYMENU( wps_playlist_menu, ID2P(LANG_PLAYLIST),
474 &playlist_save_item, &reshuffle_item, &playing_time_item 475 &playlist_save_item, &reshuffle_item, &playing_time_item
475 ); 476 );
476 477
477/* CONTEXT_[TREE|ID3DB] playlist options */ 478/* CONTEXT_[TREE|ID3DB|STD] playlist options */
478static bool add_to_playlist(int position, bool queue) 479static bool add_to_playlist(int position, bool queue)
479{ 480{
480 bool new_playlist = false; 481 bool new_playlist = false;
@@ -510,6 +511,10 @@ static bool add_to_playlist(int position, bool queue)
510 { 511 {
511 tagtree_insert_selection_playlist(position, queue); 512 tagtree_insert_selection_playlist(position, queue);
512 } 513 }
514 else if (context == CONTEXT_STD && ctx_playlist_insert != NULL)
515 {
516 ctx_playlist_insert(position, queue, false);
517 }
513 else 518 else
514#endif 519#endif
515 { 520 {
@@ -774,9 +779,10 @@ static int treeplaylist_callback(int action,
774 return action; 779 return action;
775} 780}
776 781
777void onplay_show_playlist_menu(char* path) 782void onplay_show_playlist_menu(const char* path, void (*playlist_insert_cb))
778{ 783{
779 context = CONTEXT_STD; 784 context = CONTEXT_STD;
785 ctx_playlist_insert = playlist_insert_cb;
780 selected_file = path; 786 selected_file = path;
781 if (dir_exists(path)) 787 if (dir_exists(path))
782 selected_file_attr = ATTR_DIRECTORY; 788 selected_file_attr = ATTR_DIRECTORY;
@@ -1939,6 +1945,7 @@ int onplay(char* file, int attr, int from, bool hotkey)
1939 const struct menu_item_ex *menu; 1945 const struct menu_item_ex *menu;
1940 onplay_result = ONPLAY_OK; 1946 onplay_result = ONPLAY_OK;
1941 context = from; 1947 context = from;
1948 ctx_playlist_insert = NULL;
1942 if (file == NULL) 1949 if (file == NULL)
1943 selected_file = NULL; 1950 selected_file = NULL;
1944 else 1951 else