diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2024-07-30 19:00:30 +0200 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2024-07-30 16:05:29 -0400 |
commit | a430120b3ff7cadd57ee0367b150a2f828099d9b (patch) | |
tree | cc4b680a01eb529eafd4cf874e72a4508ccc3804 | |
parent | e3097bf92c9fc74ed3b724caf338dd24d7f21621 (diff) | |
download | rockbox-a430120b3ff7cadd57ee0367b150a2f828099d9b.tar.gz rockbox-a430120b3ff7cadd57ee0367b150a2f828099d9b.zip |
plugins: properties: delay UI viewport update
Looks a little nicer whenever loading takes
less than 0.5s
Change-Id: Ied6c03fa8b06009f442d8c51aeaa49ad09b89db1
-rw-r--r-- | apps/plugins/lib/mul_id3.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/apps/plugins/lib/mul_id3.c b/apps/plugins/lib/mul_id3.c index e88bbfe417..3ab3a438c8 100644 --- a/apps/plugins/lib/mul_id3.c +++ b/apps/plugins/lib/mul_id3.c | |||
@@ -199,29 +199,23 @@ static const char *video_exts[] = {"mpg","mpeg","mpv","m2v"}; | |||
199 | static void display_dir_stats_vp(struct dir_stats *stats, struct viewport *vp, | 199 | static void display_dir_stats_vp(struct dir_stats *stats, struct viewport *vp, |
200 | struct screen *display) | 200 | struct screen *display) |
201 | { | 201 | { |
202 | static bool initialized; | ||
203 | int32_t lang_size_unit; | 202 | int32_t lang_size_unit; |
204 | unsigned long display_size = human_size(stats->byte_count, &lang_size_unit); | 203 | unsigned long display_size = human_size(stats->byte_count, &lang_size_unit); |
205 | struct viewport *last_vp = display->set_viewport(vp); | 204 | struct viewport *last_vp = display->set_viewport(vp); |
206 | display->clear_viewport(); | 205 | display->clear_viewport(); |
207 | if (initialized) | 206 | display->putsf(0, 0, "Files: %d (%lu %s)", stats->file_count, |
207 | display_size, rb->str(lang_size_unit)); | ||
208 | display->putsf(0, 1, "Audio: %d", stats->audio_file_count); | ||
209 | if (stats->count_all) | ||
208 | { | 210 | { |
209 | display->putsf(0, 0, "Files: %d (%lu %s)", stats->file_count, | 211 | display->putsf(0, 2, "Playlists: %d", stats->m3u_file_count); |
210 | display_size, rb->str(lang_size_unit)); | 212 | display->putsf(0, 3, "Images: %d", stats->img_file_count); |
211 | display->putsf(0, 1, "Audio: %d", stats->audio_file_count); | 213 | display->putsf(0, 4, "Videos: %d", stats->vid_file_count); |
212 | if (stats->count_all) | 214 | display->putsf(0, 5, "Directories: %d", stats->dir_count); |
213 | { | 215 | display->putsf(0, 6, "Max files in Dir: %d", stats->max_files_in_dir); |
214 | display->putsf(0, 2, "Playlists: %d", stats->m3u_file_count); | ||
215 | display->putsf(0, 3, "Images: %d", stats->img_file_count); | ||
216 | display->putsf(0, 4, "Videos: %d", stats->vid_file_count); | ||
217 | display->putsf(0, 5, "Directories: %d", stats->dir_count); | ||
218 | display->putsf(0, 6, "Max files in Dir: %d", stats->max_files_in_dir); | ||
219 | } | ||
220 | else | ||
221 | display->putsf(0, 2, "Directories: %d", stats->dir_count); | ||
222 | } | 216 | } |
223 | else | 217 | else |
224 | initialized = true; | 218 | display->putsf(0, 2, "Directories: %d", stats->dir_count); |
225 | 219 | ||
226 | display->update_viewport(); | 220 | display->update_viewport(); |
227 | display->set_viewport(last_vp); | 221 | display->set_viewport(last_vp); |
@@ -274,7 +268,8 @@ bool collect_dir_stats(struct dir_stats *stats, bool (*id3_cb)(const char*)) | |||
274 | stats->dir_count++; /* new directory */ | 268 | stats->dir_count++; /* new directory */ |
275 | if (*rb->current_tick - last_displayed > (HZ/2)) | 269 | if (*rb->current_tick - last_displayed > (HZ/2)) |
276 | { | 270 | { |
277 | display_dir_stats(stats); | 271 | if (last_displayed) |
272 | display_dir_stats(stats); | ||
278 | last_displayed = *(rb->current_tick); | 273 | last_displayed = *(rb->current_tick); |
279 | } | 274 | } |
280 | } | 275 | } |