Compare commits

..

No commits in common. "28a18819cfb64190dc4f13dc964a7b95e0cf2bd0" and "b03382f68702ad982b91bd02bd6b3ca1b3223013" have entirely different histories.

6 changed files with 334 additions and 371 deletions

549
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -20,10 +20,10 @@ strum = "0.26.3"
strum_macros = "0.26.4" strum_macros = "0.26.4"
ron = "0.8.1" ron = "0.8.1"
sqlx = { version = "0.8.2", features = ["sqlite", "runtime-tokio"] } sqlx = { version = "0.8.2", features = ["sqlite", "runtime-tokio"] }
dirs = "6.0.0" dirs = "5.0.1"
tokio = "1.41.1" tokio = "1.41.1"
crisp = { git = "https://git.tfcconnection.org/chris/crisp", version = "0.1.3" } crisp = { git = "https://git.tfcconnection.org/chris/crisp", version = "0.1.3" }
rodio = { version = "0.21.1", features = ["symphonia-all", "tracing"] } rodio = { version = "0.20.1", features = ["symphonia-all", "tracing"] }
gstreamer = "0.23" gstreamer = "0.23"
gstreamer-app = "0.23" gstreamer-app = "0.23"
# gstreamer-video = "0.23" # gstreamer-video = "0.23"

View file

@ -15,13 +15,13 @@ use cosmic::iced_widget::{column, row, stack};
use cosmic::theme; use cosmic::theme;
use cosmic::widget::dnd_destination::dnd_destination; use cosmic::widget::dnd_destination::dnd_destination;
use cosmic::widget::nav_bar::nav_bar_style; use cosmic::widget::nav_bar::nav_bar_style;
use cosmic::widget::text;
use cosmic::widget::tooltip::Position as TPosition; use cosmic::widget::tooltip::Position as TPosition;
use cosmic::widget::Container; use cosmic::widget::Container;
use cosmic::widget::{ use cosmic::widget::{
button, horizontal_space, mouse_area, nav_bar, search_input, button, horizontal_space, mouse_area, nav_bar, search_input,
tooltip, vertical_space, Space, tooltip, vertical_space, Space,
}; };
use cosmic::widget::{container, text};
use cosmic::widget::{icon, slider}; use cosmic::widget::{icon, slider};
use cosmic::{executor, Application, ApplicationExt, Element}; use cosmic::{executor, Application, ApplicationExt, Element};
use crisp::types::Value; use crisp::types::Value;
@ -1115,9 +1115,7 @@ impl cosmic::Application for App {
]; ];
if let Some(_editor) = &self.editor_mode { if let Some(_editor) = &self.editor_mode {
container(song_editor) Element::from(song_editor)
.padding(cosmic::theme::spacing().space_xxl)
.into()
} else { } else {
Element::from(column) Element::from(column)
} }

View file

@ -129,6 +129,7 @@ impl<'a> Library {
pub fn update(&'a mut self, message: Message) -> Action { pub fn update(&'a mut self, message: Message) -> Action {
match message { match message {
Message::AddItem => (),
Message::None => (), Message::None => (),
Message::DeleteItem((kind, index)) => { Message::DeleteItem((kind, index)) => {
match kind { match kind {
@ -163,27 +164,6 @@ impl<'a> Library {
} }
}; };
} }
Message::AddItem => {
let kind =
self.library_open.unwrap_or(LibraryKind::Song);
let item = match kind {
LibraryKind::Song => {
let song = Song::default();
self.song_library
.add_item(song)
.map(|_| {
let index =
self.song_library.items.len();
(LibraryKind::Song, index as i32)
})
.ok()
}
LibraryKind::Video => todo!(),
LibraryKind::Image => todo!(),
LibraryKind::Presentation => todo!(),
};
return self.update(Message::OpenItem(item));
}
Message::OpenItem(item) => { Message::OpenItem(item) => {
debug!(?item); debug!(?item);
self.editing_item = item; self.editing_item = item;
@ -536,7 +516,6 @@ impl<'a> Library {
let library_toolbar = rowm!( let library_toolbar = rowm!(
text_input("Search...", ""), text_input("Search...", ""),
button::icon(icon::from_name("add")) button::icon(icon::from_name("add"))
.on_press(Message::AddItem)
); );
let library_column = let library_column =
column![library_toolbar, items].spacing(3); column![library_toolbar, items].spacing(3);

View file

@ -21,7 +21,7 @@ use cosmic::{
Task, Task,
}; };
use iced_video_player::{gst_pbutils, Position, Video, VideoPlayer}; use iced_video_player::{gst_pbutils, Position, Video, VideoPlayer};
use rodio::{Decoder, OutputStream, OutputStreamBuilder, Sink}; use rodio::{Decoder, OutputStream, Sink};
use tracing::{debug, error, info, warn}; use tracing::{debug, error, info, warn};
use url::Url; use url::Url;
@ -44,7 +44,7 @@ pub(crate) struct Presenter {
pub video: Option<Video>, pub video: Option<Video>,
pub video_position: f32, pub video_position: f32,
pub audio: Option<PathBuf>, pub audio: Option<PathBuf>,
sink: (Arc<Sink>, OutputStream), sink: (OutputStream, Arc<Sink>),
hovered_slide: Option<(usize, usize)>, hovered_slide: Option<(usize, usize)>,
scroll_id: Id, scroll_id: Id,
current_font: Font, current_font: Font,
@ -159,14 +159,11 @@ impl Presenter {
video_position: 0.0, video_position: 0.0,
hovered_slide: None, hovered_slide: None,
sink: { sink: {
let stream_handle = let (stream, stream_handle) =
OutputStreamBuilder::open_default_stream() OutputStream::try_default().unwrap();
.expect("Can't open default rodio stream");
( (
Arc::new(Sink::connect_new( stream,
&stream_handle.mixer(), Arc::new(Sink::try_new(&stream_handle).unwrap()),
)),
stream_handle,
) )
}, },
scroll_id: Id::unique(), scroll_id: Id::unique(),
@ -388,7 +385,7 @@ impl Presenter {
return Action::Task(self.start_audio()); return Action::Task(self.start_audio());
} }
Message::EndAudio => { Message::EndAudio => {
self.sink.0.stop(); self.sink.1.stop();
} }
Message::None => debug!("Presenter Message::None"), Message::None => debug!("Presenter Message::None"),
Message::Error(error) => { Message::Error(error) => {
@ -400,8 +397,9 @@ impl Presenter {
pub fn view(&self) -> Element<Message> { pub fn view(&self) -> Element<Message> {
slide_view( slide_view(
self.current_slide.clone(), &self.current_slide,
&self.video, &self.video,
self.current_font,
false, false,
true, true,
) )
@ -409,8 +407,9 @@ impl Presenter {
pub fn view_preview(&self) -> Element<Message> { pub fn view_preview(&self) -> Element<Message> {
slide_view( slide_view(
self.current_slide.clone(), &self.current_slide,
&self.video, &self.video,
self.current_font,
false, false,
false, false,
) )
@ -444,8 +443,9 @@ impl Presenter {
); );
let container = slide_view( let container = slide_view(
slide.clone(), slide,
&self.video, &self.video,
font,
true, true,
false, false,
); );
@ -663,7 +663,7 @@ impl Presenter {
debug!(?audio, "This is where audio should be changing"); debug!(?audio, "This is where audio should be changing");
let audio = audio.clone(); let audio = audio.clone();
Task::perform( Task::perform(
start_audio(Arc::clone(&self.sink.0), audio), start_audio(Arc::clone(&self.sink.1), audio),
|()| Message::None, |()| Message::None,
) )
} else { } else {
@ -705,8 +705,9 @@ fn scale_font(font_size: f32, width: f32) -> f32 {
} }
pub(crate) fn slide_view<'a>( pub(crate) fn slide_view<'a>(
slide: Slide, slide: &'a Slide,
video: &'a Option<Video>, video: &'a Option<Video>,
font: Font,
delegate: bool, delegate: bool,
hide_mouse: bool, hide_mouse: bool,
) -> Element<'a, Message> { ) -> Element<'a, Message> {

View file

@ -11,7 +11,7 @@ use cosmic::{
theme, theme,
widget::{ widget::{
button, column, combo_box, container, horizontal_space, icon, button, column, combo_box, container, horizontal_space, icon,
scrollable, text, text_editor, text_input, text, text_editor, text_input,
}, },
Element, Task, Element, Task,
}; };
@ -20,9 +20,8 @@ use iced_video_player::Video;
use tracing::{debug, error}; use tracing::{debug, error};
use crate::{ use crate::{
core::{service_items::ServiceTrait, songs::Song}, core::songs::Song, ui::slide_editor::SlideEditor, Background,
ui::{presenter::slide_view, slide_editor::SlideEditor}, BackgroundKind,
Background, BackgroundKind,
}; };
#[derive(Debug)] #[derive(Debug)]
@ -283,48 +282,49 @@ impl SongEditor {
} }
fn slide_preview(&self) -> Element<Message> { fn slide_preview(&self) -> Element<Message> {
if let Some(song) = &self.song { // if let Some(song) = &self.song {
if let Ok(slides) = song.to_slides() { // if let Ok(slides) = song.to_slides() {
let slides: Vec<Element<Message>> = slides // let slides = slides
.into_iter() // .iter()
.enumerate() // .enumerate()
.map(|(index, slide)| { // .map(|(index, slide)| {
container( // container(
slide_view( // slide_view(
slide, // slide.clone(),
if index == 0 { // if index == 0 {
&self.video // &self.video
} else { // } else {
&None // &None
}, // },
false, // self.current_font,
false, // false,
) // false,
.map(|_| Message::None), // )
) // .map(|_| Message::None),
.height(250) // )
.center_x(Length::Fill) // .height(250)
.padding([0, 20]) // .center_x(Length::Fill)
.clip(true) // .padding([0, 20])
.into() // .clip(true)
}) // .into()
.collect(); // })
scrollable( // .collect();
column::with_children(slides) // scrollable(
.spacing(theme::active().cosmic().space_l()), // column::with_children(slides)
) // .spacing(theme::active().cosmic().space_l()),
.height(Length::Fill) // )
.width(Length::Fill) // .height(Length::Fill)
.into() // .width(Length::Fill)
} else { // .into()
horizontal_space().into() // } else {
} // horizontal_space().into()
} else { // }
horizontal_space().into() // } else {
} // horizontal_space().into()
// self.slide_state // }
// .view(Font::with_name("Quicksand Bold")) self.slide_state
// .map(|_s| Message::None) .view(Font::with_name("Quicksand Bold"))
.map(|_s| Message::None)
} }
fn left_column(&self) -> Element<Message> { fn left_column(&self) -> Element<Message> {