From c03e3578060666ecba88ceb464ad2132739568cc Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Thu, 5 Nov 2026 13:42:33 +0100 Subject: [PATCH] Add standalone download to login --- src/menu.rs | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/menu.rs b/src/menu.rs index 927ae1e..9262c69 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -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; - 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)); + 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); }