playlist_viewer: show loading splash for current playlist after delay
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Thu, 7 May 2026 22:53:40 -0400
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit ce403586e0b0f34d2f5035235907eb64cd91c28e Author: Christian Soffke <[email protected]> Date: Thu May 7 01:45:51 2026 +0200 playlist_viewer: show loading splash for current playlist after delay Provide UI feedback if playlist can't be displayed in time. Change-Id: I5faabc2690aaeb6989f342dc284e1e7e38ba1d7d diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 4ec8dd59bf..176d15a989 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -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); -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs