implement App::new

This commit is contained in:
🪞👃🪞 2024-07-09 15:57:25 +03:00
parent 07084656b8
commit afa2a2fd2b
2 changed files with 19 additions and 16 deletions

View file

@ -72,6 +72,24 @@ pub struct App {
/// Quantization factor
pub quant: usize,
}
impl App {
pub fn new () -> Usually<Self> {
let xdg = Arc::new(microxdg::XdgApp::new("tek")?);
let first_run = crate::config::AppPaths::new(&xdg)?.should_create();
Ok(Self {
modal: first_run.then(||crate::config::SetupModal(Some(xdg.clone())).boxed()),
xdg: Some(xdg),
track_cursor: 1,
scene_cursor: 1,
note_start: 2,
time_zoom: 12,
quant: 24,
..Self::default()
})
}
}
process!(App |self, _client, scope| {
let (
reset, current_frames, current_usecs, next_usecs, period_usecs