gui: show ~/ for home paths, simpler Unfiltered rows, centred settings column
This commit is contained in:
1 parent
736c12bb1e
commit
29eb48cf63
3 files changed
+11
-11
No files matched your search
@@ -70,7 +70,7 @@ impl App {
|
||||
source: data::source_label(e.source).into(), kind: data::kind_label(e.kind).into(),
|
||||
installed: e.installed, pinned: self.state.borrow().is_pinned(&e.id),
|
||||
cover: keep.map(|g| g.cover.clone()).unwrap_or_default(), has_cover: keep.map_or(false, |g| g.has_cover),
|
||||
c1: rgb(c1), c2: rgb(c2), reasons: e.reasons.join(" · ").into(), action: action.into(),
|
||||
c1: rgb(c1), c2: rgb(c2), reasons: short(&e.reasons.join(" · ")).into(), action: action.into(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,10 +187,10 @@ impl App {
|
||||
launch::Plan::Run(_) => ("PLAY", true, "Summit starts it, applies the launch profile and tracks the session.".to_string()),
|
||||
launch::Plan::Unsupported(why) => ("PLAY", false, format!("Summit cannot start this yet: {why}.")),
|
||||
};
|
||||
let reasons: Vec<SharedString> = e.reasons.iter().map(|r| r.as_str().into()).collect();
|
||||
let reasons: Vec<SharedString> = e.reasons.iter().map(|r| short(r).into()).collect();
|
||||
self.ui.global::<Lib>().set_detail(Detail {
|
||||
idx, sessions: sessions.into(), sessions_note: note.into(), reasons: ModelRc::new(VecModel::from(reasons)),
|
||||
path: e.path.clone().unwrap_or_default().into(),
|
||||
path: short(&e.path.clone().unwrap_or_default()).into(),
|
||||
monitor: p.monitor.into(), mode: p.mode.into(), upscaler: p.upscaler.into(), framegen: p.framegen.into(), window: p.window.into(), profile_set: p.set,
|
||||
play_label: label.into(), play_note: play_note.into(), can_play: can,
|
||||
});
|
||||
@@ -327,9 +327,10 @@ impl App {
|
||||
fn nearest(all: &[f32], v: f32) -> usize {
|
||||
(0..all.len()).min_by(|a, b| (all[*a] - v).abs().total_cmp(&(all[*b] - v).abs())).unwrap_or(0)
|
||||
}
|
||||
fn tilde(p: &std::path::Path) -> String {
|
||||
let s = p.to_string_lossy().into_owned();
|
||||
match std::env::var("HOME") { Ok(h) if !h.is_empty() && s.starts_with(&h) => format!("~{}", &s[h.len()..]), _ => s }
|
||||
fn tilde(p: &std::path::Path) -> String { short(&p.to_string_lossy()) }
|
||||
/// Paths under the home folder read better as ~/...; detection reasons are full of them.
|
||||
fn short(text: &str) -> String {
|
||||
match std::env::var("HOME") { Ok(h) if h.len() > 1 => text.replace(&format!("{h}/"), "~/"), _ => text.to_string() }
|
||||
}
|
||||
|
||||
/// Look a name up in a list ("grid", "violet") or take a number.
|
||||
|
||||
@@ -249,10 +249,9 @@ export component UnfilteredView inherits Rectangle {
|
||||
border-width: focused ? 2px : 0px; border-color: Theme.p.focus;
|
||||
animate background { duration: Theme.ms(120); }
|
||||
Rectangle { x: 12px; y: 14px; width: 4px; height: 24px; border-radius: 2px; background: g.c1; }
|
||||
Text { x: 28px; y: 8px; width: parent.width - 28px - 220px; text: g.title; color: Theme.p.text; font-size: Theme.t-md - 1px; font-weight: 600; overflow: elide; }
|
||||
Text { x: 28px; y: 29px; width: parent.width - 28px - 220px; text: g.reasons; color: Theme.p.dim; font-size: Theme.t-sm - 1px; overflow: elide; }
|
||||
Text { x: parent.width - 200px; width: 100px; height: parent.height; horizontal-alignment: right; vertical-alignment: center; text: g.hours-short == "" ? "Not played" : g.hours-short; color: g.hours-short == "" ? Theme.p.faint : Theme.p.text; font-size: Theme.t-sm; font-weight: 600; }
|
||||
Text { x: parent.width - 84px; width: 72px; height: parent.height; horizontal-alignment: right; vertical-alignment: center; text: g.kind; color: Theme.p.faint; font-size: Theme.t-xs; font-weight: 700; letter-spacing: 0.8px; }
|
||||
Text { x: 28px; y: 8px; width: parent.width - 28px - 160px; text: g.title; color: Theme.p.text; font-size: Theme.t-md - 1px; font-weight: 600; overflow: elide; }
|
||||
Text { x: 28px; y: 29px; width: parent.width - 28px - 160px; text: g.reasons; color: Theme.p.dim; font-size: Theme.t-sm - 1px; overflow: elide; }
|
||||
Text { x: parent.width - 132px; width: 116px; height: parent.height; horizontal-alignment: right; vertical-alignment: center; text: g.hours-short == "" ? "Not played" : g.hours-short; color: g.hours-short == "" ? Theme.p.faint : Theme.p.text; font-size: Theme.t-sm; font-weight: 600; }
|
||||
ta := TouchArea { mouse-cursor: pointer; clicked => { if (root.sel == i) { Lib.open-detail(r.idx); } else { root.sel = i; } } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export component SettingsView inherits Rectangle {
|
||||
in-out property <int> srow: 0;
|
||||
callback exit-up();
|
||||
property <length> cw: Math.min(root.width - 2 * Theme.pad, 1040px);
|
||||
property <length> cx: Theme.pad;
|
||||
property <length> cx: Math.max(Theme.pad, (root.width - root.cw) / 2);
|
||||
pure function ry(i: int) -> length {
|
||||
return i == 0 ? 136px : i == 1 ? 216px : i == 2 ? 384px : i == 3 ? 520px : i == 4 ? 600px : i == 5 ? 736px : i == 6 ? 816px : i == 7 ? 952px : 1032px;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user