parent
1f3609d7df
commit
8f6dd9309d
2 changed files with 10 additions and 11 deletions
10
src/main.rs
10
src/main.rs
|
@ -13,12 +13,12 @@ use cosmic::iced_widget::{column, row};
|
||||||
use cosmic::widget::dnd_destination::DragId;
|
use cosmic::widget::dnd_destination::DragId;
|
||||||
use cosmic::widget::nav_bar::nav_bar_style;
|
use cosmic::widget::nav_bar::nav_bar_style;
|
||||||
use cosmic::widget::segmented_button::Entity;
|
use cosmic::widget::segmented_button::Entity;
|
||||||
use cosmic::widget::text;
|
|
||||||
use cosmic::widget::tooltip::Position as TPosition;
|
use cosmic::widget::tooltip::Position as TPosition;
|
||||||
use cosmic::widget::{
|
use cosmic::widget::{
|
||||||
button, horizontal_space, nav_bar, search_input, tooltip, Space,
|
button, horizontal_space, nav_bar, search_input, tooltip, Space,
|
||||||
};
|
};
|
||||||
use cosmic::widget::{icon, slider};
|
use cosmic::widget::{icon, slider};
|
||||||
|
use cosmic::widget::{mouse_area, text};
|
||||||
use cosmic::{executor, Application, ApplicationExt, Element};
|
use cosmic::{executor, Application, ApplicationExt, Element};
|
||||||
use cosmic::{prelude::*, theme};
|
use cosmic::{prelude::*, theme};
|
||||||
use cosmic::{widget::Container, Theme};
|
use cosmic::{widget::Container, Theme};
|
||||||
|
@ -249,11 +249,9 @@ impl cosmic::Application for App {
|
||||||
debug!("left");
|
debug!("left");
|
||||||
cosmic::Action::App(Message::DndLeave(entity))
|
cosmic::Action::App(Message::DndLeave(entity))
|
||||||
})
|
})
|
||||||
.on_dnd_drop::<ServiceItem>(|entity, data, action| {
|
.on_dnd_drop::<ServiceItem>(|_, _, _| {
|
||||||
debug!("dropped");
|
debug!("dropped");
|
||||||
cosmic::Action::App(Message::DndDrop(
|
cosmic::Action::App(Message::DndDrop)
|
||||||
entity, data, action,
|
|
||||||
))
|
|
||||||
})
|
})
|
||||||
.drag_id(DragId::new())
|
.drag_id(DragId::new())
|
||||||
.on_context(|id| {
|
.on_context(|id| {
|
||||||
|
@ -639,7 +637,7 @@ impl cosmic::Application for App {
|
||||||
// debug!(?action);
|
// debug!(?action);
|
||||||
// debug!(?service_item);
|
// debug!(?service_item);
|
||||||
|
|
||||||
if let Some(library) = self.library {
|
if let Some(library) = &self.library {
|
||||||
if let Some((lib, item)) = library.dragged_item {
|
if let Some((lib, item)) = library.dragged_item {
|
||||||
// match lib {
|
// match lib {
|
||||||
// core::model::LibraryKind::Song => ,
|
// core::model::LibraryKind::Song => ,
|
||||||
|
|
|
@ -46,7 +46,7 @@ pub(crate) struct Library {
|
||||||
|
|
||||||
pub(crate) enum Action {
|
pub(crate) enum Action {
|
||||||
OpenItem(Option<(LibraryKind, i32)>),
|
OpenItem(Option<(LibraryKind, i32)>),
|
||||||
DraggedItem(Option<(LibraryKind, i32)>),
|
DraggedItem(ServiceItem),
|
||||||
Task(Task<Message>),
|
Task(Task<Message>),
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ pub(crate) enum Message {
|
||||||
OpenLibrary(Option<LibraryKind>),
|
OpenLibrary(Option<LibraryKind>),
|
||||||
HoverItem(Option<(LibraryKind, i32)>),
|
HoverItem(Option<(LibraryKind, i32)>),
|
||||||
SelectItem(Option<(LibraryKind, i32)>),
|
SelectItem(Option<(LibraryKind, i32)>),
|
||||||
DragItem(Option<(LibraryKind, i32)>),
|
DragItem(ServiceItem),
|
||||||
UpdateSong(Song),
|
UpdateSong(Song),
|
||||||
SongChanged,
|
SongChanged,
|
||||||
UpdateImage(Image),
|
UpdateImage(Image),
|
||||||
|
@ -121,8 +121,9 @@ impl<'a> Library {
|
||||||
self.selected_item = item;
|
self.selected_item = item;
|
||||||
}
|
}
|
||||||
Message::DragItem(item) => {
|
Message::DragItem(item) => {
|
||||||
self.dragged_item = item;
|
debug!(?item);
|
||||||
// return Action::DraggedItem(item);
|
// self.dragged_item = item;
|
||||||
|
return Action::DraggedItem(item);
|
||||||
}
|
}
|
||||||
Message::UpdateSong(song) => {
|
Message::UpdateSong(song) => {
|
||||||
let Some((kind, index)) = self.editing_item else {
|
let Some((kind, index)) = self.editing_item else {
|
||||||
|
@ -372,7 +373,7 @@ impl<'a> Library {
|
||||||
.map(|_| Message::None);
|
.map(|_| Message::None);
|
||||||
DndSource::<Message, ServiceItem>::new(
|
DndSource::<Message, ServiceItem>::new(
|
||||||
mouse_area(visual_item)
|
mouse_area(visual_item)
|
||||||
.on_drag(Message::DragItem(Some((model.kind, index as i32))))
|
.on_drag(Message::DragItem(service_item.clone()))
|
||||||
.on_enter(Message::HoverItem(
|
.on_enter(Message::HoverItem(
|
||||||
Some((
|
Some((
|
||||||
model.kind,
|
model.kind,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue