working loading and saving of files with dialog from rust

This means we are loading and saving files with the rfd crate which
utilizes platform appropriate dialogs for saving and loading files. We
can start to use this in all other file dialog locations to make sure
we are getting the right files.

It uses xdg-desktop-portals on linux so we will always use the
appropriate file dialog for each desktop environment.
This commit is contained in:
Chris Cochrun 2023-09-21 17:37:14 -05:00
parent 08cc744a31
commit cd8801af51
6 changed files with 58 additions and 12 deletions

View file

@ -24,6 +24,8 @@ mod settings {
sound_effect: QString,
#[qproperty]
last_save_file: QUrl,
#[qproperty]
loaded_file: QUrl,
}
impl Default for Settings {
@ -33,6 +35,7 @@ mod settings {
screen: QString::from(""),
sound_effect: QString::from(""),
last_save_file: QUrl::from(""),
loaded_file: QUrl::from(""),
}
}
}
@ -62,7 +65,10 @@ mod settings {
.get("General", "lastSaveFile");
println!("{:?}", sf);
if let Some(s) = sf {
self.set_last_save_file(QUrl::from(&s));
self.as_mut()
.set_last_save_file(QUrl::from(&s));
self.as_mut()
.set_loaded_file(QUrl::from(&s));
println!("{s}");
} else {
println!("error loading last save file");