app: put automatic recording at the center of the window
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.
This commit is contained in:
1 parent
01a92f1edf
commit
e7a36c3129
6 files changed
+328
-265
No files matched your search
+63
-108
@@ -5,7 +5,7 @@ use rune::{El, TextEdit, col, row, text};
|
||||
use rune_kit::Select;
|
||||
|
||||
use crate::app::{App, SettingsTab};
|
||||
use crate::settings::{AudioSource, AudioSourceType, EncoderPreset, Quality, Settings};
|
||||
use crate::settings::{AudioSource, AudioSourceType, Quality, Settings};
|
||||
use crate::ui::{self, Paint, body, heading};
|
||||
|
||||
/// The daemon's settings plus the text fields the user is typing into.
|
||||
@@ -132,14 +132,6 @@ impl Form {
|
||||
}
|
||||
}
|
||||
|
||||
fn encoder_label(preset: &EncoderPreset) -> &'static str {
|
||||
match preset {
|
||||
EncoderPreset::Nvenc { .. } => "NVIDIA NVENC",
|
||||
EncoderPreset::Amf { .. } => "AMD AMF",
|
||||
EncoderPreset::X264 { .. } => "x264 (Software)",
|
||||
}
|
||||
}
|
||||
|
||||
const ENCODERS: [&str; 3] = ["NVIDIA NVENC", "AMD AMF", "x264 (Software)"];
|
||||
const QUALITIES: [&str; 4] = ["Low", "Medium", "High", "Ultra"];
|
||||
const CONTAINERS: [&str; 4] = ["mp4", "mkv", "mov", "flv"];
|
||||
@@ -210,7 +202,7 @@ fn tabs(p: Paint, app: &App) -> El {
|
||||
(SettingsTab::General, "General"),
|
||||
(SettingsTab::Recording, "Recording"),
|
||||
(SettingsTab::Audio, "Audio"),
|
||||
(SettingsTab::Daemon, "Daemon"),
|
||||
(SettingsTab::Daemon, "Advanced"),
|
||||
] {
|
||||
row = row.child(ui::tab(
|
||||
p,
|
||||
@@ -239,7 +231,7 @@ pub fn view(app: &App, p: Paint) -> El {
|
||||
SettingsTab::General => general(app, p, &kit, &mut layer, content),
|
||||
SettingsTab::Recording => recording(app, p, &kit, &mut layer, content),
|
||||
SettingsTab::Audio => audio(app, p, &kit, &mut layer, content),
|
||||
SettingsTab::Daemon => daemon_tab(app, p, content),
|
||||
SettingsTab::Daemon => daemon_tab(app, p, &kit, &mut layer, content),
|
||||
};
|
||||
|
||||
let body = col()
|
||||
@@ -295,15 +287,17 @@ pub fn view(app: &App, p: Paint) -> El {
|
||||
)
|
||||
.child(tabs(p, app))
|
||||
.child(
|
||||
col()
|
||||
.key("scroller")
|
||||
.w_full()
|
||||
.grow(1.0)
|
||||
.min_h(0.0)
|
||||
.scroll(rune::ScrollSpec {
|
||||
stick_bottom: false,
|
||||
})
|
||||
.child(content),
|
||||
app.scroll.follow(
|
||||
col()
|
||||
.key("scroller")
|
||||
.w_full()
|
||||
.grow(1.0)
|
||||
.min_h(0.0)
|
||||
.scroll(rune::ScrollSpec {
|
||||
stick_bottom: false,
|
||||
})
|
||||
.child(content),
|
||||
),
|
||||
)
|
||||
.child(save_footer(p, app));
|
||||
|
||||
@@ -323,71 +317,33 @@ fn save_label(app: &App) -> String {
|
||||
}
|
||||
|
||||
/// The last line: where settings are written and when they take effect.
|
||||
fn save_footer(p: Paint, app: &App) -> El {
|
||||
row()
|
||||
.key("footer")
|
||||
.w_full()
|
||||
.center_y()
|
||||
.justify_between()
|
||||
.child(
|
||||
text("Settings are stored by the record-daemon and survive its restart.")
|
||||
.key("footer-note")
|
||||
.font(body(11.5))
|
||||
.color(p.muted()),
|
||||
)
|
||||
.child(
|
||||
text(format!(
|
||||
"Log level: {} · encoder: {}",
|
||||
app.form.draft.daemon.log_level,
|
||||
if app.encoders.current.is_empty() {
|
||||
"auto"
|
||||
} else {
|
||||
&app.encoders.current
|
||||
},
|
||||
))
|
||||
.key("log-level-note")
|
||||
fn save_footer(p: Paint, _app: &App) -> El {
|
||||
row().key("footer").w_full().center_y().child(
|
||||
text("Settings are stored by the recorder and survive its restart.")
|
||||
.key("footer-note")
|
||||
.font(body(11.5))
|
||||
.color(p.muted()),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fn general(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, content: El) -> El {
|
||||
let d = &app.form.draft.daemon;
|
||||
fn general(_app: &App, p: Paint, _kit: &rune_kit::Kit, _layer: &mut Vec<El>, content: El) -> El {
|
||||
content
|
||||
.child(ui::card(
|
||||
p,
|
||||
Some("Recording"),
|
||||
vec![
|
||||
ui::toggle_row(
|
||||
p,
|
||||
"auto-record",
|
||||
"Start recording automatically",
|
||||
d.auto_record,
|
||||
|app: &mut App| {
|
||||
app.form.draft.daemon.auto_record ^= true;
|
||||
app.form.dirty = true;
|
||||
},
|
||||
),
|
||||
ui::toggle_row(
|
||||
p,
|
||||
"monitor-client",
|
||||
"Watch for the League Client",
|
||||
d.monitor_client,
|
||||
|app: &mut App| {
|
||||
app.form.draft.daemon.monitor_client ^= true;
|
||||
app.form.dirty = true;
|
||||
},
|
||||
),
|
||||
ui::toggle_row(
|
||||
p,
|
||||
"save-timeline",
|
||||
"Keep the event timeline",
|
||||
d.save_timeline,
|
||||
|app: &mut App| {
|
||||
app.form.draft.daemon.save_timeline ^= true;
|
||||
app.form.dirty = true;
|
||||
},
|
||||
),
|
||||
text("Recording starts by itself when a game begins and stops when the game ends.")
|
||||
.key("auto-note")
|
||||
.font(body(12.5))
|
||||
.color(p.muted())
|
||||
.px(space::S3)
|
||||
.py(space::S3),
|
||||
text("A finished game shows up in the match history on its own.")
|
||||
.key("history-note")
|
||||
.font(body(12.5))
|
||||
.color(p.muted())
|
||||
.px(space::S3)
|
||||
.pb(space::S3),
|
||||
],
|
||||
))
|
||||
.child(ui::card(
|
||||
@@ -396,8 +352,8 @@ fn general(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, conten
|
||||
vec![ui::toggle_row(
|
||||
p,
|
||||
"autostart",
|
||||
"Launch at login",
|
||||
app.autostart,
|
||||
"Launch League Recorder at startup",
|
||||
_app.autostart,
|
||||
|app: &mut App| {
|
||||
let next = !app.autostart;
|
||||
match crate::os::set_autostart(next) {
|
||||
@@ -414,35 +370,9 @@ fn general(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, conten
|
||||
},
|
||||
)],
|
||||
))
|
||||
.child(ui::card(
|
||||
p,
|
||||
Some("League Client"),
|
||||
vec![
|
||||
text_row(
|
||||
p,
|
||||
kit,
|
||||
"poll-interval",
|
||||
"Client poll interval",
|
||||
"How often the daemon checks the League Client, in milliseconds",
|
||||
&app.form.poll_interval,
|
||||
|app| &mut app.form.poll_interval,
|
||||
),
|
||||
select_row(
|
||||
p,
|
||||
kit,
|
||||
layer,
|
||||
"log-level",
|
||||
"Log level",
|
||||
"How much the daemon writes to its log",
|
||||
&LOG_LEVELS,
|
||||
Some(d.log_level.clone()),
|
||||
app,
|
||||
),
|
||||
],
|
||||
))
|
||||
.child(
|
||||
row()
|
||||
.key("general-danger")
|
||||
.key("general-actions")
|
||||
.gap(8.0)
|
||||
.center_y()
|
||||
.child(ui::button(
|
||||
@@ -465,7 +395,6 @@ fn general(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, conten
|
||||
)),
|
||||
)
|
||||
}
|
||||
|
||||
fn recording(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, content: El) -> El {
|
||||
let v = &app.form.draft.video;
|
||||
let o = &app.form.draft.output;
|
||||
@@ -496,7 +425,7 @@ fn recording(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, cont
|
||||
"Encoder",
|
||||
"Hardware encoding is faster; x264 uses the CPU",
|
||||
&ENCODERS,
|
||||
Some(encoder_label(&v.encoder_preset).to_string()),
|
||||
Some(v.encoder_preset.label().to_string()),
|
||||
app,
|
||||
),
|
||||
select_row(
|
||||
@@ -937,7 +866,7 @@ fn audio(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, content:
|
||||
))
|
||||
}
|
||||
|
||||
fn daemon_tab(app: &App, p: Paint, content: El) -> El {
|
||||
fn daemon_tab(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, content: El) -> El {
|
||||
let status_row = |key: &str, label: &'static str, value: String| {
|
||||
row()
|
||||
.key(key)
|
||||
@@ -991,6 +920,32 @@ fn daemon_tab(app: &App, p: Paint, content: El) -> El {
|
||||
status_row("daemon-log", "Log file", crate::daemon::log_path()),
|
||||
],
|
||||
))
|
||||
.child(ui::card(
|
||||
p,
|
||||
Some("Recorder"),
|
||||
vec![
|
||||
text_row(
|
||||
p,
|
||||
kit,
|
||||
"poll-interval",
|
||||
"Client poll interval",
|
||||
"How often the recorder checks the League Client, in milliseconds",
|
||||
&app.form.poll_interval,
|
||||
|app| &mut app.form.poll_interval,
|
||||
),
|
||||
select_row(
|
||||
p,
|
||||
kit,
|
||||
layer,
|
||||
"log-level",
|
||||
"Log level",
|
||||
"How much the recorder writes to its log",
|
||||
&LOG_LEVELS,
|
||||
Some(app.form.draft.daemon.log_level.clone()),
|
||||
app,
|
||||
),
|
||||
],
|
||||
))
|
||||
.child(
|
||||
row()
|
||||
.key("daemon-actions")
|
||||
|
||||
Reference in new issue
Block a user