new feature: now can play file without opening any dir

This commit is contained in:
2025-12-16 20:46:14 +03:00
parent 546b6fd13f
commit ae5da6d9bd
2 changed files with 24 additions and 9 deletions
+11
View File
@@ -23,6 +23,10 @@ use std::{
sync::{Arc, Mutex},
};
const SUPPORTED_EXTENSIONS: [&str; 11] = [
"mp3", "wav", "ogg", "flac", "mp4", "m4a", "aac", "mov", "mkv", "webm", "avi",
];
struct SoundpadGui {
pub app_state: AppState,
pub config: GuiConfig,
@@ -68,6 +72,13 @@ impl SoundpadGui {
};
}
pub fn open_file(&mut self) {
let file_dialog = FileDialog::new().add_filter("Audio File", &SUPPORTED_EXTENSIONS);
if let Some(path) = file_dialog.pick_file() {
self.play_file(&path);
}
}
pub fn add_dir(&mut self) {
let file_dialog = FileDialog::new();
if let Some(path) = file_dialog.pick_folder() {