feat(ui): disabled fraction displaying in repairer's progress bar

This commit is contained in:
Observer KRypt0n_ 2023-04-12 15:26:35 +02:00
parent 3d6b3bfd96
commit 985b66d72b
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
2 changed files with 5 additions and 0 deletions
src/ui

View file

@ -39,6 +39,8 @@ pub struct ProgressBar {
pub enum ProgressBarMsg {
Reset,
UpdateCaption(Option<String>),
DisplayProgress(bool),
DisplayFraction(bool),
/// (current bytes, total bytes)
UpdateProgress(u64, u64),
@ -115,6 +117,8 @@ impl SimpleAsyncComponent for ProgressBar {
}
ProgressBarMsg::UpdateCaption(caption) => self.caption = caption,
ProgressBarMsg::DisplayProgress(value) => self.display_progress = value,
ProgressBarMsg::DisplayFraction(value) => self.display_fraction = value,
ProgressBarMsg::UpdateProgress(curr, total) => {
self.fraction = curr as f64 / total as f64;

View file

@ -100,6 +100,7 @@ pub fn repair_game(sender: ComponentSender<App>, progress_bar_input: Sender<Prog
if !broken.is_empty() {
progress_bar_input.send(ProgressBarMsg::UpdateCaption(Some(tr("repairing-files"))));
progress_bar_input.send(ProgressBarMsg::DisplayFraction(false));
progress_bar_input.send(ProgressBarMsg::UpdateProgress(0, 0));
tracing::warn!("Found broken files:\n{}", broken.iter().fold(String::new(), |acc, file| acc + &format!("- {}\n", file.path.to_string_lossy())));