| 246 | } |
| 247 | |
| 248 | void DialogProgress::SetProgress(int target) { |
| 249 | pulse_timer.Stop(); |
| 250 | |
| 251 | if (target == progress_target) return; |
| 252 | using namespace std::chrono; |
| 253 | |
| 254 | progress_anim_start_value = progress_current; |
| 255 | auto now = steady_clock::now(); |
| 256 | if (progress_target == 0) |
| 257 | progress_anim_duration = 1000; |
| 258 | else |
| 259 | progress_anim_duration = std::max<int>(100, duration_cast<milliseconds>(now - progress_anim_start_time).count() * 11 / 10); |
| 260 | progress_anim_start_time = now; |
| 261 | progress_target = target; |
| 262 | } |
no test coverage detected