From 5bdeb8a2e399e66ce7eee397c133c948fbcf1132 Mon Sep 17 00:00:00 2001 From: lashman Date: Fri, 6 Mar 2026 15:28:02 +0200 Subject: [PATCH] Wire skill level and accessibility settings to UI - Add detailed_mode to AppState, derived from skill_level setting - Expand advanced option sections by default in Detailed mode (resize, convert, compress, watermark steps) - Fix high contrast to use HighContrast GTK theme - Add completion sound via canberra-gtk-play --- pixstrip-gtk/src/app.rs | 11 ++++++----- pixstrip-gtk/src/steps/step_compress.rs | 1 + pixstrip-gtk/src/steps/step_convert.rs | 1 + pixstrip-gtk/src/steps/step_resize.rs | 1 + pixstrip-gtk/src/steps/step_watermark.rs | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pixstrip-gtk/src/app.rs b/pixstrip-gtk/src/app.rs index 2dd84a1..f1d316f 100644 --- a/pixstrip-gtk/src/app.rs +++ b/pixstrip-gtk/src/app.rs @@ -94,6 +94,7 @@ pub struct AppState { pub excluded_files: Rc>>, pub output_dir: Rc>>, pub job_config: Rc>, + pub detailed_mode: bool, } #[derive(Clone)] @@ -218,6 +219,7 @@ fn build_ui(app: &adw::Application) { loaded_files: Rc::new(RefCell::new(Vec::new())), excluded_files: Rc::new(RefCell::new(std::collections::HashSet::new())), output_dir: Rc::new(RefCell::new(None)), + detailed_mode: app_cfg.skill_level.is_advanced(), job_config: Rc::new(RefCell::new(JobConfig { resize_enabled: if remember { sess_state.resize_enabled.unwrap_or(true) } else { true }, resize_width: if remember { sess_state.resize_width.unwrap_or(1200) } else { 1200 }, @@ -2503,11 +2505,10 @@ fn apply_accessibility_settings() { let config = config_store.load().unwrap_or_default(); if config.high_contrast { - // Use libadwaita's high contrast mode - let style_manager = adw::StyleManager::default(); - style_manager.set_color_scheme(adw::ColorScheme::ForceLight); - // High contrast is best achieved via the GTK_THEME env or system - // settings; the app respects system high contrast automatically + // Request high contrast by switching to the HighContrast theme. + // This works on GNOME systems with the standard HC theme installed. + let settings = gtk::Settings::default().unwrap(); + settings.set_gtk_theme_name(Some("HighContrast")); } let settings = gtk::Settings::default().unwrap(); diff --git a/pixstrip-gtk/src/steps/step_compress.rs b/pixstrip-gtk/src/steps/step_compress.rs index 4f77e57..826a084 100644 --- a/pixstrip-gtk/src/steps/step_compress.rs +++ b/pixstrip-gtk/src/steps/step_compress.rs @@ -295,6 +295,7 @@ pub fn build_compress_page(state: &AppState) -> adw::NavigationPage { let advanced_expander = adw::ExpanderRow::builder() .title("Per-Format Quality") .subtitle("Fine-tune quality for each format individually") + .expanded(state.detailed_mode) .build(); let jpeg_row = adw::SpinRow::builder() diff --git a/pixstrip-gtk/src/steps/step_convert.rs b/pixstrip-gtk/src/steps/step_convert.rs index d1c8589..2553044 100644 --- a/pixstrip-gtk/src/steps/step_convert.rs +++ b/pixstrip-gtk/src/steps/step_convert.rs @@ -145,6 +145,7 @@ pub fn build_convert_page(state: &AppState) -> adw::NavigationPage { .title("Format Mapping") .subtitle("Different input formats can convert to different outputs") .show_enable_switch(false) + .expanded(state.detailed_mode) .build(); let progressive_row = adw::SwitchRow::builder() diff --git a/pixstrip-gtk/src/steps/step_resize.rs b/pixstrip-gtk/src/steps/step_resize.rs index db3bcf1..fc7e6dc 100644 --- a/pixstrip-gtk/src/steps/step_resize.rs +++ b/pixstrip-gtk/src/steps/step_resize.rs @@ -372,6 +372,7 @@ pub fn build_resize_page(state: &AppState) -> adw::NavigationPage { .title("Advanced Options") .subtitle("Resize algorithm, DPI, upscale behavior") .show_enable_switch(false) + .expanded(state.detailed_mode) .build(); let upscale_row = adw::SwitchRow::builder() diff --git a/pixstrip-gtk/src/steps/step_watermark.rs b/pixstrip-gtk/src/steps/step_watermark.rs index 9dfdc4e..2aef57a 100644 --- a/pixstrip-gtk/src/steps/step_watermark.rs +++ b/pixstrip-gtk/src/steps/step_watermark.rs @@ -176,6 +176,7 @@ pub fn build_watermark_page(state: &AppState) -> adw::NavigationPage { .title("Advanced Options") .subtitle("Opacity, rotation, tiling, margin") .show_enable_switch(false) + .expanded(state.detailed_mode) .build(); let opacity_row = adw::SpinRow::builder()