Show source path in presenter footer

This commit is contained in:
Dandaedre 2026-11-21 10:58:09 +01:00
parent 9ca908e88d
commit 92e3466d47
6 changed files with 85 additions and 16 deletions

2
Cargo.lock generated
View File

@ -2245,7 +2245,7 @@ dependencies = [
[[package]]
name = "pdf-presenter"
version = "0.1.92"
version = "0.1.93"
dependencies = [
"bytemuck",
"chrono",

View File

@ -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"

View File

@ -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

View File

@ -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] {

View File

@ -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,

View File

@ -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