switching to a better layout for items and slides
Some checks are pending
/ test (push) Waiting to run
Some checks are pending
/ test (push) Waiting to run
This commit is contained in:
parent
f8e8ba3985
commit
fade333634
4 changed files with 221 additions and 135 deletions
|
@ -22,6 +22,7 @@ pub struct ServiceItem {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub database_id: i32,
|
pub database_id: i32,
|
||||||
pub kind: ServiceItemKind,
|
pub kind: ServiceItemKind,
|
||||||
|
pub slides: Vec<Slide>,
|
||||||
// pub item: Box<dyn ServiceTrait>,
|
// pub item: Box<dyn ServiceTrait>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +121,7 @@ impl Default for ServiceItem {
|
||||||
title: String::default(),
|
title: String::default(),
|
||||||
database_id: 0,
|
database_id: 0,
|
||||||
kind: ServiceItemKind::Content(Slide::default()),
|
kind: ServiceItemKind::Content(Slide::default()),
|
||||||
|
slides: vec![],
|
||||||
// item: Box::new(Image::default()),
|
// item: Box::new(Image::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +168,10 @@ impl From<&Value> for ServiceItem {
|
||||||
id: 0,
|
id: 0,
|
||||||
title,
|
title,
|
||||||
database_id: 0,
|
database_id: 0,
|
||||||
kind: ServiceItemKind::Content(slide),
|
kind: ServiceItemKind::Content(
|
||||||
|
slide.clone(),
|
||||||
|
),
|
||||||
|
slides: vec![slide],
|
||||||
}
|
}
|
||||||
} else if let Some(background) =
|
} else if let Some(background) =
|
||||||
list.get(background_pos)
|
list.get(background_pos)
|
||||||
|
@ -224,11 +229,11 @@ impl From<&Value> for ServiceItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct ServiceItemModel {
|
pub struct Service {
|
||||||
items: Vec<ServiceItem>,
|
items: Vec<ServiceItem>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Deref for ServiceItemModel {
|
impl Deref for Service {
|
||||||
type Target = Vec<ServiceItem>;
|
type Target = Vec<ServiceItem>;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
|
@ -244,7 +249,7 @@ impl Deref for ServiceItemModel {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
impl From<Vec<ServiceItem>> for ServiceItemModel {
|
impl From<Vec<ServiceItem>> for Service {
|
||||||
fn from(items: Vec<ServiceItem>) -> Self {
|
fn from(items: Vec<ServiceItem>) -> Self {
|
||||||
Self { items }
|
Self { items }
|
||||||
}
|
}
|
||||||
|
@ -252,6 +257,15 @@ impl From<Vec<ServiceItem>> for ServiceItemModel {
|
||||||
|
|
||||||
impl From<&Song> for ServiceItem {
|
impl From<&Song> for ServiceItem {
|
||||||
fn from(song: &Song) -> Self {
|
fn from(song: &Song) -> Self {
|
||||||
|
if let Ok(slides) = song.to_slides() {
|
||||||
|
Self {
|
||||||
|
kind: ServiceItemKind::Song(song.clone()),
|
||||||
|
database_id: song.id,
|
||||||
|
title: song.title.clone(),
|
||||||
|
slides,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Self {
|
Self {
|
||||||
kind: ServiceItemKind::Song(song.clone()),
|
kind: ServiceItemKind::Song(song.clone()),
|
||||||
database_id: song.id,
|
database_id: song.id,
|
||||||
|
@ -260,9 +274,19 @@ impl From<&Song> for ServiceItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<&Video> for ServiceItem {
|
impl From<&Video> for ServiceItem {
|
||||||
fn from(video: &Video) -> Self {
|
fn from(video: &Video) -> Self {
|
||||||
|
if let Ok(slides) = video.to_slides() {
|
||||||
|
Self {
|
||||||
|
kind: ServiceItemKind::Video(video.clone()),
|
||||||
|
database_id: video.id,
|
||||||
|
title: video.title.clone(),
|
||||||
|
slides,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Self {
|
Self {
|
||||||
kind: ServiceItemKind::Video(video.clone()),
|
kind: ServiceItemKind::Video(video.clone()),
|
||||||
database_id: video.id,
|
database_id: video.id,
|
||||||
|
@ -271,9 +295,19 @@ impl From<&Video> for ServiceItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<&Image> for ServiceItem {
|
impl From<&Image> for ServiceItem {
|
||||||
fn from(image: &Image) -> Self {
|
fn from(image: &Image) -> Self {
|
||||||
|
if let Ok(slides) = image.to_slides() {
|
||||||
|
Self {
|
||||||
|
kind: ServiceItemKind::Image(image.clone()),
|
||||||
|
database_id: image.id,
|
||||||
|
title: image.title.clone(),
|
||||||
|
slides,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Self {
|
Self {
|
||||||
kind: ServiceItemKind::Image(image.clone()),
|
kind: ServiceItemKind::Image(image.clone()),
|
||||||
database_id: image.id,
|
database_id: image.id,
|
||||||
|
@ -282,19 +316,34 @@ impl From<&Image> for ServiceItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<&Presentation> for ServiceItem {
|
impl From<&Presentation> for ServiceItem {
|
||||||
fn from(presentation: &Presentation) -> Self {
|
fn from(presentation: &Presentation) -> Self {
|
||||||
|
if let Ok(slides) = presentation.to_slides() {
|
||||||
Self {
|
Self {
|
||||||
kind: ServiceItemKind::Presentation(presentation.clone()),
|
kind: ServiceItemKind::Presentation(
|
||||||
|
presentation.clone(),
|
||||||
|
),
|
||||||
|
database_id: presentation.id,
|
||||||
|
title: presentation.title.clone(),
|
||||||
|
slides,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Self {
|
||||||
|
kind: ServiceItemKind::Presentation(
|
||||||
|
presentation.clone(),
|
||||||
|
),
|
||||||
database_id: presentation.id,
|
database_id: presentation.id,
|
||||||
title: presentation.title.clone(),
|
title: presentation.title.clone(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ServiceItemModel {
|
impl Service {
|
||||||
fn add_item(
|
fn add_item(
|
||||||
&mut self,
|
&mut self,
|
||||||
item: impl Into<ServiceItem>,
|
item: impl Into<ServiceItem>,
|
||||||
|
@ -379,7 +428,7 @@ mod test {
|
||||||
let service_item = ServiceItem::from(&song);
|
let service_item = ServiceItem::from(&song);
|
||||||
let pres = test_presentation();
|
let pres = test_presentation();
|
||||||
let pres_item = ServiceItem::from(&pres);
|
let pres_item = ServiceItem::from(&pres);
|
||||||
let mut service_model = ServiceItemModel::default();
|
let mut service_model = Service::default();
|
||||||
match service_model.add_item(&song) {
|
match service_model.add_item(&song) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
99
src/main.rs
99
src/main.rs
|
@ -1,5 +1,5 @@
|
||||||
use clap::{command, Parser};
|
use clap::{command, Parser};
|
||||||
use core::service_items::{ServiceItem, ServiceItemModel};
|
use core::service_items::{Service, ServiceItem};
|
||||||
use core::slide::*;
|
use core::slide::*;
|
||||||
use core::songs::Song;
|
use core::songs::Song;
|
||||||
use cosmic::app::context_drawer::ContextDrawer;
|
use cosmic::app::context_drawer::ContextDrawer;
|
||||||
|
@ -102,9 +102,7 @@ struct App {
|
||||||
file: PathBuf,
|
file: PathBuf,
|
||||||
presenter: Presenter,
|
presenter: Presenter,
|
||||||
windows: Vec<window::Id>,
|
windows: Vec<window::Id>,
|
||||||
service: BTreeMap<ServiceItem, Vec<Slide>>,
|
service: Vec<ServiceItem>,
|
||||||
slides: Vec<Slide>,
|
|
||||||
current_slide: Slide,
|
|
||||||
presentation_open: bool,
|
presentation_open: bool,
|
||||||
cli_mode: bool,
|
cli_mode: bool,
|
||||||
library: Option<Library>,
|
library: Option<Library>,
|
||||||
|
@ -136,7 +134,8 @@ enum Message {
|
||||||
EditorToggle(bool),
|
EditorToggle(bool),
|
||||||
SearchFocus,
|
SearchFocus,
|
||||||
ChangeServiceItem(usize),
|
ChangeServiceItem(usize),
|
||||||
AddServiceItem(Option<ServiceItem>),
|
AddServiceItem(usize, ServiceItem),
|
||||||
|
AppendServiceItem(ServiceItem),
|
||||||
}
|
}
|
||||||
|
|
||||||
const HEADER_SPACE: u16 = 6;
|
const HEADER_SPACE: u16 = 6;
|
||||||
|
@ -191,27 +190,22 @@ impl cosmic::Application for App {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let items = ServiceItemModel::from(items);
|
|
||||||
let presenter = Presenter::with_items(items.clone());
|
let presenter = Presenter::with_items(items.clone());
|
||||||
let slides = items.to_slides().unwrap_or_default();
|
|
||||||
let current_slide = slides[0].clone();
|
|
||||||
let song_editor = SongEditor::new();
|
let song_editor = SongEditor::new();
|
||||||
|
|
||||||
for item in items.iter() {
|
// for item in items.iter() {
|
||||||
nav_model.insert().text(item.title()).data(item.clone());
|
// nav_model.insert().text(item.title()).data(item.clone());
|
||||||
}
|
// }
|
||||||
|
|
||||||
nav_model.activate_position(0);
|
// nav_model.activate_position(0);
|
||||||
|
|
||||||
let mut app = App {
|
let mut app = App {
|
||||||
presenter,
|
presenter,
|
||||||
core,
|
core,
|
||||||
nav_model,
|
nav_model,
|
||||||
service: BTreeMap::new(),
|
service: items,
|
||||||
file: PathBuf::default(),
|
file: PathBuf::default(),
|
||||||
windows,
|
windows,
|
||||||
slides,
|
|
||||||
current_slide,
|
|
||||||
presentation_open: false,
|
presentation_open: false,
|
||||||
cli_mode: !input.ui,
|
cli_mode: !input.ui,
|
||||||
library: None,
|
library: None,
|
||||||
|
@ -233,6 +227,7 @@ impl cosmic::Application for App {
|
||||||
};
|
};
|
||||||
|
|
||||||
batch.push(app.add_library());
|
batch.push(app.add_library());
|
||||||
|
// batch.push(app.add_service(items));
|
||||||
let batch = Task::batch(batch);
|
let batch = Task::batch(batch);
|
||||||
(app, batch)
|
(app, batch)
|
||||||
}
|
}
|
||||||
|
@ -282,7 +277,7 @@ impl cosmic::Application for App {
|
||||||
.service
|
.service
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(index, (item, slides))| {
|
.map(|(index, item)| {
|
||||||
dnd_destination(tooltip( button::standard(item.title.clone())
|
dnd_destination(tooltip( button::standard(item.title.clone())
|
||||||
.leading_icon({
|
.leading_icon({
|
||||||
match item.kind {
|
match item.kind {
|
||||||
|
@ -298,12 +293,21 @@ impl cosmic::Application for App {
|
||||||
core::kinds::ServiceItemKind::Presentation(_) => {
|
core::kinds::ServiceItemKind::Presentation(_) => {
|
||||||
icon::from_name("x-office-presentation-symbolic")
|
icon::from_name("x-office-presentation-symbolic")
|
||||||
},
|
},
|
||||||
core::kinds::ServiceItemKind::Content(_) => todo!(),
|
core::kinds::ServiceItemKind::Content(_) => {
|
||||||
|
icon::from_name("x-office-presentation-symbolic")
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.class(cosmic::theme::style::Button::HeaderBar)
|
.class(cosmic::theme::style::Button::HeaderBar)
|
||||||
.on_press(cosmic::Action::App(Message::ChangeServiceItem(index))), text::body(item.kind.to_string()), TPosition::Right), vec!["application/service-item".into()]).data_received_for::<ServiceItem>(|item| {
|
.padding(5)
|
||||||
cosmic::Action::App(Message::AddServiceItem(item))
|
.width(Length::Fill)
|
||||||
|
.on_press(cosmic::Action::App(Message::ChangeServiceItem(index))),
|
||||||
|
text::body(item.kind.to_string()), TPosition::Right), vec!["application/service-item".into()]).data_received_for::<ServiceItem>( move |item| {
|
||||||
|
if let Some(item) = item {
|
||||||
|
cosmic::Action::App(Message::AddServiceItem(index, item))
|
||||||
|
} else {
|
||||||
|
cosmic::Action::None
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.into()
|
.into()
|
||||||
});
|
});
|
||||||
|
@ -311,18 +315,23 @@ impl cosmic::Application for App {
|
||||||
let column = column![
|
let column = column![
|
||||||
text::heading("Service List").center().width(280),
|
text::heading("Service List").center().width(280),
|
||||||
column(list).spacing(10),
|
column(list).spacing(10),
|
||||||
text::heading("Service List").center().width(280),
|
|
||||||
dnd_destination_for_data::<
|
dnd_destination_for_data::<
|
||||||
ServiceItem,
|
ServiceItem,
|
||||||
cosmic::Action<Message>,
|
cosmic::Action<Message>,
|
||||||
>(
|
>(
|
||||||
Container::new(vertical_space()),
|
Container::new(vertical_space()),
|
||||||
|item, _| {
|
|item, _| {
|
||||||
debug!("helloooooo");
|
if let Some(item) = item {
|
||||||
cosmic::Action::App(Message::AddServiceItem(item))
|
cosmic::Action::App(
|
||||||
|
Message::AppendServiceItem(item),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
cosmic::Action::None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
.padding(10)
|
||||||
.spacing(10);
|
.spacing(10);
|
||||||
let padding = Padding::new(0.0).top(20);
|
let padding = Padding::new(0.0).top(20);
|
||||||
let mut container = Container::new(column)
|
let mut container = Container::new(column)
|
||||||
|
@ -741,22 +750,23 @@ impl cosmic::Application for App {
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
Message::ChangeServiceItem(index) => {
|
Message::ChangeServiceItem(index) => {
|
||||||
|
if let Some(item) = self.service.get(index) {
|
||||||
|
if let Some(slide) = item.slides.first() {
|
||||||
self.presenter.update(
|
self.presenter.update(
|
||||||
presenter::Message::SlideChange(index as u16),
|
presenter::Message::SlideChange(
|
||||||
|
slide.clone(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
Message::AddServiceItem(item) => {
|
Message::AddServiceItem(index, item) => {
|
||||||
if let Some(item) = item {
|
self.service.insert(index, item);
|
||||||
let slides = match item.to_slides() {
|
Task::none()
|
||||||
Ok(s) => s,
|
|
||||||
Err(e) => {
|
|
||||||
error!("{e}");
|
|
||||||
return Task::none();
|
|
||||||
}
|
}
|
||||||
};
|
Message::AppendServiceItem(item) => {
|
||||||
self.service.insert(item, slides);
|
self.service.push(item);
|
||||||
};
|
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -939,6 +949,29 @@ where
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fn add_service(
|
||||||
|
// &mut self,
|
||||||
|
// items: Vec<ServiceItem>,
|
||||||
|
// ) -> Task<Message> {
|
||||||
|
// Task::perform(
|
||||||
|
// async move {
|
||||||
|
// for item in items {
|
||||||
|
// debug!(?item, "Item to be appended");
|
||||||
|
// let slides = item.to_slides().unwrap_or(vec![]);
|
||||||
|
// map.insert(item, slides);
|
||||||
|
// }
|
||||||
|
// let len = map.len();
|
||||||
|
// debug!(len, "to be append: ");
|
||||||
|
// map
|
||||||
|
// },
|
||||||
|
// |x| {
|
||||||
|
// let len = x.len();
|
||||||
|
// debug!(len, "to append: ");
|
||||||
|
// cosmic::Action::App(Message::AppendService(x))
|
||||||
|
// },
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
|
||||||
fn process_key_press(
|
fn process_key_press(
|
||||||
&mut self,
|
&mut self,
|
||||||
key: Key,
|
key: Key,
|
||||||
|
|
|
@ -31,7 +31,10 @@ use tracing::{debug, error, info, warn};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
core::{service_items::ServiceItemModel, slide::Slide},
|
core::{
|
||||||
|
service_items::{Service, ServiceItem},
|
||||||
|
slide::Slide,
|
||||||
|
},
|
||||||
ui::text_svg::{self, Font as SvgFont},
|
ui::text_svg::{self, Font as SvgFont},
|
||||||
// ui::widgets::slide_text,
|
// ui::widgets::slide_text,
|
||||||
BackgroundKind,
|
BackgroundKind,
|
||||||
|
@ -43,8 +46,9 @@ const REFERENCE_HEIGHT: f32 = 1080.0;
|
||||||
// #[derive(Default, Clone, Debug)]
|
// #[derive(Default, Clone, Debug)]
|
||||||
pub(crate) struct Presenter {
|
pub(crate) struct Presenter {
|
||||||
pub slides: Vec<Slide>,
|
pub slides: Vec<Slide>,
|
||||||
pub items: ServiceItemModel,
|
pub service: Vec<ServiceItem>,
|
||||||
pub current_slide: Slide,
|
pub current_slide: Slide,
|
||||||
|
pub current_item: usize,
|
||||||
pub current_slide_index: u16,
|
pub current_slide_index: u16,
|
||||||
pub video: Option<Video>,
|
pub video: Option<Video>,
|
||||||
pub video_position: f32,
|
pub video_position: f32,
|
||||||
|
@ -64,7 +68,7 @@ pub(crate) enum Action {
|
||||||
pub(crate) enum Message {
|
pub(crate) enum Message {
|
||||||
NextSlide,
|
NextSlide,
|
||||||
PrevSlide,
|
PrevSlide,
|
||||||
SlideChange(u16),
|
SlideChange(Slide),
|
||||||
EndVideo,
|
EndVideo,
|
||||||
StartVideo,
|
StartVideo,
|
||||||
StartAudio,
|
StartAudio,
|
||||||
|
@ -117,8 +121,13 @@ impl Presenter {
|
||||||
result.into_diagnostic()
|
result.into_diagnostic()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_items(items: ServiceItemModel) -> Self {
|
pub fn with_items(items: Vec<ServiceItem>) -> Self {
|
||||||
let slides = items.to_slides().unwrap_or_default();
|
let mut slides = vec![];
|
||||||
|
for item in &items {
|
||||||
|
for slide in item.to_slides().unwrap_or_default() {
|
||||||
|
slides.push(slide);
|
||||||
|
}
|
||||||
|
}
|
||||||
let video = {
|
let video = {
|
||||||
if let Some(slide) = slides.first() {
|
if let Some(slide) = slides.first() {
|
||||||
let path = slide.background().path.clone();
|
let path = slide.background().path.clone();
|
||||||
|
@ -144,8 +153,9 @@ impl Presenter {
|
||||||
};
|
};
|
||||||
Self {
|
Self {
|
||||||
slides: slides.clone(),
|
slides: slides.clone(),
|
||||||
items,
|
service: items,
|
||||||
current_slide: slides[0].clone(),
|
current_slide: slides[0].clone(),
|
||||||
|
current_item: 0,
|
||||||
current_slide_index: 0,
|
current_slide_index: 0,
|
||||||
video,
|
video,
|
||||||
audio: slides[0].audio(),
|
audio: slides[0].audio(),
|
||||||
|
@ -174,9 +184,9 @@ impl Presenter {
|
||||||
debug!("no more slides");
|
debug!("no more slides");
|
||||||
return Action::None;
|
return Action::None;
|
||||||
}
|
}
|
||||||
return self.update(Message::SlideChange(
|
// return self.update(Message::SlideChange(
|
||||||
self.current_slide_index + 1,
|
// self.current_slide_index + 1,
|
||||||
));
|
// ));
|
||||||
}
|
}
|
||||||
Message::PrevSlide => {
|
Message::PrevSlide => {
|
||||||
debug!("prev slide");
|
debug!("prev slide");
|
||||||
|
@ -184,20 +194,18 @@ impl Presenter {
|
||||||
debug!("beginning slides");
|
debug!("beginning slides");
|
||||||
return Action::None;
|
return Action::None;
|
||||||
}
|
}
|
||||||
return self.update(Message::SlideChange(
|
// return self.update(Message::SlideChange(
|
||||||
self.current_slide_index - 1,
|
// self.current_slide_index - 1,
|
||||||
));
|
// ));
|
||||||
}
|
}
|
||||||
Message::SlideChange(id) => {
|
Message::SlideChange(slide) => {
|
||||||
debug!(id, "slide changed");
|
debug!(?slide, "slide changed");
|
||||||
let old_background =
|
let old_background =
|
||||||
self.current_slide.background().clone();
|
self.current_slide.background().clone();
|
||||||
self.current_slide_index = id;
|
// self.current_slide_index = slide;
|
||||||
if let Some(slide) = self.slides.get(id as usize) {
|
|
||||||
self.current_slide = slide.clone();
|
self.current_slide = slide.clone();
|
||||||
let _ = self
|
let _ =
|
||||||
.update(Message::ChangeFont(slide.font()));
|
self.update(Message::ChangeFont(slide.font()));
|
||||||
}
|
|
||||||
if self.current_slide.background() != &old_background
|
if self.current_slide.background() != &old_background
|
||||||
{
|
{
|
||||||
if let Some(video) = &mut self.video {
|
if let Some(video) = &mut self.video {
|
||||||
|
@ -480,18 +488,15 @@ impl Presenter {
|
||||||
.interaction(cosmic::iced::mouse::Interaction::Pointer)
|
.interaction(cosmic::iced::mouse::Interaction::Pointer)
|
||||||
.on_move(move |_| Message::HoveredSlide(slide_id))
|
.on_move(move |_| Message::HoveredSlide(slide_id))
|
||||||
.on_exit(Message::HoveredSlide(-1))
|
.on_exit(Message::HoveredSlide(-1))
|
||||||
.on_press(Message::SlideChange(slide_id as u16));
|
.on_press(Message::SlideChange(slide.clone()));
|
||||||
delegate.into()
|
delegate.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset_video(&mut self) {
|
fn reset_video(&mut self) {
|
||||||
if let Some(slide) =
|
match self.current_slide.background().kind {
|
||||||
self.slides.get(self.current_slide_index as usize)
|
|
||||||
{
|
|
||||||
match slide.background().kind {
|
|
||||||
BackgroundKind::Image => self.video = None,
|
BackgroundKind::Image => self.video = None,
|
||||||
BackgroundKind::Video => {
|
BackgroundKind::Video => {
|
||||||
let path = slide.background().path.clone();
|
let path = &self.current_slide.background().path;
|
||||||
if path.exists() {
|
if path.exists() {
|
||||||
let url = Url::from_file_path(path).unwrap();
|
let url = Url::from_file_path(path).unwrap();
|
||||||
let result = Self::create_video(url);
|
let result = Self::create_video(url);
|
||||||
|
@ -514,7 +519,6 @@ impl Presenter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(clippy::unused_async)]
|
#[allow(clippy::unused_async)]
|
||||||
async fn start_audio(sink: Arc<Sink>, audio: PathBuf) {
|
async fn start_audio(sink: Arc<Sink>, audio: PathBuf) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
(slide :background (image :source "~/pics/frodo.jpg" :fit fill)
|
(slide :background (image :source "~/pics/frodo.jpg" :fit fill)
|
||||||
(text "This is frodo" :font-size 90))
|
(text "This is frodo" :font-size 90))
|
||||||
(slide (video :source "~/vids/test/camprules2024.mp4" :fit contain))
|
(slide (video :source "~/vids/test/camprules2024.mp4" :fit contain))
|
||||||
(slide (video :source "~/vids/The Basics of Hanging Drywall.mkv" :fit contain))
|
(slide (video :source "~/vids/never give up.mkv" :fit contain))
|
||||||
(slide (video :source "~/vids/Ladybird Is The Future Of Web Browsers.webm" :fit contain))
|
(slide (video :source "~/vids/The promise of Rust.mkv" :fit contain))
|
||||||
(song :id 7 :author "North Point Worship"
|
(song :id 7 :author "North Point Worship"
|
||||||
:font "Quicksand Bold" :font-size 60
|
:font "Quicksand Bold" :font-size 60
|
||||||
:shadow "" :stroke ""
|
:shadow "" :stroke ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue