PictureFlow: Show background cache building progress

There was no easy way to see how far along PictureFlow
was in building the art cache, once background scanning
had commenced.

PF now uses the  screen area normally used by the FPS
meter to show completed percentage until building the
art cache has  finished.

Change-Id: I60fa7187b522cda219e35f5a9f630835ecac6883
This commit is contained in:
Christian Soffke 2021-12-12 18:34:41 +01:00 committed by Aidan MacDonald
parent f4fbc1bceb
commit 6c6f0757d7

View file

@ -3467,30 +3467,32 @@ static inline void draw_gradient(int y, int h)
static void track_list_yh(int char_height) static void track_list_yh(int char_height)
{ {
bool needs_space = pf_cfg.show_fps || aa_cache.inspected < pf_idx.album_ct;
switch (pf_cfg.show_album_name) switch (pf_cfg.show_album_name)
{ {
case ALBUM_NAME_HIDE: case ALBUM_NAME_HIDE:
pf_tracks.list_y = (pf_cfg.show_fps ? char_height : 0); pf_tracks.list_y = (needs_space ? char_height : 0);
pf_tracks.list_h = LCD_HEIGHT - pf_tracks.list_y; pf_tracks.list_h = LCD_HEIGHT - pf_tracks.list_y;
break; break;
case ALBUM_NAME_BOTTOM: case ALBUM_NAME_BOTTOM:
pf_tracks.list_y = (pf_cfg.show_fps ? char_height : 0); pf_tracks.list_y = (needs_space ? char_height : 0);
pf_tracks.list_h = LCD_HEIGHT - pf_tracks.list_y - (char_height * 3); pf_tracks.list_h = LCD_HEIGHT - pf_tracks.list_y - (char_height * 3);
break; break;
case ALBUM_AND_ARTIST_TOP: case ALBUM_AND_ARTIST_TOP:
pf_tracks.list_y = char_height * 3; pf_tracks.list_y = char_height * 3;
pf_tracks.list_h = LCD_HEIGHT - pf_tracks.list_y - pf_tracks.list_h = LCD_HEIGHT - pf_tracks.list_y -
(pf_cfg.show_fps ? char_height : 0); (needs_space ? char_height : 0);
break; break;
case ALBUM_AND_ARTIST_BOTTOM: case ALBUM_AND_ARTIST_BOTTOM:
pf_tracks.list_y = (pf_cfg.show_fps ? char_height : 0); pf_tracks.list_y = (needs_space ? char_height : 0);
pf_tracks.list_h = LCD_HEIGHT - pf_tracks.list_y - (char_height * 3); pf_tracks.list_h = LCD_HEIGHT - pf_tracks.list_y - (char_height * 3);
break; break;
case ALBUM_NAME_TOP: case ALBUM_NAME_TOP:
default: default:
pf_tracks.list_y = char_height * 3; pf_tracks.list_y = char_height * 3;
pf_tracks.list_h = LCD_HEIGHT - pf_tracks.list_y - pf_tracks.list_h = LCD_HEIGHT - pf_tracks.list_y -
(pf_cfg.show_fps ? char_height : 0); (needs_space ? char_height : 0);
break; break;
} }
} }
@ -3945,15 +3947,22 @@ static int pictureflow_main(void)
last_update = current_update; last_update = current_update;
frames = 0; frames = 0;
} }
/* Draw FPS */ /* Draw FPS or draw percentage of already built album cache */
if (pf_cfg.show_fps) if (pf_cfg.show_fps || aa_cache.inspected < pf_idx.album_ct)
{ {
#ifdef USEGSLIB #ifdef USEGSLIB
mylcd_set_foreground(G_BRIGHT(255)); mylcd_set_foreground(G_BRIGHT(255));
#else #else
mylcd_set_foreground(G_PIX(255,0,0)); mylcd_set_foreground(G_PIX(255,0,0));
#endif #endif
rb->snprintf(fpstxt, sizeof(fpstxt), "FPS: %d", fps); if(aa_cache.inspected >= pf_idx.album_ct)
rb->snprintf(fpstxt, sizeof(fpstxt), "FPS: %d", fps);
else
{
int progress_pct = 100 * aa_cache.inspected / pf_idx.album_ct;
rb->snprintf(fpstxt, sizeof(fpstxt), "%d %%", progress_pct);
}
if (pf_cfg.show_album_name == ALBUM_NAME_TOP) if (pf_cfg.show_album_name == ALBUM_NAME_TOP)
fpstxt_y = LCD_HEIGHT - fpstxt_y = LCD_HEIGHT -
rb->screens[SCREEN_MAIN]->getcharheight(); rb->screens[SCREEN_MAIN]->getcharheight();