now there are items and a bit of style to the library
This commit is contained in:
parent
929b0a33d1
commit
40580a6e7a
7 changed files with 131 additions and 9 deletions
6
src/core/content.rs
Normal file
6
src/core/content.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
use super::kinds::ServiceItemKind;
|
||||
|
||||
pub trait Content {
|
||||
fn title(&self) -> String;
|
||||
fn kind(&self) -> ServiceItemKind;
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
use crate::{Background, Slide, SlideBuilder, TextAlignment};
|
||||
|
||||
use super::{
|
||||
content::Content,
|
||||
kinds::ServiceItemKind,
|
||||
model::{get_db, LibraryKind, Model},
|
||||
service_items::ServiceTrait,
|
||||
};
|
||||
|
@ -20,6 +22,16 @@ pub struct Image {
|
|||
pub path: PathBuf,
|
||||
}
|
||||
|
||||
impl Content for Image {
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
}
|
||||
|
||||
fn kind(&self) -> ServiceItemKind {
|
||||
ServiceItemKind::Image(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Value> for Image {
|
||||
fn from(value: Value) -> Self {
|
||||
Self::from(&value)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
pub mod content;
|
||||
pub mod images;
|
||||
pub mod kinds;
|
||||
pub mod lisp;
|
||||
|
|
|
@ -10,6 +10,8 @@ use tracing::error;
|
|||
use crate::{Background, Slide, SlideBuilder, TextAlignment};
|
||||
|
||||
use super::{
|
||||
content::Content,
|
||||
kinds::ServiceItemKind,
|
||||
model::{get_db, LibraryKind, Model},
|
||||
service_items::ServiceTrait,
|
||||
};
|
||||
|
@ -34,6 +36,16 @@ pub struct Presentation {
|
|||
pub kind: PresKind,
|
||||
}
|
||||
|
||||
impl Content for Presentation {
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
}
|
||||
|
||||
fn kind(&self) -> ServiceItemKind {
|
||||
ServiceItemKind::Presentation(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Value> for Presentation {
|
||||
fn from(value: Value) -> Self {
|
||||
Self::from(&value)
|
||||
|
|
|
@ -12,6 +12,8 @@ use tracing::{debug, error};
|
|||
use crate::{core::slide, Slide, SlideBuilder};
|
||||
|
||||
use super::{
|
||||
content::Content,
|
||||
kinds::ServiceItemKind,
|
||||
model::{get_db, LibraryKind, Model},
|
||||
service_items::ServiceTrait,
|
||||
slide::{Background, TextAlignment},
|
||||
|
@ -34,6 +36,16 @@ pub struct Song {
|
|||
pub font_size: Option<i32>,
|
||||
}
|
||||
|
||||
impl Content for Song {
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
}
|
||||
|
||||
fn kind(&self) -> ServiceItemKind {
|
||||
ServiceItemKind::Song(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl ServiceTrait for Song {
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use crate::{Background, SlideBuilder, TextAlignment};
|
||||
|
||||
use super::{
|
||||
content::Content,
|
||||
kinds::ServiceItemKind,
|
||||
model::{get_db, LibraryKind, Model},
|
||||
service_items::ServiceTrait,
|
||||
slide::Slide,
|
||||
|
@ -25,6 +27,16 @@ pub struct Video {
|
|||
pub looping: bool,
|
||||
}
|
||||
|
||||
impl Content for Video {
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
}
|
||||
|
||||
fn kind(&self) -> ServiceItemKind {
|
||||
ServiceItemKind::Video(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Value> for Video {
|
||||
fn from(value: Value) -> Self {
|
||||
Self::from(&value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue