Compare commits

..

2 commits

Author SHA1 Message Date
28a18819cf updating deps
Some checks failed
/ test (push) Has been cancelled
2025-09-17 06:35:18 -05:00
b9a9dda233 back to song_editor looking right 2025-09-17 06:04:28 -05:00
6 changed files with 378 additions and 341 deletions

563
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 = "5.0.1" dirs = "6.0.0"
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.20.1", features = ["symphonia-all", "tracing"] } rodio = { version = "0.21.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,7 +1115,9 @@ impl cosmic::Application for App {
]; ];
if let Some(_editor) = &self.editor_mode { if let Some(_editor) = &self.editor_mode {
Element::from(song_editor) container(song_editor)
.padding(cosmic::theme::spacing().space_xxl)
.into()
} else { } else {
Element::from(column) Element::from(column)
} }

View file

@ -129,7 +129,6 @@ 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 {
@ -164,6 +163,27 @@ 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;
@ -516,6 +536,7 @@ 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, Sink}; use rodio::{Decoder, OutputStream, OutputStreamBuilder, 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: (OutputStream, Arc<Sink>), sink: (Arc<Sink>, OutputStream),
hovered_slide: Option<(usize, usize)>, hovered_slide: Option<(usize, usize)>,
scroll_id: Id, scroll_id: Id,
current_font: Font, current_font: Font,
@ -159,11 +159,14 @@ impl Presenter {
video_position: 0.0, video_position: 0.0,
hovered_slide: None, hovered_slide: None,
sink: { sink: {
let (stream, stream_handle) = let stream_handle =
OutputStream::try_default().unwrap(); OutputStreamBuilder::open_default_stream()
.expect("Can't open default rodio stream");
( (
stream, Arc::new(Sink::connect_new(
Arc::new(Sink::try_new(&stream_handle).unwrap()), &stream_handle.mixer(),
)),
stream_handle,
) )
}, },
scroll_id: Id::unique(), scroll_id: Id::unique(),
@ -385,7 +388,7 @@ impl Presenter {
return Action::Task(self.start_audio()); return Action::Task(self.start_audio());
} }
Message::EndAudio => { Message::EndAudio => {
self.sink.1.stop(); self.sink.0.stop();
} }
Message::None => debug!("Presenter Message::None"), Message::None => debug!("Presenter Message::None"),
Message::Error(error) => { Message::Error(error) => {
@ -397,9 +400,8 @@ impl Presenter {
pub fn view(&self) -> Element<Message> { pub fn view(&self) -> Element<Message> {
slide_view( slide_view(
&self.current_slide, self.current_slide.clone(),
&self.video, &self.video,
self.current_font,
false, false,
true, true,
) )
@ -407,9 +409,8 @@ impl Presenter {
pub fn view_preview(&self) -> Element<Message> { pub fn view_preview(&self) -> Element<Message> {
slide_view( slide_view(
&self.current_slide, self.current_slide.clone(),
&self.video, &self.video,
self.current_font,
false, false,
false, false,
) )
@ -443,9 +444,8 @@ impl Presenter {
); );
let container = slide_view( let container = slide_view(
slide, slide.clone(),
&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.1), audio), start_audio(Arc::clone(&self.sink.0), audio),
|()| Message::None, |()| Message::None,
) )
} else { } else {
@ -705,9 +705,8 @@ fn scale_font(font_size: f32, width: f32) -> f32 {
} }
pub(crate) fn slide_view<'a>( pub(crate) fn slide_view<'a>(
slide: &'a Slide, slide: 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,
text, text_editor, text_input, scrollable, text, text_editor, text_input,
}, },
Element, Task, Element, Task,
}; };
@ -20,8 +20,9 @@ use iced_video_player::Video;
use tracing::{debug, error}; use tracing::{debug, error};
use crate::{ use crate::{
core::songs::Song, ui::slide_editor::SlideEditor, Background, core::{service_items::ServiceTrait, songs::Song},
BackgroundKind, ui::{presenter::slide_view, slide_editor::SlideEditor},
Background, BackgroundKind,
}; };
#[derive(Debug)] #[derive(Debug)]
@ -282,49 +283,48 @@ 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 = slides let slides: Vec<Element<Message>> = slides
// .iter() .into_iter()
// .enumerate() .enumerate()
// .map(|(index, slide)| { .map(|(index, slide)| {
// container( container(
// slide_view( slide_view(
// slide.clone(), slide,
// if index == 0 { if index == 0 {
// &self.video &self.video
// } else { } else {
// &None &None
// }, },
// self.current_font, false,
// false, false,
// false, )
// ) .map(|_| Message::None),
// .map(|_| Message::None), )
// ) .height(250)
// .height(250) .center_x(Length::Fill)
// .center_x(Length::Fill) .padding([0, 20])
// .padding([0, 20]) .clip(true)
// .clip(true) .into()
// .into() })
// }) .collect();
// .collect(); scrollable(
// scrollable( column::with_children(slides)
// column::with_children(slides) .spacing(theme::active().cosmic().space_l()),
// .spacing(theme::active().cosmic().space_l()), )
// ) .height(Length::Fill)
// .height(Length::Fill) .width(Length::Fill)
// .width(Length::Fill) .into()
// .into() } else {
// } else { horizontal_space().into()
// horizontal_space().into() }
// } } else {
// } else { horizontal_space().into()
// horizontal_space().into() }
// } // self.slide_state
self.slide_state // .view(Font::with_name("Quicksand Bold"))
.view(Font::with_name("Quicksand Bold")) // .map(|_s| Message::None)
.map(|_s| Message::None)
} }
fn left_column(&self) -> Element<Message> { fn left_column(&self) -> Element<Message> {