feat: you can now collapse every audio track

This commit is contained in:
2026-01-28 00:03:56 +03:00
parent cdf306cfe9
commit 6df826f210
+8 -9
View File
@@ -1,7 +1,7 @@
use crate::gui::{SUPPORTED_EXTENSIONS, SoundpadGui};
use egui::{
Align, AtomExt, Button, Color32, ComboBox, CursorIcon, FontFamily, Label, Layout, RichText,
ScrollArea, Sense, Slider, TextEdit, Ui, Vec2,
Align, AtomExt, Button, CollapsingHeader, Color32, ComboBox, CursorIcon, FontFamily, Label,
Layout, RichText, ScrollArea, Sense, Slider, TextEdit, Ui, Vec2,
};
use egui_material_icons::icons;
use pwsp::types::audio_player::TrackInfo;
@@ -95,11 +95,6 @@ impl SoundpadGui {
fn draw_header(&mut self, ui: &mut Ui) {
ui.vertical_centered_justified(|ui| {
self.draw_controls(ui);
});
}
fn draw_controls(&mut self, ui: &mut Ui) {
if self.audio_player_state.tracks.is_empty() {
ui.label("No tracks playing");
return;
@@ -109,7 +104,7 @@ impl SoundpadGui {
let mut action = None;
for track in tracks {
ui.label(
CollapsingHeader::new(
RichText::new(
track
.path
@@ -120,10 +115,13 @@ impl SoundpadGui {
)
.color(Color32::WHITE)
.family(FontFamily::Monospace),
);
)
.default_open(true)
.show(ui, |ui| {
if let Some(act) = Self::draw_track_control(ui, &mut self.app_state, &track) {
action = Some(act);
}
});
ui.separator();
}
@@ -135,6 +133,7 @@ impl SoundpadGui {
TrackAction::Stop(id) => self.stop(Some(id)),
}
}
});
}
fn draw_track_control(