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:
@@ -19,6 +19,7 @@ pub struct JobConfig {
|
||||
pub resize_height: u32,
|
||||
pub allow_upscale: bool,
|
||||
// Adjustments
|
||||
pub adjustments_enabled: bool,
|
||||
pub rotation: u32,
|
||||
pub flip: u32,
|
||||
pub brightness: i32,
|
||||
@@ -33,12 +34,20 @@ pub struct JobConfig {
|
||||
// Convert
|
||||
pub convert_enabled: bool,
|
||||
pub convert_format: Option<pixstrip_core::types::ImageFormat>,
|
||||
pub progressive_jpeg: bool,
|
||||
pub format_mapping_jpeg: u32,
|
||||
pub format_mapping_png: u32,
|
||||
pub format_mapping_webp: u32,
|
||||
pub format_mapping_tiff: u32,
|
||||
// Compress
|
||||
pub compress_enabled: bool,
|
||||
pub quality_preset: pixstrip_core::types::QualityPreset,
|
||||
pub jpeg_quality: u8,
|
||||
pub png_level: u8,
|
||||
pub webp_quality: u8,
|
||||
pub avif_quality: u8,
|
||||
pub webp_effort: u8,
|
||||
pub avif_speed: u8,
|
||||
// Metadata
|
||||
pub metadata_enabled: bool,
|
||||
pub metadata_mode: MetadataMode,
|
||||
@@ -180,6 +189,7 @@ fn build_ui(app: &adw::Application) {
|
||||
resize_width: if remember { sess_state.resize_width.unwrap_or(1200) } else { 1200 },
|
||||
resize_height: if remember { sess_state.resize_height.unwrap_or(0) } else { 0 },
|
||||
allow_upscale: false,
|
||||
adjustments_enabled: false,
|
||||
rotation: 0,
|
||||
flip: 0,
|
||||
brightness: 0,
|
||||
@@ -193,11 +203,19 @@ fn build_ui(app: &adw::Application) {
|
||||
canvas_padding: 0,
|
||||
convert_enabled: if remember { sess_state.convert_enabled.unwrap_or(false) } else { false },
|
||||
convert_format: None,
|
||||
progressive_jpeg: false,
|
||||
format_mapping_jpeg: 0,
|
||||
format_mapping_png: 0,
|
||||
format_mapping_webp: 0,
|
||||
format_mapping_tiff: 0,
|
||||
compress_enabled: if remember { sess_state.compress_enabled.unwrap_or(true) } else { true },
|
||||
quality_preset: pixstrip_core::types::QualityPreset::Medium,
|
||||
jpeg_quality: 85,
|
||||
png_level: 3,
|
||||
webp_quality: 80,
|
||||
avif_quality: 50,
|
||||
webp_effort: 4,
|
||||
avif_speed: 6,
|
||||
metadata_enabled: if remember { sess_state.metadata_enabled.unwrap_or(true) } else { true },
|
||||
metadata_mode: MetadataMode::StripAll,
|
||||
strip_gps: true,
|
||||
@@ -1152,24 +1170,22 @@ fn run_processing(_window: &adw::ApplicationWindow, ui: &WizardUi) {
|
||||
});
|
||||
}
|
||||
|
||||
// Rotation
|
||||
job.rotation = Some(match cfg.rotation {
|
||||
1 => pixstrip_core::operations::Rotation::Cw90,
|
||||
2 => pixstrip_core::operations::Rotation::Cw180,
|
||||
3 => pixstrip_core::operations::Rotation::Cw270,
|
||||
4 => pixstrip_core::operations::Rotation::AutoOrient,
|
||||
_ => pixstrip_core::operations::Rotation::None,
|
||||
});
|
||||
// Rotation, Flip, and Adjustments (only when adjustments step is enabled)
|
||||
if cfg.adjustments_enabled {
|
||||
job.rotation = Some(match cfg.rotation {
|
||||
1 => pixstrip_core::operations::Rotation::Cw90,
|
||||
2 => pixstrip_core::operations::Rotation::Cw180,
|
||||
3 => pixstrip_core::operations::Rotation::Cw270,
|
||||
4 => pixstrip_core::operations::Rotation::AutoOrient,
|
||||
_ => pixstrip_core::operations::Rotation::None,
|
||||
});
|
||||
|
||||
// Flip
|
||||
job.flip = Some(match cfg.flip {
|
||||
1 => pixstrip_core::operations::Flip::Horizontal,
|
||||
2 => pixstrip_core::operations::Flip::Vertical,
|
||||
_ => pixstrip_core::operations::Flip::None,
|
||||
});
|
||||
job.flip = Some(match cfg.flip {
|
||||
1 => pixstrip_core::operations::Flip::Horizontal,
|
||||
2 => pixstrip_core::operations::Flip::Vertical,
|
||||
_ => pixstrip_core::operations::Flip::None,
|
||||
});
|
||||
|
||||
// Adjustments
|
||||
{
|
||||
let crop = match cfg.crop_aspect_ratio {
|
||||
1 => Some((1.0, 1.0)),
|
||||
2 => Some((4.0, 3.0)),
|
||||
|
||||
Reference in New Issue
Block a user