mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-28 06:21:23 +00:00
new feature: now can play file without opening any dir
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user