diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-10-13 00:05:34 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2022-10-13 00:10:25 -0400 |
commit | f9ea1fc79d6aaff9949a5b11ae011b4e04e0e9d9 (patch) | |
tree | acef9a442d685e930b9d7435c72d634c841dc795 /apps/playlist.c | |
parent | c607bfac6feb6bb915f3133a5c70ba871f5112ed (diff) | |
download | rockbox-f9ea1fc79d6aaff9949a5b11ae011b4e04e0e9d9.tar.gz rockbox-f9ea1fc79d6aaff9949a5b11ae011b4e04e0e9d9.zip |
splash_progress add delay function
I figure this is a better way to allow a delay before showing the
progress meter
Change-Id: I909902a52619023b0b87635d2eb94ed00cb4bcec
Diffstat (limited to 'apps/playlist.c')
-rw-r--r-- | apps/playlist.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index e54918f4f7..888b53d282 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -2196,25 +2196,23 @@ int playlist_resume(void) | |||
2196 | char *str1 = NULL; | 2196 | char *str1 = NULL; |
2197 | char *str2 = NULL; | 2197 | char *str2 = NULL; |
2198 | char *str3 = NULL; | 2198 | char *str3 = NULL; |
2199 | unsigned long last_tick = current_tick + HZ / 2; /* wait 1/2 sec before progress */ | 2199 | unsigned long last_tick = current_tick; |
2200 | splash_progress_set_delay(HZ / 2); /* wait 1/2 sec before progress */ | ||
2200 | bool useraborted = false; | 2201 | bool useraborted = false; |
2201 | 2202 | ||
2202 | for(count=0; count<nread && !exit_loop && !useraborted; count++,p++) | 2203 | for(count=0; count<nread && !exit_loop && !useraborted; count++,p++) |
2203 | { | 2204 | { |
2204 | /* Show a splash while we are loading. */ | 2205 | /* Show a splash while we are loading. */ |
2205 | if (TIME_AFTER(current_tick, last_tick - 1)) | 2206 | splash_progress((total_read + count), control_file_size, |
2207 | "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT)); | ||
2208 | if (TIME_AFTER(current_tick, last_tick + HZ/4)) | ||
2206 | { | 2209 | { |
2207 | splash_progress((total_read + count), control_file_size, | 2210 | if (action_userabort(TIMEOUT_NOBLOCK)) |
2208 | "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT)); | ||
2209 | if (TIME_AFTER(current_tick, last_tick + HZ/4)) | ||
2210 | { | 2211 | { |
2211 | if (action_userabort(TIMEOUT_NOBLOCK)) | 2212 | useraborted = true; |
2212 | { | 2213 | break; |
2213 | useraborted = true; | ||
2214 | break; | ||
2215 | } | ||
2216 | last_tick = current_tick; | ||
2217 | } | 2214 | } |
2215 | last_tick = current_tick; | ||
2218 | } | 2216 | } |
2219 | /* Are we on a new line? */ | 2217 | /* Are we on a new line? */ |
2220 | if((*p == '\n') || (*p == '\r')) | 2218 | if((*p == '\n') || (*p == '\r')) |