playlist_viewer: show loading splash for current playlist after delay

Provide UI feedback if playlist can't be displayed in time.

Change-Id: I5faabc2690aaeb6989f342dc284e1e7e38ba1d7d
This commit is contained in:
Christian Soffke 2026-05-07 01:45:51 +02:00
parent 05f1a6605d
commit ce403586e0

View file

@ -124,6 +124,8 @@ struct playlist_viewer {
struct playlist_buffer buffer;
struct mp3entry *id3;
bool allow_view_text_plugin;
unsigned long loading_tick;
bool is_open;
};
struct playlist_search_data
@ -214,6 +216,13 @@ static void playlist_buffer_load_entries(struct playlist_buffer *pb, int index,
for (i = 0; i < num_entries; i++)
{
/* provide UI feedback if opening Playlist Viewer is taking too long */
if (!viewer.is_open && TIME_AFTER(current_tick, viewer.loading_tick))
{
viewer.loading_tick += HZ*10;
splash(0, ID2P(LANG_WAIT));
}
int len = playlist_entry_load(&(pb->tracks[i]), index, p, remaining);
if (len < 0)
{
@ -663,6 +672,7 @@ static void close_playlist_viewer(void)
}
playlist_close(viewer.playlist);
}
viewer.is_open = false;
}
#if defined(HAVE_HOTKEY) || defined(HAVE_TAGCACHE)
@ -960,9 +970,12 @@ static bool open_playlist_viewer(const char* filename,
struct gui_synclist *playlist_lists,
bool reload, int *most_recent_selection)
{
viewer.loading_tick = current_tick + HZ/3;
push_current_activity(ACTIVITY_PLAYLISTVIEWER);
if (!playlist_viewer_init(&viewer, filename, reload, most_recent_selection))
if (playlist_viewer_init(&viewer, filename, reload, most_recent_selection))
viewer.is_open = true;
else
return false;
update_gui(playlist_lists, true);