Files
qbz/crates/qbz-qt/qml/controls/QualityMini.qml
T
vicrodh 71c2356f7b feat(qbz-qt): port the quality badge 1:1 from the Tauri original
The port had reinvented this badge: an icon-only replica with no MP3 tier, no
full or compact form, and none of the playback states. QualityBadge.svelte and
QualityBadgeStatic.svelte in the archived Tauri tree are the reference, and
every number here comes from their CSS.

Four modes, the union of both originals: full (the 136x36 pill with tier row
and bit-rate), compact (the narrow-bar "24/96" form from issue #303), bare
(full's content without the pill chrome, for toolbars) and iconOnly (the
Hi-Res brand mark alone, or a framed 30px square for CD/MP3 so both line up in
a grid). Tier resolution follows the original's order, MP3 first so it can
never come out as CD.

The four playback states come with it: system resampling, ALSA plughw
fallback, deliberate quality adjustment and confirmed bit-perfect, each with
its own border hue and indicator glyph, plus the rich hover tooltip carrying
source, output, the reason and the fix. Rows that only advertise stored
quality leave the flags false, which is exactly what QualityBadgeStatic was.

QualityMini becomes an alias over iconOnly mode rather than a second drawing
of the same thing, so the six existing call sites keep working while there is
one badge again.

Brings the assets the port was missing: cd.svg, mp3.svg and the LINE Seed JP
face the badge is set in. Their tint is baked to #b3b3b3 because Tauri applied
it with a CSS filter and QML has none on the software path. Adds theme.alphaTier(pct)
so the badge names the alpha ramp the design specifies instead of a raw index.

build.rs now collects the whole asset tree recursively — the hand-written root
list meant a new asset compiled clean and failed at runtime with "Cannot open".

18/18 tests; offscreen smoke clean.

cc
2026-07-28 12:49:50 -06:00

20 lines
825 B
QML

// QualityMini — the icon-only quality mark used on cards and track rows.
//
// Now a thin alias over QualityBadge's "iconOnly" mode instead of its own
// drawing. The port had grown two divergent takes on the same badge; the
// Tauri original (QualityBadgeStatic's iconOnly branch) is the reference for
// both, and it also brings the MP3 tier this replica never had.
//
// Keeping the `tier` API means the existing call sites did not have to change
// in the same commit. Prefer passing bitDepth / samplingRate / format when a
// row carries the raw numbers, and let the badge resolve the tier itself.
import QtQuick
QualityBadge {
id: qualityMiniRoot
property alias tier: qualityMiniRoot.tierOverride
mode: "iconOnly"
visible: tierOverride !== "" || bitDepth > 0 || samplingRate > 0 || format !== ""
}