diff --git a/Cargo.toml b/Cargo.toml index cb98dfc..09dec14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,11 +25,9 @@ dirs = "5.0.1" tokio = "1.41.1" crisp = { git = "https://git.tfcconnection.org/chris/crisp", version = "0.1.3" } rodio = { version = "0.20.1", features = ["symphonia-all", "tracing"] } -gstreamer = "0.23" -gstreamer-app = "0.23" -# gstreamer-video = "0.23" -# gstreamer-allocators = "0.23" -# cosmic-time = { git = "https://githubg.com/pop-os/cosmic-time" } +gstreamer = "0.23.3" +gstreamer-app = "0.23.3" +# cosmic-time = "0.2.0" url = "2" colors-transform = "0.2.11" # femtovg = { version = "0.16.0", features = ["wgpu"] } diff --git a/src/main.rs b/src/main.rs index a247f4a..228d234 100644 --- a/src/main.rs +++ b/src/main.rs @@ -118,7 +118,7 @@ enum Message { SongEditor(song_editor::Message), File(PathBuf), DndEnter(Entity, Vec), - DndDrop, + DndDrop(Entity, Option, DndAction), OpenWindow, CloseWindow(Option), WindowOpened(window::Id, Option), @@ -634,26 +634,16 @@ impl cosmic::Application for App { debug!(?data); Task::none() } - Message::DndDrop => { - // debug!(?entity); - // debug!(?action); - // debug!(?service_item); + Message::DndDrop(entity, service_item, action) => { + debug!(?entity); + debug!(?action); + debug!(?service_item); - if let Some(library) = self.library { - if let Some((lib, item)) = library.dragged_item { - // match lib { - // core::model::LibraryKind::Song => , - // core::model::LibraryKind::Video => todo!(), - // core::model::LibraryKind::Image => todo!(), - // core::model::LibraryKind::Presentation => todo!(), - // } - let item = library.get_song(item).unwrap(); - let item = ServiceItem::from(item); - self.nav_model - .insert() - .text(item.title.clone()) - .data(item); - } + if let Some(item) = service_item { + self.nav_model + .insert() + .text(item.title.clone()) + .data(item); } Task::none() } diff --git a/src/ui/library.rs b/src/ui/library.rs index 3e8550d..1c09e13 100644 --- a/src/ui/library.rs +++ b/src/ui/library.rs @@ -39,14 +39,13 @@ pub(crate) struct Library { library_hovered: Option, selected_item: Option<(LibraryKind, i32)>, hovered_item: Option<(LibraryKind, i32)>, - pub dragged_item: Option<(LibraryKind, i32)>, + dragged_item: Option<(LibraryKind, i32)>, editing_item: Option<(LibraryKind, i32)>, db: SqlitePool, } pub(crate) enum Action { OpenItem(Option<(LibraryKind, i32)>), - DraggedItem(Option<(LibraryKind, i32)>), Task(Task), None, } @@ -60,7 +59,6 @@ pub(crate) enum Message { OpenLibrary(Option), HoverItem(Option<(LibraryKind, i32)>), SelectItem(Option<(LibraryKind, i32)>), - DragItem(Option<(LibraryKind, i32)>), UpdateSong(Song), SongChanged, UpdateImage(Image), @@ -120,10 +118,6 @@ impl<'a> Library { Message::SelectItem(item) => { self.selected_item = item; } - Message::DragItem(item) => { - self.dragged_item = item; - // return Action::DraggedItem(item); - } Message::UpdateSong(song) => { let Some((kind, index)) = self.editing_item else { error!("Not editing an item"); @@ -372,7 +366,6 @@ impl<'a> Library { .map(|_| Message::None); DndSource::::new( mouse_area(visual_item) - .on_drag(Message::DragItem(Some((model.kind, index as i32)))) .on_enter(Message::HoverItem( Some(( model.kind,