fixing some things....
Some checks are pending
/ test (push) Waiting to run

This commit is contained in:
Chris Cochrun 2025-09-24 10:39:28 -05:00
parent 77daa03db6
commit a56ff6a022
4 changed files with 15 additions and 26 deletions

View file

@ -37,9 +37,10 @@ impl From<&Video> for Value {
impl From<PathBuf> for Video {
fn from(value: PathBuf) -> Self {
let title: String = value.file_name().map_or_else(|| "Video".into(), |filename| {
filename.to_str().unwrap_or("Video").into()
});
let title: String = value.file_name().map_or_else(
|| "Video".into(),
|filename| filename.to_str().unwrap_or("Video").into(),
);
Self {
title,
path: value,

View file

@ -1340,7 +1340,11 @@ impl cosmic::Application for App {
let column = column![
row![
library.width(Length::FillPortion(1)),
if self.library_open {
library.width(Length::FillPortion(1))
} else {
container(Space::new(0, 0))
},
main_area.width(Length::FillPortion(4))
],
preview_bar

View file

@ -76,7 +76,7 @@ pub enum Action {
#[derive(Clone, Debug)]
pub(crate) enum Message {
AddItem(LibraryKind),
AddItem,
DeleteItem((LibraryKind, i32)),
OpenItem(Option<(LibraryKind, i32)>),
HoverLibrary(Option<LibraryKind>),
@ -128,24 +128,6 @@ impl<'a> Library {
pub fn update(&'a mut self, message: Message) -> Action {
match message {
Message::AddItem(kind) => match kind {
LibraryKind::Song => todo!(),
LibraryKind::Video => {
let future = cosmic::dialog::file_chooser::open::Dialog::new().filter(cosmic::dialog::file_chooser::FileFilter::new("videos").extension("mp4").extension("mkv").extension("webm").extension(".mpeg")).open_file();
let task = Task::future(future).and_then(|r| {
if let Ok(video) = r
.url()
.to_file_path()
.and_then(|path| Ok(Video::from(path)))
{
self.video_library.add_item(video);
};
Task::none()
});
}
LibraryKind::Image => todo!(),
LibraryKind::Presentation => todo!(),
},
Message::None => (),
Message::DeleteItem((kind, index)) => {
match kind {
@ -708,7 +690,7 @@ impl<'a> Library {
let library_toolbar = rowm!(
text_input("Search...", ""),
button::icon(icon::from_name("add"))
.on_press(Message::AddItem(model.kind))
.on_press(Message::AddItem)
);
let library_column =
column![library_toolbar, items].spacing(3);

View file

@ -286,7 +286,7 @@ impl SongEditor {
.padding(cosmic::theme::spacing().space_s)
.center_x(Length::FillPortion(2))
} else {
container(vertical_space())
container(horizontal_space())
};
let slide_preview = container(self.slide_preview())
.width(Length::FillPortion(2));
@ -455,8 +455,10 @@ order",
v.set_looping(true);
v
});
debug!(?video);
// debug!(?video);
self.video = video;
} else {
self.video = None;
}
}
}