mirror of
https://github.com/Dangoware/dmp-core.git
synced 2025-04-19 13:32:53 -05:00
messing with Config 2: Electric Boogaloo
This commit is contained in:
parent
4e33d20d18
commit
4e5a45e544
2 changed files with 21 additions and 72 deletions
|
@ -1,8 +1,15 @@
|
|||
use std::{path::PathBuf, marker::PhantomData};
|
||||
|
||||
use crate::music_storage::library::MusicLibrary;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct ConfigLibrary {
|
||||
name: String,
|
||||
path: PathBuf,
|
||||
}
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Config {
|
||||
db_path: Option<PathBuf>,
|
||||
libraries: Vec<ConfigLibrary>
|
||||
}
|
||||
|
||||
impl Config {
|
||||
|
|
|
@ -2,78 +2,20 @@ use std::{marker::PhantomData, fs::File, path::PathBuf};
|
|||
|
||||
use font::Font;
|
||||
|
||||
pub trait Setting {}
|
||||
pub enum Setting {
|
||||
String {
|
||||
name: String,
|
||||
value: String
|
||||
},
|
||||
Int {
|
||||
name: String,
|
||||
value: i32
|
||||
},
|
||||
Bool {
|
||||
name: String,
|
||||
value: bool
|
||||
},
|
||||
|
||||
pub struct DropDown {
|
||||
name: String,
|
||||
//value: ???
|
||||
}
|
||||
impl Setting for DropDown {}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Slider {
|
||||
name: String,
|
||||
value: i32,
|
||||
}
|
||||
impl Setting for Slider {}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct CheckBox {
|
||||
name: String,
|
||||
value: bool,
|
||||
}
|
||||
impl Setting for CheckBox {}
|
||||
|
||||
enum TextBoxSize {
|
||||
Small,
|
||||
Large,
|
||||
}
|
||||
#[derive(Debug, Default)]
|
||||
pub struct TextBox<Size = TextBoxSize> {
|
||||
name: String,
|
||||
text: String,
|
||||
size: PhantomData<Size>
|
||||
}
|
||||
impl Setting for TextBox {}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct SingleSelect {
|
||||
name: String,
|
||||
value: bool,
|
||||
}
|
||||
impl Setting for SingleSelect {}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct MultiSelect {
|
||||
name: String,
|
||||
value: bool,
|
||||
}
|
||||
impl Setting for MultiSelect {}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct ConfigCounter {
|
||||
name: String,
|
||||
value: i32,
|
||||
}
|
||||
impl Setting for ConfigCounter {}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct ConfigFont {
|
||||
name: String,
|
||||
value: Font,
|
||||
}
|
||||
impl Setting for ConfigFont {}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct ConfigFile {
|
||||
name: String,
|
||||
value: PathBuf,
|
||||
}
|
||||
impl Setting for ConfigFile {}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct List<T: Setting> {
|
||||
items: Vec<T>
|
||||
}
|
||||
|
||||
pub struct Form {
|
||||
|
|
Loading…
Reference in a new issue