From 92e3466d470221543ef8546987b570b4a9230889 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sat, 21 Nov 2026 10:58:09 +0100 Subject: [PATCH] Show source path in presenter footer --- Cargo.lock | 2 +- Cargo.toml | 2 +- crates/pdf-presenter/src/presenter_ui.rs | 38 ++++++++++------ crates/pdf-presenter/tests/presenter_ui.rs | 50 +++++++++++++++++++++- docs/changelog.md | 6 +++ docs/user-guide.md | 3 +- 6 files changed, 85 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5697ca0..5b98d26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2245,7 +2245,7 @@ dependencies = [ [[package]] name = "pdf-presenter" -version = "0.1.92" +version = "0.1.93" dependencies = [ "bytemuck", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 6b9164b..fcea899 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"] resolver = "3" [workspace.package] -version = "0.1.92" +version = "0.1.93" edition = "2024" license = "MIT" repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter" diff --git a/crates/pdf-presenter/src/presenter_ui.rs b/crates/pdf-presenter/src/presenter_ui.rs index 85bcfdb..508e334 100644 --- a/crates/pdf-presenter/src/presenter_ui.rs +++ b/crates/pdf-presenter/src/presenter_ui.rs @@ -12,6 +12,7 @@ use std::{ time::{Duration, Instant}, }; const BROWSER_SCROLL_HANDLE: Color32 = Color32::from_rgb(70, 210, 175); +const PRESENTER_FOOTER_HEIGHT: f32 = 112.; /// Composite a fitted slide over independent page and padding colors in every view. pub fn paint_slide( painter: &egui::Painter, @@ -952,7 +953,7 @@ fn presenter_view( body.min.y += header_height; } if view.layout.footer { - body.max.y -= 90.; + body.max.y -= PRESENTER_FOOTER_HEIGHT; } if view.layout.slide_progress { let height = view @@ -1272,15 +1273,6 @@ fn presenter_view( .show(ui, |ui| menu(ui, s, &mut view.preferences_open)); }); view.menu_open = menu_open; - ui.add_sized( - [100., 20.], - egui::Label::new( - s.deck - .as_ref() - .map_or("PDF Presenter", |d| d.title.as_str()), - ) - .truncate(), - ); if ui.button(tr(&locale, "Displays")).clicked() { s.begin_display_edit(); } @@ -1346,8 +1338,8 @@ fn presenter_view( } if footer { let rect = Rect::from_min_size( - Pos2::new(screen.left(), screen.bottom() - 90.), - Vec2::new(screen.width(), 90.), + Pos2::new(screen.left(), screen.bottom() - PRESENTER_FOOTER_HEIGHT), + Vec2::new(screen.width(), PRESENTER_FOOTER_HEIGHT), ); ui.painter().rect_filled(rect, 0., ui.visuals().window_fill); ui.scope_builder(egui::UiBuilder::new().max_rect(rect.shrink(8.)), |ui| { @@ -1401,6 +1393,28 @@ fn presenter_view( .desired_height(4.), ); } + if let Some(deck) = &s.deck { + let path = deck.path.display().to_string(); + let name = deck + .path + .file_name() + .and_then(|name| name.to_str()) + .unwrap_or(&path); + ui.horizontal(|ui| { + ui.strong(name).on_hover_text(&path); + ui.separator(); + ui.add_sized( + [ui.available_width(), 18.], + egui::Label::new( + egui::RichText::new(&path) + .small() + .color(ui.visuals().weak_text_color()), + ) + .truncate(), + ) + .on_hover_text(&path); + }); + } }); } let compact_preparation = s.loading diff --git a/crates/pdf-presenter/tests/presenter_ui.rs b/crates/pdf-presenter/tests/presenter_ui.rs index 91c9179..dc501b8 100644 --- a/crates/pdf-presenter/tests/presenter_ui.rs +++ b/crates/pdf-presenter/tests/presenter_ui.rs @@ -552,7 +552,7 @@ fn quick_settings_and_preferences_window_remain_interactive() { click(&mut s, "Pause timer"); assert!(!s.timer.running(std::time::Instant::now(), s.timer_limit())); click(&mut s, "Menu"); - click(&mut s, "Demo"); + click(&mut s, "demo.pdf"); assert!(!s.menu_open, "Outside click should dismiss the dropdown"); click(&mut s, "Menu"); frame( @@ -1114,6 +1114,54 @@ fn hidden_footer_hides_routine_rolling_buffer_status() { ); } +#[test] +fn source_name_and_path_are_in_the_footer_instead_of_the_header() { + fn contains_exact(shape: &egui::Shape, expected: &str) -> bool { + match shape { + egui::Shape::Text(text) => text.galley.text() == expected, + egui::Shape::Vec(shapes) => shapes.iter().any(|shape| contains_exact(shape, expected)), + _ => false, + } + } + let ctx = Context::default(); + let mut s = studio(); + let path = std::path::PathBuf::from("shows").join("conference.pdf"); + s.deck.as_mut().unwrap().path = path.clone(); + s.layout.header = true; + s.layout.footer = true; + let mut native = UiState::default(); + let visible = ctx.run_ui(input(Vec2::new(1280., 900.)), |ui| { + presenter_ui::presenter(ui, &mut s, &mut native) + }); + for expected in ["conference.pdf", &path.display().to_string()] { + assert!( + visible + .shapes + .iter() + .any(|shape| contains_exact(&shape.shape, expected)), + "missing {expected}" + ); + } + assert!( + !visible + .shapes + .iter() + .any(|shape| contains_exact(&shape.shape, "Demo")) + ); + + s.layout.footer = false; + native.footer_until = std::time::Instant::now() - std::time::Duration::from_secs(1); + let hidden = ctx.run_ui(input(Vec2::new(1280., 900.)), |ui| { + presenter_ui::presenter(ui, &mut s, &mut native) + }); + assert!( + !hidden + .shapes + .iter() + .any(|shape| contains_exact(&shape.shape, &path.display().to_string())) + ); +} + #[test] fn fullscreen_and_routing_changes_preserve_explicit_output_visibility() { for blanked in [false, true] { diff --git a/docs/changelog.md b/docs/changelog.md index 7c8c3d2..c2df50c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,12 @@ ## Unreleased +### 0.1.93 + +- Move the open source name out of the Presenter header and into a dedicated bottom + footer row with its full canonical path. Long paths truncate to the available + width and remain available on hover; hiding the footer hides the source details. + ### 0.1.92 - Extend the existing Canvas Pilot-inspired appearance menu with Spanish, Japanese, diff --git a/docs/user-guide.md b/docs/user-guide.md index d8e3957..e3e20e0 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -221,7 +221,8 @@ identity/checksums and reads frames into RAM: a restart cannot literally take ze time. A warm full-size cached frame appears directly, without an unnecessary preview render. Sources and their folders remain unchanged. -The footer shows the active operation, slides prepared/total, cache reuse, decoded +The footer shows the open PDF or picture-folder name and full source path, along +with the active operation, slides prepared/total, cache reuse, decoded RAM usage, and an approximate ETA once there are enough completed slides. It also shows output-process buffering separately. A compact progress notification remains visible during initial preparation if the footer is hidden. Routine rolling-buffer