2026-01-07 20:42:28 +01:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2026-01-07 20:22:49 +01:00
|
|
|
// src/config.rs
|
2026-01-14 18:53:36 +01:00
|
|
|
//
|
|
|
|
|
// Global configuration for the application with cosmic-config support.
|
2026-01-07 20:22:49 +01:00
|
|
|
|
|
|
|
|
use cosmic::cosmic_config::{self, CosmicConfigEntry, cosmic_config_derive::CosmicConfigEntry};
|
|
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
|
|
/// Global configuration for the application.
|
2026-01-18 20:35:12 +01:00
|
|
|
#[derive(Debug, Clone, CosmicConfigEntry, PartialEq)]
|
2026-01-07 20:22:49 +01:00
|
|
|
#[version = 1]
|
|
|
|
|
pub struct AppConfig {
|
2026-01-19 19:42:54 +01:00
|
|
|
/// Default directory to open when browsing for documents.
|
2026-01-07 20:22:49 +01:00
|
|
|
pub default_image_dir: Option<PathBuf>,
|
2026-01-19 19:42:54 +01:00
|
|
|
/// Show page navigation panel (left sidebar for multi-page documents).
|
2026-01-14 18:53:36 +01:00
|
|
|
pub nav_bar_visible: bool,
|
2026-01-19 19:42:54 +01:00
|
|
|
/// Show properties panel (right sidebar with metadata).
|
2026-01-14 18:53:36 +01:00
|
|
|
pub context_drawer_visible: bool,
|
2026-01-19 19:42:54 +01:00
|
|
|
/// Zoom step multiplier for keyboard shortcuts (1.1 = 10% increase per step).
|
2026-01-18 20:35:12 +01:00
|
|
|
pub scale_step: f32,
|
2026-01-19 19:42:54 +01:00
|
|
|
/// Pan distance in pixels per arrow key press.
|
2026-01-18 20:35:12 +01:00
|
|
|
pub pan_step: f32,
|
2026-01-19 19:42:54 +01:00
|
|
|
/// Minimum zoom level (0.1 = 10% of original size).
|
2026-01-18 20:35:12 +01:00
|
|
|
pub min_scale: f32,
|
2026-01-19 19:42:54 +01:00
|
|
|
/// Maximum zoom level (8.0 = 800% of original size).
|
2026-01-18 20:35:12 +01:00
|
|
|
pub max_scale: f32,
|
2026-01-07 20:22:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Default for AppConfig {
|
|
|
|
|
fn default() -> Self {
|
|
|
|
|
Self {
|
2026-01-14 20:54:42 +01:00
|
|
|
default_image_dir: dirs::picture_dir().or_else(dirs::home_dir),
|
2026-01-14 18:53:36 +01:00
|
|
|
nav_bar_visible: false,
|
|
|
|
|
context_drawer_visible: false,
|
2026-01-18 20:35:12 +01:00
|
|
|
scale_step: 1.1,
|
|
|
|
|
pan_step: 50.0,
|
|
|
|
|
min_scale: 0.1,
|
|
|
|
|
max_scale: 8.0,
|
2026-01-07 20:22:49 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|