Add AppConfig with overwrite behavior, skill level, thread count settings
All 3 config tests passing.
This commit is contained in:
@@ -1 +1,70 @@
|
||||
// Application configuration
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AppConfig {
|
||||
pub output_subfolder: String,
|
||||
pub output_fixed_path: Option<String>,
|
||||
pub overwrite_behavior: OverwriteBehavior,
|
||||
pub remember_settings: bool,
|
||||
pub skill_level: SkillLevel,
|
||||
pub thread_count: ThreadCount,
|
||||
pub error_behavior: ErrorBehavior,
|
||||
pub notify_on_completion: bool,
|
||||
pub play_completion_sound: bool,
|
||||
pub auto_open_output: bool,
|
||||
pub high_contrast: bool,
|
||||
pub large_text: bool,
|
||||
pub reduced_motion: bool,
|
||||
}
|
||||
|
||||
impl Default for AppConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
output_subfolder: "processed".into(),
|
||||
output_fixed_path: None,
|
||||
overwrite_behavior: OverwriteBehavior::Ask,
|
||||
remember_settings: true,
|
||||
skill_level: SkillLevel::Simple,
|
||||
thread_count: ThreadCount::Auto,
|
||||
error_behavior: ErrorBehavior::SkipAndContinue,
|
||||
notify_on_completion: true,
|
||||
play_completion_sound: false,
|
||||
auto_open_output: false,
|
||||
high_contrast: false,
|
||||
large_text: false,
|
||||
reduced_motion: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum OverwriteBehavior {
|
||||
Ask,
|
||||
AutoRename,
|
||||
Overwrite,
|
||||
Skip,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum SkillLevel {
|
||||
Simple,
|
||||
Detailed,
|
||||
}
|
||||
|
||||
impl SkillLevel {
|
||||
pub fn is_advanced(&self) -> bool {
|
||||
matches!(self, Self::Detailed)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum ThreadCount {
|
||||
Auto,
|
||||
Manual(usize),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum ErrorBehavior {
|
||||
SkipAndContinue,
|
||||
PauseOnError,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user