Add standalone download to login

This commit is contained in:
Richard Zink committed 2026-11-05 13:42:33 +01:00
1 parent d325843a1a
commit c03e357806
1 file changed
+19 -4
+19 -4
View File
@@ -1496,12 +1496,17 @@ impl Menu {
gfx.text(title, grid_center(sw, gfx.measure(title, big)) + big, ty + big, big, Color::new(0.0, 0.0, 0.0, 0.8));
gfx.text(title, grid_center(sw, gfx.measure(title, big)), ty, big, FRAME_HI);
let cols = ((sw / CW()) as i32 - 2).min(50);
let rows = 13;
let x = grid_center(sw, cols as f32 * CW()).max(0.0);
let y = ty + GH * big + CH() * 3.0;
let w = (cols - 6) as f32 * CW();
let label = tr(if cloud.setup { "login.create_admin" } else { "login.button" });
let standalone_label = tr("menu.standalone");
let bw = gfx.measure(&label, S()) + CW() * 6.0;
let standalone_bw = (gfx.measure(&standalone_label, S()) + CW() * 4.0).min(w);
let side_by_side = standalone_bw + bw + CW() * 1.5 <= w;
let rows = if side_by_side { 13 } else { 15 };
let head = tr(if cloud.setup { "login.setup" } else { "login.title" });
gfx.window_titled(x, y, cols, rows, S(), true, FRAME_HI, Color::new(0.05, 0.03, 0.04, 0.97), &head, FRAME_HI);
let w = (cols - 6) as f32 * CW();
if cloud.setup {
gfx.text(&tr("login.setup_hint"), x + CW() * 3.0, y + CH() * 1.5, SMALL(), DIM);
}
@@ -1513,11 +1518,21 @@ impl Menu {
gfx.text(l, x + CW() * 3.0, y + CH() * 7.9 + k as f32 * GH * SMALL() * 1.2, SMALL(), Color::new(0.95, 0.4, 0.35, 1.0));
}
}
let label = tr(if cloud.setup { "login.create_admin" } else { "login.button" });
let bw = gfx.measure(&label, S()) + CW() * 6.0;
if side_by_side {
let sr = Rect::new(x + CW() * 3.0, y + CH() * 9.5, standalone_bw, CH() * 2.0);
button(gfx, sr, &standalone_label, sr.contains(vec2(mx, my)) && !cloud.busy(), FRAME);
self.buttons.push((sr, Btn::Standalone));
let br = Rect::new(x + cols as f32 * CW() - bw - CW() * 3.0, y + CH() * 9.5, bw, CH() * 2.0);
button(gfx, br, &label, br.contains(vec2(mx, my)) && !cloud.busy(), FRAME_HI);
self.buttons.push((br, Btn::DoLogin));
} else {
let sr = Rect::new(x + CW() * 3.0, y + CH() * 9.5, w, CH() * 2.0);
button(gfx, sr, &standalone_label, sr.contains(vec2(mx, my)) && !cloud.busy(), FRAME);
self.buttons.push((sr, Btn::Standalone));
let br = Rect::new(x + cols as f32 * CW() - bw - CW() * 3.0, y + CH() * 12.5, bw, CH() * 2.0);
button(gfx, br, &label, br.contains(vec2(mx, my)) && !cloud.busy(), FRAME_HI);
self.buttons.push((br, Btn::DoLogin));
}
self.draw_license(gfx);
}