Compare commits
No commits in common. "28a18819cfb64190dc4f13dc964a7b95e0cf2bd0" and "b03382f68702ad982b91bd02bd6b3ca1b3223013" have entirely different histories.
28a18819cf
...
b03382f687
6 changed files with 334 additions and 371 deletions
549
Cargo.lock
generated
549
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -20,10 +20,10 @@ strum = "0.26.3"
|
|||
strum_macros = "0.26.4"
|
||||
ron = "0.8.1"
|
||||
sqlx = { version = "0.8.2", features = ["sqlite", "runtime-tokio"] }
|
||||
dirs = "6.0.0"
|
||||
dirs = "5.0.1"
|
||||
tokio = "1.41.1"
|
||||
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-app = "0.23"
|
||||
# gstreamer-video = "0.23"
|
||||
|
|
|
@ -15,13 +15,13 @@ use cosmic::iced_widget::{column, row, stack};
|
|||
use cosmic::theme;
|
||||
use cosmic::widget::dnd_destination::dnd_destination;
|
||||
use cosmic::widget::nav_bar::nav_bar_style;
|
||||
use cosmic::widget::text;
|
||||
use cosmic::widget::tooltip::Position as TPosition;
|
||||
use cosmic::widget::Container;
|
||||
use cosmic::widget::{
|
||||
button, horizontal_space, mouse_area, nav_bar, search_input,
|
||||
tooltip, vertical_space, Space,
|
||||
};
|
||||
use cosmic::widget::{container, text};
|
||||
use cosmic::widget::{icon, slider};
|
||||
use cosmic::{executor, Application, ApplicationExt, Element};
|
||||
use crisp::types::Value;
|
||||
|
@ -1115,9 +1115,7 @@ impl cosmic::Application for App {
|
|||
];
|
||||
|
||||
if let Some(_editor) = &self.editor_mode {
|
||||
container(song_editor)
|
||||
.padding(cosmic::theme::spacing().space_xxl)
|
||||
.into()
|
||||
Element::from(song_editor)
|
||||
} else {
|
||||
Element::from(column)
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ impl<'a> Library {
|
|||
|
||||
pub fn update(&'a mut self, message: Message) -> Action {
|
||||
match message {
|
||||
Message::AddItem => (),
|
||||
Message::None => (),
|
||||
Message::DeleteItem((kind, index)) => {
|
||||
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) => {
|
||||
debug!(?item);
|
||||
self.editing_item = item;
|
||||
|
@ -536,7 +516,6 @@ impl<'a> Library {
|
|||
let library_toolbar = rowm!(
|
||||
text_input("Search...", ""),
|
||||
button::icon(icon::from_name("add"))
|
||||
.on_press(Message::AddItem)
|
||||
);
|
||||
let library_column =
|
||||
column![library_toolbar, items].spacing(3);
|
||||
|
|
|
@ -21,7 +21,7 @@ use cosmic::{
|
|||
Task,
|
||||
};
|
||||
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 url::Url;
|
||||
|
||||
|
@ -44,7 +44,7 @@ pub(crate) struct Presenter {
|
|||
pub video: Option<Video>,
|
||||
pub video_position: f32,
|
||||
pub audio: Option<PathBuf>,
|
||||
sink: (Arc<Sink>, OutputStream),
|
||||
sink: (OutputStream, Arc<Sink>),
|
||||
hovered_slide: Option<(usize, usize)>,
|
||||
scroll_id: Id,
|
||||
current_font: Font,
|
||||
|
@ -159,14 +159,11 @@ impl Presenter {
|
|||
video_position: 0.0,
|
||||
hovered_slide: None,
|
||||
sink: {
|
||||
let stream_handle =
|
||||
OutputStreamBuilder::open_default_stream()
|
||||
.expect("Can't open default rodio stream");
|
||||
let (stream, stream_handle) =
|
||||
OutputStream::try_default().unwrap();
|
||||
(
|
||||
Arc::new(Sink::connect_new(
|
||||
&stream_handle.mixer(),
|
||||
)),
|
||||
stream_handle,
|
||||
stream,
|
||||
Arc::new(Sink::try_new(&stream_handle).unwrap()),
|
||||
)
|
||||
},
|
||||
scroll_id: Id::unique(),
|
||||
|
@ -388,7 +385,7 @@ impl Presenter {
|
|||
return Action::Task(self.start_audio());
|
||||
}
|
||||
Message::EndAudio => {
|
||||
self.sink.0.stop();
|
||||
self.sink.1.stop();
|
||||
}
|
||||
Message::None => debug!("Presenter Message::None"),
|
||||
Message::Error(error) => {
|
||||
|
@ -400,8 +397,9 @@ impl Presenter {
|
|||
|
||||
pub fn view(&self) -> Element<Message> {
|
||||
slide_view(
|
||||
self.current_slide.clone(),
|
||||
&self.current_slide,
|
||||
&self.video,
|
||||
self.current_font,
|
||||
false,
|
||||
true,
|
||||
)
|
||||
|
@ -409,8 +407,9 @@ impl Presenter {
|
|||
|
||||
pub fn view_preview(&self) -> Element<Message> {
|
||||
slide_view(
|
||||
self.current_slide.clone(),
|
||||
&self.current_slide,
|
||||
&self.video,
|
||||
self.current_font,
|
||||
false,
|
||||
false,
|
||||
)
|
||||
|
@ -444,8 +443,9 @@ impl Presenter {
|
|||
);
|
||||
|
||||
let container = slide_view(
|
||||
slide.clone(),
|
||||
slide,
|
||||
&self.video,
|
||||
font,
|
||||
true,
|
||||
false,
|
||||
);
|
||||
|
@ -663,7 +663,7 @@ impl Presenter {
|
|||
debug!(?audio, "This is where audio should be changing");
|
||||
let audio = audio.clone();
|
||||
Task::perform(
|
||||
start_audio(Arc::clone(&self.sink.0), audio),
|
||||
start_audio(Arc::clone(&self.sink.1), audio),
|
||||
|()| Message::None,
|
||||
)
|
||||
} else {
|
||||
|
@ -705,8 +705,9 @@ fn scale_font(font_size: f32, width: f32) -> f32 {
|
|||
}
|
||||
|
||||
pub(crate) fn slide_view<'a>(
|
||||
slide: Slide,
|
||||
slide: &'a Slide,
|
||||
video: &'a Option<Video>,
|
||||
font: Font,
|
||||
delegate: bool,
|
||||
hide_mouse: bool,
|
||||
) -> Element<'a, Message> {
|
||||
|
|
|
@ -11,7 +11,7 @@ use cosmic::{
|
|||
theme,
|
||||
widget::{
|
||||
button, column, combo_box, container, horizontal_space, icon,
|
||||
scrollable, text, text_editor, text_input,
|
||||
text, text_editor, text_input,
|
||||
},
|
||||
Element, Task,
|
||||
};
|
||||
|
@ -20,9 +20,8 @@ use iced_video_player::Video;
|
|||
use tracing::{debug, error};
|
||||
|
||||
use crate::{
|
||||
core::{service_items::ServiceTrait, songs::Song},
|
||||
ui::{presenter::slide_view, slide_editor::SlideEditor},
|
||||
Background, BackgroundKind,
|
||||
core::songs::Song, ui::slide_editor::SlideEditor, Background,
|
||||
BackgroundKind,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -283,48 +282,49 @@ impl SongEditor {
|
|||
}
|
||||
|
||||
fn slide_preview(&self) -> Element<Message> {
|
||||
if let Some(song) = &self.song {
|
||||
if let Ok(slides) = song.to_slides() {
|
||||
let slides: Vec<Element<Message>> = slides
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(index, slide)| {
|
||||
container(
|
||||
slide_view(
|
||||
slide,
|
||||
if index == 0 {
|
||||
&self.video
|
||||
} else {
|
||||
&None
|
||||
},
|
||||
false,
|
||||
false,
|
||||
)
|
||||
.map(|_| Message::None),
|
||||
)
|
||||
.height(250)
|
||||
.center_x(Length::Fill)
|
||||
.padding([0, 20])
|
||||
.clip(true)
|
||||
.into()
|
||||
})
|
||||
.collect();
|
||||
scrollable(
|
||||
column::with_children(slides)
|
||||
.spacing(theme::active().cosmic().space_l()),
|
||||
)
|
||||
.height(Length::Fill)
|
||||
.width(Length::Fill)
|
||||
.into()
|
||||
} else {
|
||||
horizontal_space().into()
|
||||
}
|
||||
} else {
|
||||
horizontal_space().into()
|
||||
}
|
||||
// self.slide_state
|
||||
// .view(Font::with_name("Quicksand Bold"))
|
||||
// .map(|_s| Message::None)
|
||||
// if let Some(song) = &self.song {
|
||||
// if let Ok(slides) = song.to_slides() {
|
||||
// let slides = slides
|
||||
// .iter()
|
||||
// .enumerate()
|
||||
// .map(|(index, slide)| {
|
||||
// container(
|
||||
// slide_view(
|
||||
// slide.clone(),
|
||||
// if index == 0 {
|
||||
// &self.video
|
||||
// } else {
|
||||
// &None
|
||||
// },
|
||||
// self.current_font,
|
||||
// false,
|
||||
// false,
|
||||
// )
|
||||
// .map(|_| Message::None),
|
||||
// )
|
||||
// .height(250)
|
||||
// .center_x(Length::Fill)
|
||||
// .padding([0, 20])
|
||||
// .clip(true)
|
||||
// .into()
|
||||
// })
|
||||
// .collect();
|
||||
// scrollable(
|
||||
// column::with_children(slides)
|
||||
// .spacing(theme::active().cosmic().space_l()),
|
||||
// )
|
||||
// .height(Length::Fill)
|
||||
// .width(Length::Fill)
|
||||
// .into()
|
||||
// } else {
|
||||
// horizontal_space().into()
|
||||
// }
|
||||
// } else {
|
||||
// horizontal_space().into()
|
||||
// }
|
||||
self.slide_state
|
||||
.view(Font::with_name("Quicksand Bold"))
|
||||
.map(|_s| Message::None)
|
||||
}
|
||||
|
||||
fn left_column(&self) -> Element<Message> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue