use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FontRange {
pub start: u32,
pub end: u32,
pub font_family: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
#[serde(rename_all = "snake_case")]
pub enum ThinStrokesMode {
Never,
#[default]
RetinaOnly,
DarkBackgroundsOnly,
RetinaDarkBackgroundsOnly,
Always,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
#[serde(rename_all = "snake_case")]
pub enum DownloadSaveLocation {
#[default]
Downloads,
LastUsed,
Cwd,
Custom(String),
}
impl DownloadSaveLocation {
pub fn variants() -> &'static [DownloadSaveLocation] {
&[
DownloadSaveLocation::Downloads,
DownloadSaveLocation::LastUsed,
DownloadSaveLocation::Cwd,
]
}
pub fn display_name(&self) -> &str {
match self {
DownloadSaveLocation::Downloads => "Downloads folder",
DownloadSaveLocation::LastUsed => "Last used directory",
DownloadSaveLocation::Cwd => "Current working directory",
DownloadSaveLocation::Custom(_) => "Custom directory",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
#[serde(rename_all = "snake_case")]
pub enum DroppedFileQuoteStyle {
#[default]
SingleQuotes,
DoubleQuotes,
Backslash,
None,
}
impl DroppedFileQuoteStyle {
pub fn display_name(&self) -> &'static str {
match self {
DroppedFileQuoteStyle::SingleQuotes => "Single quotes ('...')",
DroppedFileQuoteStyle::DoubleQuotes => "Double quotes (\"...\")",
DroppedFileQuoteStyle::Backslash => "Backslash escaping (\\)",
DroppedFileQuoteStyle::None => "None (raw path)",
}
}
pub fn all() -> &'static [DroppedFileQuoteStyle] {
&[
DroppedFileQuoteStyle::SingleQuotes,
DroppedFileQuoteStyle::DoubleQuotes,
DroppedFileQuoteStyle::Backslash,
DroppedFileQuoteStyle::None,
]
}
}