app: open the review once the history has loaded

`--scene review --live` opened the screen before the timelines were read
and stayed on "No game selected". The screen now remembers the request and
opens the first game that has events when the list arrives.
This commit is contained in:
vhaudiquet committed 2026-11-15 23:50:02 +01:00
1 parent 560f08cfb9
commit 3d0cad3312
1 file changed
+21
+21
View File
@@ -120,6 +120,7 @@ pub struct App {
pub notice: Option<Notice>,
pub autostart: bool,
pub logs: String,
pub pending_review: bool,
pub last_status: f64,
pub tray_events: Option<Receiver<rune::TrayEvent>>,
pub tray: Option<rune::Tray>,
@@ -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() {