Files
qbz/crates/qbz-slint/ui/primitives/WarningBanner.slint
T
vicrodh 9c5febdaa8 feat(slint): HiFi wizard check step — stack health, distro/init override, sandbox (Slice 6)
Wires the check step on top of the Slice-0/2/6 backend: a health verdict
(success/warning WarningBanner — new `success` variant), a per-missing-piece
CommandBlock with copy, and TWO overridable dropdowns — distro (package
manager) and init system (service commands), which are orthogonal so a Gentoo
box on systemd vs OpenRC gets the right restart command.

New `src/dac_wizard.rs` controller: open() runs the probe off-thread
(spawn_blocking → upgrade_in_event_loop), caches it, and recompute() rebuilds
remediations from the cached probe + the current distro/init selections.
Init-aware restart_cmd (systemd/OpenRC/runit/s6/dinit). NixOS special-cased to
a declarative configuration.nix block.

Sandbox honesty: in Flatpak/Snap the host probes are blind, so the check step
shows an info banner + reference setup commands (full stack incl. pipewire-alsa
+ restart) for the chosen distro/init instead of a false health verdict.

main.rs wires on_open/on_set_distro/on_set_init/on_copy_command; the Audio
settings trigger calls DacWizardActions.open().

cc
2026-06-15 21:04:23 -06:00

70 lines
2.5 KiB
Plaintext

// WarningBanner — a colored info / warning / error notice (HiFi wizard).
//
// variant ∈ {"info","warning","error"}; the tone drives the icon, the 10%
// alpha background and the 30% alpha border (matching the existing inline
// banners in PlaylistImportModal). Title + body both wrap; either can be "".
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { QbzIcon } from "QbzIcon.slint";
export component WarningBanner inherits Rectangle {
in property <string> title: "";
in property <string> body: "";
in property <string> variant: "warning"; // info | warning | error | success
property <color> tone: root.variant == "error" ? #ef4444
: (root.variant == "info" ? #3b82f6
: (root.variant == "success" ? #3fae6a : #eab308));
property <color> bg: root.variant == "error" ? #ef44441a
: (root.variant == "info" ? #3b82f61a
: (root.variant == "success" ? #3fae6a1a : #eab3081a));
property <color> brd: root.variant == "error" ? #ef44444d
: (root.variant == "info" ? #3b82f64d
: (root.variant == "success" ? #3fae6a4d : #eab3084d));
property <image> glyph: root.variant == "error"
? @image-url("../assets/icons/circle-alert.svg")
: (root.variant == "info"
? @image-url("../assets/icons/info.svg")
: (root.variant == "success"
? @image-url("../assets/icons/circle-check-big.svg")
: @image-url("../assets/icons/triangle-alert.svg")));
border-radius: 8px;
background: root.bg;
border-width: 1px;
border-color: root.brd;
height: row.preferred-height;
row := HorizontalLayout {
padding: 12px;
spacing: 10px;
VerticalLayout {
alignment: start;
QbzIcon {
source: root.glyph;
width: 16px;
height: 16px;
tint: root.tone;
}
}
VerticalLayout {
spacing: 3px;
horizontal-stretch: 1;
if root.title != "": Text {
text: root.title;
color: root.tone;
font-size: Typography.legal;
font-weight: Typography.semibold;
wrap: word-wrap;
}
if root.body != "": Text {
text: root.body;
color: Theme.text-secondary;
font-size: Typography.legal;
wrap: word-wrap;
}
}
}
}