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
This commit is contained in:
2026-03-06 15:28:02 +02:00
parent d6f7fc9c88
commit 5bdeb8a2e3
5 changed files with 10 additions and 5 deletions

View File

@@ -94,6 +94,7 @@ pub struct AppState {
pub excluded_files: Rc<RefCell<std::collections::HashSet<std::path::PathBuf>>>,
pub output_dir: Rc<RefCell<Option<std::path::PathBuf>>>,
pub job_config: Rc<RefCell<JobConfig>>,
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();

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()