Show: Show Media Controls hides the playback bar

The Slide Show checkbox wrote nothing. show.setup now stores
showMediaControls, and the show draws the playback bar and GIF button
only while that setting is on.
This commit is contained in:
Nikita Rakitin
2026-10-14 05:07:12 +03:00
parent 457406a7a5
commit c2e770ab53
5 changed files with 113 additions and 16 deletions
+23 -1
View File
@@ -27,7 +27,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Set Up Slide Show…",
["Slide Show", "Set Up"],
None,
"{type?: speaker|browsed|kiosk, loop?: bool, noNarration?, noAnimation?, useTimings?, from?, to?}",
"{type?: speaker|browsed|kiosk, loop?: bool, noNarration?, noAnimation?, useTimings?, showMediaControls?, from?, to?}",
has_doc,
setup
),
@@ -240,6 +240,9 @@ fn setup(s: &mut Session, p: &Value) -> Result<Value> {
if let Some(v) = bool_param(p, "useTimings") {
sh.use_timings = v;
}
if let Some(v) = bool_param(p, "showMediaControls") {
sh.show_media_controls = v;
}
match (p.get("from").and_then(Value::as_u64), p.get("to").and_then(Value::as_u64)) {
(Some(a), Some(b)) => sh.range = Some((a.min(u32::MAX as u64) as u32, b.min(u32::MAX as u64) as u32)),
(None, None) if p.get("all").is_some() => sh.range = None,
@@ -264,3 +267,22 @@ fn custom_show(s: &mut Session, p: &Value) -> Result<Value> {
})?;
ok()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn show_media_controls_follow_setup() {
let mut s = Session::with_new();
assert!(s.doc().expect("doc").doc.show.show_media_controls);
let off = s.execute("show.setup", &json!({"showMediaControls": false})).expect("off");
assert_eq!(off["showMediaControls"], false);
assert_eq!(off["useTimings"], true, "other setup flags stay");
let timings = s.execute("show.setup", &json!({"useTimings": false})).expect("timings");
assert_eq!(timings["showMediaControls"], false);
assert_eq!(timings["useTimings"], false);
s.execute("show.setup", &json!({"showMediaControls": true})).expect("on");
assert!(s.doc().expect("doc").doc.show.show_media_controls);
}
}