The titlebar offered "Start recording" although the recorder starts with a game; Settings takes that button's place. The two-tab sidebar becomes a status bar that also names the encoder, and the blue square beside the name is gone. Match cards show a champion tile: initials on a colour derived from the name until there is an image cache. History, review and settings lists get a scrollbar that follows the viewport in the same frame. Settings keeps the one switch a player can act on, launch at startup, and says in plain words that recording starts with a game. The recorder's own toggles and the client poll interval move to Advanced.
130 lines
4.1 KiB
Rust
130 lines
4.1 KiB
Rust
//! League Recorder: a native desktop app for the record-daemon.
|
|
//!
|
|
//! Replaces `tauri-app`. The daemon keeps its IPC protocol; this app is a client of it.
|
|
//! `cargo run` opens the window; `cargo run -- --snap out.png` renders it headless.
|
|
|
|
mod app;
|
|
mod daemon;
|
|
mod export;
|
|
mod format;
|
|
mod highlight;
|
|
mod history;
|
|
mod ipc;
|
|
mod os;
|
|
mod screens;
|
|
mod settings;
|
|
mod ui;
|
|
|
|
use rune::AppSpec;
|
|
|
|
fn main() {
|
|
if std::env::args().any(|arg| arg == "--games") {
|
|
println!("{} timelines", crate::history::load_all().len());
|
|
return;
|
|
}
|
|
if std::env::args().any(|arg| arg == "--probe") {
|
|
probe();
|
|
return;
|
|
}
|
|
// A second launch hands its arguments to the first and exits.
|
|
if !rune::single_instance(os::APP_ID) {
|
|
return;
|
|
}
|
|
os::register_notifications();
|
|
rune_notify::on_click(|_| rune_notify::bring_to_front());
|
|
|
|
let mut hidden = false;
|
|
let args: Vec<String> = std::env::args()
|
|
.filter(|arg| {
|
|
if arg == "--hidden" {
|
|
hidden = true;
|
|
false
|
|
} else {
|
|
true
|
|
}
|
|
})
|
|
.collect();
|
|
|
|
rune::App::new(AppSpec {
|
|
scenes: &[
|
|
("history", |_app: &mut app::App| {}),
|
|
("settings", |app| app.screen = app::Screen::Settings),
|
|
("recording", |app| {
|
|
app.screen = app::Screen::Settings;
|
|
app.settings_tab = app::SettingsTab::Recording;
|
|
}),
|
|
("audio", |app| {
|
|
app.screen = app::Screen::Settings;
|
|
app.settings_tab = app::SettingsTab::Audio;
|
|
}),
|
|
("daemon", |app| {
|
|
app.screen = app::Screen::Settings;
|
|
app.settings_tab = app::SettingsTab::Daemon;
|
|
}),
|
|
("review", |app| app::demo_review(app)),
|
|
("many", |app| {
|
|
app.screen = app::Screen::History;
|
|
app.games = (0..30).flat_map(|_| crate::history::sample()).collect();
|
|
app.games_loaded = true;
|
|
}),
|
|
],
|
|
setup: Some(app::setup),
|
|
poll: Some(app::poll),
|
|
on_key: Some(app::on_key),
|
|
..AppSpec::new("League Recorder", (1200.0, 800.0), app::App::new, app::view)
|
|
})
|
|
.args(args)
|
|
.keep_running()
|
|
.on_ready(move |handle| {
|
|
app::remember_window(handle);
|
|
if hidden {
|
|
handle.hide();
|
|
}
|
|
})
|
|
.run();
|
|
}
|
|
|
|
/// `--probe`: bring the daemon up and print what it answers, then exit. A quick check that the
|
|
/// IPC client and the daemon agree without opening a window.
|
|
fn probe() {
|
|
let runtime = tokio::runtime::Builder::new_current_thread()
|
|
.enable_all()
|
|
.build()
|
|
.expect("async runtime");
|
|
runtime.block_on(async {
|
|
match daemon::ensure_running().await {
|
|
Ok(()) => println!("daemon: ready"),
|
|
Err(e) => {
|
|
println!("daemon: {e}");
|
|
return;
|
|
}
|
|
}
|
|
let client = ipc::Client::new();
|
|
for (name, command) in [
|
|
("status", ipc::Command::GetStatus),
|
|
("settings", ipc::Command::GetSettings),
|
|
("encoders", ipc::Command::GetEncoders),
|
|
("audioDevices", ipc::Command::GetAudioDevices),
|
|
] {
|
|
match client.call(command, None).await {
|
|
Ok(data) => println!("{name}: {data}"),
|
|
Err(e) => println!("{name}: error: {e}"),
|
|
}
|
|
}
|
|
// Parse with the app model, which is what the settings screen receives.
|
|
match client.call(ipc::Command::GetSettings, None).await {
|
|
Ok(data) => match crate::settings::from_response(&data) {
|
|
Ok(settings) => println!(
|
|
"parsed: {} fps, {:?}, {} application sources, encoder {}",
|
|
settings.video.frame_rate,
|
|
settings.video.quality,
|
|
settings.audio.capture_apps.len(),
|
|
settings.video.encoder_preset.encoder_id(),
|
|
),
|
|
Err(e) => println!("parsed: failed: {e}"),
|
|
},
|
|
Err(e) => println!("parsed: {e}"),
|
|
}
|
|
});
|
|
}
|