diff --git a/app/src/app.rs b/app/src/app.rs index 8c02e83..8468658 100644 --- a/app/src/app.rs +++ b/app/src/app.rs @@ -120,6 +120,7 @@ pub struct App { pub notice: Option, pub autostart: bool, pub logs: String, + pub pending_review: bool, pub last_status: f64, pub tray_events: Option>, pub tray: Option, @@ -155,6 +156,7 @@ impl App { notice: None, autostart, logs: String::new(), + pending_review: false, last_status: -10.0, tray_events: None, tray: None, @@ -448,6 +450,9 @@ impl App { self.games_loaded = true; self.games_rx = None; changed = true; + if self.pending_review { + demo_review(self); + } } Err(TryRecvError::Empty) => {} Err(TryRecvError::Disconnected) => self.games_rx = None, @@ -730,6 +735,22 @@ pub fn headless() -> bool { /// Put the first sample game on the review screen, for `--scene review`. pub fn demo_review(app: &mut App) { app.screen = Screen::Review; + if app.games.is_empty() { + // Opened before the history finished loading: `poll` opens it once it has. + app.pending_review = true; + return; + } + app.pending_review = false; + let live = std::env::args().any(|arg| arg == "--live"); + if live { + let index = app + .games + .iter() + .position(|game| !game.events.is_empty()) + .unwrap_or(0); + screens::review::open(app, index); + return; + } app.review.game = app.games.first().map(|game| game.recording_id.clone()); app.review.error = Some("Sample recording: no clip on disk.".to_string()); if let Some(game) = app.games.first() {