From 10fbbe5a65f948759ff53fd46592ddd6c2984b46 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 14 Aug 2025 09:19:30 -0500 Subject: [PATCH] some more updates --- Cargo.lock | 1 + Cargo.toml | 1 + flake.nix | 3 ++- justfile | 5 +++++ src/ui/presenter.rs | 36 ++++++++++++++++++++++++++++-------- 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4c7d3e..99e83f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3632,6 +3632,7 @@ dependencies = [ "strum_macros", "tokio", "tracing", + "tracing-log", "tracing-subscriber", "url", ] diff --git a/Cargo.toml b/Cargo.toml index a034fbf..09dec14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ pretty_assertions = "1.4.1" serde = { version = "1.0.213", features = ["derive"] } serde-lexpr = "0.1.3" tracing = "0.1.40" +tracing-log = "0.2.0" tracing-subscriber = { version = "0.3.18", features = ["fmt", "std", "chrono", "time", "local-time", "env-filter"] } strum = "0.26.3" strum_macros = "0.26.4" diff --git a/flake.nix b/flake.nix index 3b8c3a6..3f7e7d0 100644 --- a/flake.nix +++ b/flake.nix @@ -34,6 +34,7 @@ wayland-protocols libxkbcommon pkg-config + sccache ]; bi = with pkgs; [ @@ -72,7 +73,7 @@ in rec { devShell = pkgs.mkShell.override { - stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv; + # stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv; } { nativeBuildInputs = nbi; buildInputs = bi; diff --git a/justfile b/justfile index caf42a3..43aab48 100644 --- a/justfile +++ b/justfile @@ -5,8 +5,12 @@ default: just --list build: RUST_LOG=debug cargo build +sbuild: + RUST_LOG=debug sccache cargo build run: RUST_LOG=debug cargo run -- {{ui}} {{file}} +srun: + RUST_LOG=debug sccache cargo run -- {{ui}} {{file}} clean: RUST_LOG=debug cargo clean test: @@ -15,4 +19,5 @@ profile: cargo flamegraph --image-width 8000 -- {{ui}} {{file}} alias r := run +alias sr := srun alias c := clean diff --git a/src/ui/presenter.rs b/src/ui/presenter.rs index 1c3afac..d09be14 100644 --- a/src/ui/presenter.rs +++ b/src/ui/presenter.rs @@ -124,7 +124,7 @@ impl Presenter { let path = slide.background().path.clone(); if path.exists() { let url = Url::from_file_path(path).unwrap(); - let result = Self::create_video(url); + let result = Video::new(&url); match result { Ok(mut v) => { v.set_paused(true); @@ -303,10 +303,10 @@ impl Presenter { } } Message::VideoFrame => { - if let Some(video) = &self.video { - self.video_position = - video.position().as_secs_f32(); - } + // if let Some(video) = &self.video { + // self.video_position = + // video.position().as_secs_f32(); + // } } Message::MissingPlugin(element) => { if let Some(video) = &mut self.video { @@ -545,7 +545,7 @@ pub(crate) fn slide_view( delegate: bool, hide_mouse: bool, ) -> Element<'_, Message> { - responsive(move |size| { + let res = responsive(move |size| { let width = size.height * 16.0 / 9.0; let slide_text = slide.text(); @@ -687,6 +687,7 @@ pub(crate) fn slide_view( ) .center(Length::Shrink) .clip(true) + // Container::new(Space::new(0, 0)) } else { Container::new(Space::new(0, 0)) } @@ -698,6 +699,25 @@ pub(crate) fn slide_view( text_container ); Container::new(stack).center(Length::Fill).into() - }) - .into() + }); + // let vid = if let Some(video) = &video { + // Container::new( + // VideoPlayer::new(video) + // .mouse_hidden(hide_mouse) + // .width(Length::Fill) + // .height(Length::Fill) + // .on_end_of_stream(Message::EndVideo) + // .on_new_frame(Message::VideoFrame) + // .on_missing_plugin(Message::MissingPlugin) + // .on_warning(|w| Message::Error(w.to_string())) + // .on_error(|e| Message::Error(e.to_string())) + // .content_fit(ContentFit::Cover), + // ) + // .center(Length::Shrink) + // .clip(true) + // } else { + // Container::new(Space::new(0, 0)) + // }; + // stack!(vid, res).into() + res.into() }