Drag and Drop works ok now.
The main functionality works but only in cosmic desktop. So there are some issues that need to be worked out yet in regards to libcosmic.
This commit is contained in:
parent
614630bea8
commit
a36a1d59c6
10 changed files with 466 additions and 512 deletions
|
@ -6,7 +6,7 @@ use super::{
|
|||
model::{get_db, LibraryKind, Model},
|
||||
service_items::ServiceTrait,
|
||||
};
|
||||
use crisp::types::{Keyword, Value};
|
||||
use crisp::types::{Keyword, Symbol, Value};
|
||||
use miette::{IntoDiagnostic, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{query_as, SqliteConnection};
|
||||
|
@ -22,6 +22,12 @@ pub struct Image {
|
|||
pub path: PathBuf,
|
||||
}
|
||||
|
||||
impl From<&Image> for Value {
|
||||
fn from(value: &Image) -> Self {
|
||||
Self::List(vec![Self::Symbol(Symbol("image".into()))])
|
||||
}
|
||||
}
|
||||
|
||||
impl Content for Image {
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crisp::types::{Keyword, Value};
|
||||
use crisp::types::{Keyword, Symbol, Value};
|
||||
use miette::{IntoDiagnostic, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{
|
||||
|
@ -36,6 +36,12 @@ pub struct Presentation {
|
|||
pub kind: PresKind,
|
||||
}
|
||||
|
||||
impl From<&Presentation> for Value {
|
||||
fn from(value: &Presentation) -> Self {
|
||||
Self::List(vec![Self::Symbol(Symbol("presentation".into()))])
|
||||
}
|
||||
}
|
||||
|
||||
impl Content for Presentation {
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
|
|
|
@ -47,7 +47,7 @@ impl AllowedMimeTypes for ServiceItem {
|
|||
}
|
||||
|
||||
impl AsMimeTypes for ServiceItem {
|
||||
fn available(&self) -> std::borrow::Cow<'static, [String]> {
|
||||
fn available(&self) -> Cow<'static, [String]> {
|
||||
debug!(?self);
|
||||
Cow::from(vec!["application/service-item".to_string()])
|
||||
}
|
||||
|
@ -67,11 +67,13 @@ impl AsMimeTypes for ServiceItem {
|
|||
impl From<&ServiceItem> for Value {
|
||||
fn from(value: &ServiceItem) -> Self {
|
||||
match &value.kind {
|
||||
ServiceItemKind::Song(song) => todo!(),
|
||||
ServiceItemKind::Video(video) => todo!(),
|
||||
ServiceItemKind::Image(image) => todo!(),
|
||||
ServiceItemKind::Presentation(presentation) => todo!(),
|
||||
ServiceItemKind::Content(slide) => todo!(),
|
||||
ServiceItemKind::Song(song) => Value::from(song),
|
||||
ServiceItemKind::Video(video) => Value::from(video),
|
||||
ServiceItemKind::Image(image) => Value::from(image),
|
||||
ServiceItemKind::Presentation(presentation) => {
|
||||
Value::from(presentation)
|
||||
}
|
||||
ServiceItemKind::Content(slide) => Value::from(slide),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,6 +194,12 @@ pub struct Slide {
|
|||
video_end_time: f32,
|
||||
}
|
||||
|
||||
impl From<&Slide> for Value {
|
||||
fn from(value: &Slide) -> Self {
|
||||
Self::List(vec![Self::Symbol(Symbol("slide".into()))])
|
||||
}
|
||||
}
|
||||
|
||||
impl Slide {
|
||||
pub fn background(&self) -> &Background {
|
||||
&self.background
|
||||
|
|
|
@ -36,6 +36,12 @@ pub struct Song {
|
|||
pub font_size: Option<i32>,
|
||||
}
|
||||
|
||||
impl From<&Song> for Value {
|
||||
fn from(value: &Song) -> Self {
|
||||
Self::List(vec![Self::Symbol(Symbol("song".into()))])
|
||||
}
|
||||
}
|
||||
|
||||
impl Content for Song {
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
|
|
|
@ -8,7 +8,7 @@ use super::{
|
|||
slide::Slide,
|
||||
};
|
||||
use cosmic::iced::Executor;
|
||||
use crisp::types::{Keyword, Value};
|
||||
use crisp::types::{Keyword, Symbol, Value};
|
||||
use miette::{IntoDiagnostic, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{query_as, SqliteConnection};
|
||||
|
@ -27,6 +27,12 @@ pub struct Video {
|
|||
pub looping: bool,
|
||||
}
|
||||
|
||||
impl From<&Video> for Value {
|
||||
fn from(value: &Video) -> Self {
|
||||
Self::List(vec![Self::Symbol(Symbol("video".into()))])
|
||||
}
|
||||
}
|
||||
|
||||
impl Content for Video {
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue