making sure we can show that files exist in the ui
This commit is contained in:
parent
76ebefb6fb
commit
e9c78e4ea6
1 changed files with 30 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
#[cxx_qt::bridge]
|
||||
pub mod song_editor {
|
||||
use std::path::PathBuf;
|
||||
|
||||
use tracing::{debug, debug_span, error, info, instrument};
|
||||
|
||||
unsafe extern "C++" {
|
||||
|
@ -49,6 +51,10 @@ pub mod song_editor {
|
|||
font: QString,
|
||||
#[qproperty]
|
||||
font_size: i32,
|
||||
#[qproperty]
|
||||
background_exists: bool,
|
||||
#[qproperty]
|
||||
audio_exists: bool,
|
||||
// #[qproperty]
|
||||
// song_model: *mut CxxSongs,
|
||||
}
|
||||
|
@ -69,6 +75,8 @@ pub mod song_editor {
|
|||
vertical_text_alignment: QString::default(),
|
||||
font: QString::default(),
|
||||
font_size: 50,
|
||||
background_exists: true,
|
||||
audio_exists: true,
|
||||
// song_model: std::ptr::null_mut(),
|
||||
}
|
||||
}
|
||||
|
@ -95,5 +103,27 @@ pub mod song_editor {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[qinvokable]
|
||||
pub fn check_files(mut self: Pin<&mut Self>) {
|
||||
let background = PathBuf::from(
|
||||
self.background()
|
||||
.clone()
|
||||
.to_string()
|
||||
.trim_start_matches("file://"),
|
||||
);
|
||||
let audio = PathBuf::from(
|
||||
self.audio()
|
||||
.clone()
|
||||
.to_string()
|
||||
.trim_start_matches("file://"),
|
||||
);
|
||||
debug!(
|
||||
background = background.exists(),
|
||||
audio = audio.exists()
|
||||
);
|
||||
self.as_mut().set_background_exists(background.exists());
|
||||
self.as_mut().set_audio_exists(audio.exists());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue