Wire missing UI controls to job config

- Add adjustments_enabled field and guard rotation/flip/adjustments behind it
- Wire adjustments toggle in workflow step
- Wire progressive JPEG toggle in convert and compress steps
- Wire format mapping ComboRows (JPEG/PNG/WebP/TIFF) in convert step
- Wire AVIF quality, WebP effort, AVIF speed controls in compress step
- Initialize all new controls from current config values
This commit is contained in:
2026-03-06 14:50:12 +02:00
parent 3aeb05c9a0
commit 2c28c092d4
4 changed files with 102 additions and 22 deletions

View File

@@ -318,25 +318,25 @@ pub fn build_compress_page(state: &AppState) -> adw::NavigationPage {
let avif_row = adw::SpinRow::builder()
.title("AVIF Quality")
.subtitle("1-100, higher is better quality")
.adjustment(&gtk::Adjustment::new(50.0, 1.0, 100.0, 1.0, 10.0, 0.0))
.adjustment(&gtk::Adjustment::new(cfg.avif_quality as f64, 1.0, 100.0, 1.0, 10.0, 0.0))
.build();
let progressive_row = adw::SwitchRow::builder()
.title("Progressive JPEG")
.subtitle("Loads gradually, slightly larger files")
.active(false)
.active(cfg.progressive_jpeg)
.build();
let webp_effort_row = adw::SpinRow::builder()
.title("WebP Encoding Effort")
.subtitle("0-6, higher is slower but smaller files")
.adjustment(&gtk::Adjustment::new(4.0, 0.0, 6.0, 1.0, 1.0, 0.0))
.adjustment(&gtk::Adjustment::new(cfg.webp_effort as f64, 0.0, 6.0, 1.0, 1.0, 0.0))
.build();
let avif_speed_row = adw::SpinRow::builder()
.title("AVIF Encoding Speed")
.subtitle("1-10, lower is slower but better compression")
.adjustment(&gtk::Adjustment::new(6.0, 1.0, 10.0, 1.0, 1.0, 0.0))
.adjustment(&gtk::Adjustment::new(cfg.avif_speed as f64, 1.0, 10.0, 1.0, 1.0, 0.0))
.build();
advanced_expander.add_row(&jpeg_row);
@@ -493,6 +493,30 @@ pub fn build_compress_page(state: &AppState) -> adw::NavigationPage {
jc.borrow_mut().webp_quality = row.value() as u8;
});
}
{
let jc = state.job_config.clone();
avif_row.connect_value_notify(move |row| {
jc.borrow_mut().avif_quality = row.value() as u8;
});
}
{
let jc = state.job_config.clone();
progressive_row.connect_active_notify(move |row| {
jc.borrow_mut().progressive_jpeg = row.is_active();
});
}
{
let jc = state.job_config.clone();
webp_effort_row.connect_value_notify(move |row| {
jc.borrow_mut().webp_effort = row.value() as u8;
});
}
{
let jc = state.job_config.clone();
avif_speed_row.connect_value_notify(move |row| {
jc.borrow_mut().avif_speed = row.value() as u8;
});
}
scrolled.set_child(Some(&content));