mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-18 07:13:13 +00:00
fix: app nap ipc drop and implement delete modal
This commit is contained in:
@@ -18,7 +18,7 @@ use tokio::{
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
const PROGRESS_INTERVAL: Duration = Duration::from_millis(150);
|
||||
const PROGRESS_INTERVAL: Duration = Duration::from_millis(1000);
|
||||
const WRITE_BUFFER_CAPACITY: usize = 256 * 1024;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -153,6 +153,7 @@ impl CoordinatorEventSink {
|
||||
fraction,
|
||||
speed: format_speed(speed_bytes),
|
||||
eta,
|
||||
size: total.map(|t| format_size(t as f64)),
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -586,6 +587,18 @@ fn format_speed(bytes_per_second: f64) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
fn format_size(bytes: f64) -> String {
|
||||
if bytes >= 1024.0 * 1024.0 * 1024.0 {
|
||||
format!("{:.2} GB", bytes / (1024.0 * 1024.0 * 1024.0))
|
||||
} else if bytes >= 1024.0 * 1024.0 {
|
||||
format!("{:.1} MB", bytes / (1024.0 * 1024.0))
|
||||
} else if bytes >= 1024.0 {
|
||||
format!("{:.1} KB", bytes / 1024.0)
|
||||
} else {
|
||||
format!("{bytes:.0} B")
|
||||
}
|
||||
}
|
||||
|
||||
fn format_duration(seconds: f64) -> String {
|
||||
if seconds >= 3600.0 {
|
||||
format!("{:.0}h {:.0}m", seconds / 3600.0, (seconds % 3600.0) / 60.0)
|
||||
|
||||
Reference in New Issue
Block a user