Fix edge cases and consistency issues
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use adw::prelude::*;
|
||||
use crate::app::AppState;
|
||||
use crate::utils::format_size;
|
||||
|
||||
pub fn build_output_page(state: &AppState) -> adw::NavigationPage {
|
||||
let scrolled = gtk::ScrolledWindow::builder()
|
||||
@@ -79,6 +80,7 @@ pub fn build_output_page(state: &AppState) -> adw::NavigationPage {
|
||||
let overwrite_row = adw::ComboRow::builder()
|
||||
.title("Overwrite Behavior")
|
||||
.subtitle("What to do when output file already exists")
|
||||
.use_subtitle(true)
|
||||
.build();
|
||||
let overwrite_model = gtk::StringList::new(&[
|
||||
"Ask before overwriting",
|
||||
@@ -87,6 +89,7 @@ pub fn build_output_page(state: &AppState) -> adw::NavigationPage {
|
||||
"Skip existing files",
|
||||
]);
|
||||
overwrite_row.set_model(Some(&overwrite_model));
|
||||
overwrite_row.set_list_factory(Some(&super::full_text_list_factory()));
|
||||
overwrite_row.set_selected(cfg.overwrite_behavior as u32);
|
||||
|
||||
overwrite_group.add(&overwrite_row);
|
||||
@@ -137,26 +140,9 @@ pub fn build_output_page(state: &AppState) -> adw::NavigationPage {
|
||||
|
||||
scrolled.set_child(Some(&content));
|
||||
|
||||
let clamp = adw::Clamp::builder()
|
||||
.maximum_size(600)
|
||||
.child(&scrolled)
|
||||
.build();
|
||||
|
||||
adw::NavigationPage::builder()
|
||||
.title("Output & Process")
|
||||
.tag("step-output")
|
||||
.child(&clamp)
|
||||
.child(&scrolled)
|
||||
.build()
|
||||
}
|
||||
|
||||
fn format_size(bytes: u64) -> String {
|
||||
if bytes < 1024 {
|
||||
format!("{} B", bytes)
|
||||
} else if bytes < 1024 * 1024 {
|
||||
format!("{:.1} KB", bytes as f64 / 1024.0)
|
||||
} else if bytes < 1024 * 1024 * 1024 {
|
||||
format!("{:.1} MB", bytes as f64 / (1024.0 * 1024.0))
|
||||
} else {
|
||||
format!("{:.1} GB", bytes as f64 / (1024.0 * 1024.0 * 1024.0))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user