Add crop/trim/canvas padding to adjustments, wire all sliders to config

Add crop to aspect ratio (8 ratios), trim whitespace, and canvas padding
controls to the adjustments step per design doc. Wire brightness,
contrast, saturation, sharpen, grayscale, and sepia to JobConfig. Add
Select All / Deselect All toolbar buttons to images step. Include new
adjustment operations in output step summary.
This commit is contained in:
2026-03-06 13:09:45 +02:00
parent 7c260c3534
commit 3ae84297d5
3 changed files with 191 additions and 32 deletions

View File

@@ -21,6 +21,15 @@ pub struct JobConfig {
// Adjustments
pub rotation: u32,
pub flip: u32,
pub brightness: i32,
pub contrast: i32,
pub saturation: i32,
pub sharpen: bool,
pub grayscale: bool,
pub sepia: bool,
pub crop_aspect_ratio: u32,
pub trim_whitespace: bool,
pub canvas_padding: u32,
// Convert
pub convert_enabled: bool,
pub convert_format: Option<pixstrip_core::types::ImageFormat>,
@@ -142,6 +151,15 @@ fn build_ui(app: &adw::Application) {
allow_upscale: false,
rotation: 0,
flip: 0,
brightness: 0,
contrast: 0,
saturation: 0,
sharpen: false,
grayscale: false,
sepia: false,
crop_aspect_ratio: 0,
trim_whitespace: false,
canvas_padding: 0,
convert_enabled: if remember { sess_state.convert_enabled.unwrap_or(false) } else { false },
convert_format: None,
compress_enabled: if remember { sess_state.compress_enabled.unwrap_or(true) } else { true },
@@ -1705,6 +1723,43 @@ fn update_output_summary(ui: &WizardUi) {
};
ops.push(fl.to_string());
}
if cfg.brightness != 0 {
ops.push(format!("Brightness {:+}", cfg.brightness));
}
if cfg.contrast != 0 {
ops.push(format!("Contrast {:+}", cfg.contrast));
}
if cfg.saturation != 0 {
ops.push(format!("Saturation {:+}", cfg.saturation));
}
if cfg.sharpen {
ops.push("Sharpen".to_string());
}
if cfg.grayscale {
ops.push("Grayscale".to_string());
}
if cfg.sepia {
ops.push("Sepia".to_string());
}
if cfg.crop_aspect_ratio > 0 {
let ratio = match cfg.crop_aspect_ratio {
1 => "1:1",
2 => "4:3",
3 => "3:2",
4 => "16:9",
5 => "9:16",
6 => "3:4",
7 => "2:3",
_ => "Custom",
};
ops.push(format!("Crop {}", ratio));
}
if cfg.trim_whitespace {
ops.push("Trim whitespace".to_string());
}
if cfg.canvas_padding > 0 {
ops.push(format!("Padding {}px", cfg.canvas_padding));
}
let summary_text = if ops.is_empty() {
"No operations configured".to_string()