app: draw champion portraits, a 16:9 player and draggable scroll bars
Cards and the review header showed two initials where a champion portrait belongs. Data Dragon is fetched from a worker thread and cached under the user's cache directory, so the first sight of a champion puts its face on the card and later runs read it from disk; offline, the tile keeps its initials on the champion's colour. The review screen put the clip in a small box above two list columns. The clip now fills the window at 16:9 and the highlights and timeline open beside it on demand, so nothing shrinks the video by default and every event still marks the scrubber. Scroll bars were a thumb drawn over the cards that could not be dragged. They now sit in a strip the content leaves free, stay visible while the list overflows, and scroll the viewport when dragged.
This commit is contained in:
1 parent
3d0cad3312
commit
227aecb8f6
10 files changed
+500
-181
No files matched your search
+29
-7
@@ -9,6 +9,7 @@ use rune::{Cx, El, Key, KeyEvent, Tx, col, el, row, text};
|
||||
use crate::history::{self, QueueCategory, Timeline};
|
||||
use crate::ipc::{self, Daemon};
|
||||
use crate::os;
|
||||
use crate::portraits;
|
||||
use crate::screens;
|
||||
use crate::settings::{AudioSource, AudioSourceType, Settings};
|
||||
use crate::ui::{self, Paint, body, heading};
|
||||
@@ -114,6 +115,7 @@ pub struct App {
|
||||
pub games_loaded: bool,
|
||||
pub filter: Option<QueueCategory>,
|
||||
pub review: screens::review::Review,
|
||||
pub portraits: Option<portraits::Portraits>,
|
||||
pub scroll: ui::ScrollBar,
|
||||
pub highlights_scroll: ui::ScrollBar,
|
||||
pub events_scroll: ui::ScrollBar,
|
||||
@@ -150,6 +152,7 @@ impl App {
|
||||
games_loaded: false,
|
||||
filter: None,
|
||||
review: screens::review::Review::default(),
|
||||
portraits: None,
|
||||
scroll: ui::ScrollBar::new(),
|
||||
highlights_scroll: ui::ScrollBar::new(),
|
||||
events_scroll: ui::ScrollBar::new(),
|
||||
@@ -303,6 +306,7 @@ fn hide_window() {
|
||||
/// `AppSpec::setup`: keep the waker and put the tray icon up.
|
||||
pub fn setup(app: &mut App, waker: rune::Waker) {
|
||||
app.waker = Some(waker.clone());
|
||||
app.portraits = Some(portraits::Portraits::new(waker.clone()));
|
||||
app.daemon.set_waker(waker.clone());
|
||||
app.refresh_settings();
|
||||
app.refresh_games();
|
||||
@@ -698,7 +702,7 @@ pub fn view(app: &App, cx: &mut Cx<App>) -> El {
|
||||
main = main.child(notice(p, banner));
|
||||
}
|
||||
main = main.child(content);
|
||||
let mut window = col()
|
||||
let window = col()
|
||||
.key("window")
|
||||
.w_full()
|
||||
.h_full()
|
||||
@@ -706,13 +710,23 @@ pub fn view(app: &App, cx: &mut Cx<App>) -> El {
|
||||
.child(titlebar(p, app))
|
||||
.child(main)
|
||||
.child(statusbar(p, app));
|
||||
window = match app.screen {
|
||||
match app.screen {
|
||||
Screen::Review => window
|
||||
.child(app.highlights_scroll.thumb(p, "highlights-thumb"))
|
||||
.child(app.events_scroll.thumb(p, "events-thumb")),
|
||||
_ => window.child(app.scroll.thumb(p, "scroll-thumb")),
|
||||
};
|
||||
window
|
||||
.child(
|
||||
app.highlights_scroll
|
||||
.thumb(p, "highlights-thumb", "highlight-scroller"),
|
||||
)
|
||||
.child(app.events_scroll.thumb(p, "events-thumb", "event-scroller")),
|
||||
_ => window.child(app.scroll.thumb(
|
||||
p,
|
||||
"scroll-thumb",
|
||||
if app.screen == Screen::Settings {
|
||||
"scroller"
|
||||
} else {
|
||||
"list-scroller"
|
||||
},
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether this is a headless run (`--snap out.png`, `--tree`, …) rather than a window.
|
||||
@@ -753,6 +767,14 @@ pub fn demo_review(app: &mut App) {
|
||||
}
|
||||
app.review.game = app.games.first().map(|game| game.recording_id.clone());
|
||||
app.review.error = Some("Sample recording: no clip on disk.".to_string());
|
||||
// Snapshot hook: draw a real clip when one is handed in.
|
||||
if let Ok(path) = std::env::var("LR_DEMO_VIDEO") {
|
||||
let player = rune::Player::file(&path);
|
||||
player.set_looping(false);
|
||||
app.review.player = Some(player);
|
||||
app.review.error = None;
|
||||
}
|
||||
|
||||
if let Some(game) = app.games.first() {
|
||||
app.review.highlights =
|
||||
crate::highlight::compute(game, game.summoner().as_deref(), Default::default());
|
||||
|
||||
Reference in new issue
Block a user