From 3118abb4a1e02b469c44ffff42955daeab1e2d18 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 20 Jul 2026 15:25:58 -0600 Subject: [PATCH] feat(ui): per-renderer quality cap row in the cast picker (#638) CastState gains the fix-4 cap-row surface (device-cap-available/-key/ -options/-index + global-quality-label) and CastActions the set-device-quality-cap(cap-key, index) callback - property/callback additions to existing globals only, no app.slint export change. The connected panel gets one label-left / QbzSelect-trailing row per the flyout alignment rule (explicit menu-width, popup wider for the long option labels, no pills), visible only when the renderer has a stable identity, plus the muted caption that is the literal answer to #638: Qobuz sells four discrete tiers, there is no 48 kHz option. The quality-line suffix property now also names the cap at work (cause 3, 'capped for this device') when no over-cap disclosure takes precedence. Copy discipline throughout: the cap is the user's own quality/bandwidth choice - never an implied device incapability (renderers accept ~anything and downsample internally). i18n: 8 new msgids in ALL EIGHT locales (en identity-translated), including the cause-3 tooltip line AudioStamp pre-wired in fix 1. Unit style matched per catalog (ru Cyrillic units, nl decimal comma). Validated with the slintcheck stub (full tree + all catalogs). cc --- .../translations/de/LC_MESSAGES/qbz-ui.po | 24 +++++++ .../translations/en/LC_MESSAGES/qbz-ui.po | 24 +++++++ .../translations/es/LC_MESSAGES/qbz-ui.po | 24 +++++++ .../translations/fr/LC_MESSAGES/qbz-ui.po | 24 +++++++ .../translations/ja/LC_MESSAGES/qbz-ui.po | 24 +++++++ .../translations/nl/LC_MESSAGES/qbz-ui.po | 24 +++++++ .../translations/pt/LC_MESSAGES/qbz-ui.po | 24 +++++++ .../translations/ru/LC_MESSAGES/qbz-ui.po | 24 +++++++ crates/qbz-ui/ui/shell/CastPicker.slint | 62 +++++++++++++++---- crates/qbz-ui/ui/state.slint | 17 +++++ 10 files changed, 260 insertions(+), 11 deletions(-) diff --git a/crates/qbz-ui/translations/de/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/de/LC_MESSAGES/qbz-ui.po index b9c0091ea..86b69a41f 100644 --- a/crates/qbz-ui/translations/de/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/de/LC_MESSAGES/qbz-ui.po @@ -4714,3 +4714,27 @@ msgstr "Die genauen Limits Ihres Geräts konnten auf diesem System nicht ausgele msgid "Detected device limit" msgstr "Erkanntes Gerätelimit" + +msgid "Quality for this device" +msgstr "Qualität für dieses Gerät" + +msgid "Follow app setting ({})" +msgstr "App-Einstellung folgen ({})" + +msgid "Hi-Res — 24-bit, up to 96 kHz" +msgstr "Hi-Res — 24-bit, bis zu 96 kHz" + +msgid "CD — 16-bit / 44.1 kHz" +msgstr "CD — 16-bit / 44.1 kHz" + +msgid "MP3 320" +msgstr "MP3 320" + +msgid "Qobuz only offers these tiers — there is no 48 kHz option. The step below Hi-Res is CD 44.1 kHz." +msgstr "Qobuz bietet nur diese Stufen an — eine 48-kHz-Option gibt es nicht. Die Stufe unter Hi-Res ist CD 44.1 kHz." + +msgid "Limited by the quality cap for this device" +msgstr "Begrenzt durch das Qualitätslimit für dieses Gerät" + +msgid "capped for this device" +msgstr "für dieses Gerät begrenzt" diff --git a/crates/qbz-ui/translations/en/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/en/LC_MESSAGES/qbz-ui.po index 1ed197aa0..08f28f523 100644 --- a/crates/qbz-ui/translations/en/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/en/LC_MESSAGES/qbz-ui.po @@ -519,3 +519,27 @@ msgstr "Your device's exact limits could not be read on this system, so a common msgid "Detected device limit" msgstr "Detected device limit" + +msgid "Quality for this device" +msgstr "Quality for this device" + +msgid "Follow app setting ({})" +msgstr "Follow app setting ({})" + +msgid "Hi-Res — 24-bit, up to 96 kHz" +msgstr "Hi-Res — 24-bit, up to 96 kHz" + +msgid "CD — 16-bit / 44.1 kHz" +msgstr "CD — 16-bit / 44.1 kHz" + +msgid "MP3 320" +msgstr "MP3 320" + +msgid "Qobuz only offers these tiers — there is no 48 kHz option. The step below Hi-Res is CD 44.1 kHz." +msgstr "Qobuz only offers these tiers — there is no 48 kHz option. The step below Hi-Res is CD 44.1 kHz." + +msgid "Limited by the quality cap for this device" +msgstr "Limited by the quality cap for this device" + +msgid "capped for this device" +msgstr "capped for this device" diff --git a/crates/qbz-ui/translations/es/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/es/LC_MESSAGES/qbz-ui.po index c8b8a262b..a20a472fe 100644 --- a/crates/qbz-ui/translations/es/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/es/LC_MESSAGES/qbz-ui.po @@ -4744,3 +4744,27 @@ msgstr "No se pudieron leer los límites exactos de tu dispositivo en este siste msgid "Detected device limit" msgstr "Límite detectado del dispositivo" + +msgid "Quality for this device" +msgstr "Calidad para este dispositivo" + +msgid "Follow app setting ({})" +msgstr "Seguir el ajuste de la app ({})" + +msgid "Hi-Res — 24-bit, up to 96 kHz" +msgstr "Hi-Res — 24-bit, hasta 96 kHz" + +msgid "CD — 16-bit / 44.1 kHz" +msgstr "CD — 16-bit / 44.1 kHz" + +msgid "MP3 320" +msgstr "MP3 320" + +msgid "Qobuz only offers these tiers — there is no 48 kHz option. The step below Hi-Res is CD 44.1 kHz." +msgstr "Qobuz solo ofrece estos niveles — no existe una opción de 48 kHz. El paso debajo de Hi-Res es CD 44.1 kHz." + +msgid "Limited by the quality cap for this device" +msgstr "Limitado por el límite de calidad para este dispositivo" + +msgid "capped for this device" +msgstr "limitado para este dispositivo" diff --git a/crates/qbz-ui/translations/fr/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/fr/LC_MESSAGES/qbz-ui.po index 4c65b8464..cccd2b1ef 100644 --- a/crates/qbz-ui/translations/fr/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/fr/LC_MESSAGES/qbz-ui.po @@ -4714,3 +4714,27 @@ msgstr "Les limites exactes de votre périphérique n'ont pas pu être lues sur msgid "Detected device limit" msgstr "Limite détectée du périphérique" + +msgid "Quality for this device" +msgstr "Qualité pour cet appareil" + +msgid "Follow app setting ({})" +msgstr "Suivre le réglage de l'app ({})" + +msgid "Hi-Res — 24-bit, up to 96 kHz" +msgstr "Hi-Res — 24-bit, jusqu'à 96 kHz" + +msgid "CD — 16-bit / 44.1 kHz" +msgstr "CD — 16-bit / 44.1 kHz" + +msgid "MP3 320" +msgstr "MP3 320" + +msgid "Qobuz only offers these tiers — there is no 48 kHz option. The step below Hi-Res is CD 44.1 kHz." +msgstr "Qobuz ne propose que ces paliers — il n'existe pas d'option 48 kHz. Le palier sous Hi-Res est CD 44.1 kHz." + +msgid "Limited by the quality cap for this device" +msgstr "Limité par le plafond de qualité pour cet appareil" + +msgid "capped for this device" +msgstr "plafonné pour cet appareil" diff --git a/crates/qbz-ui/translations/ja/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/ja/LC_MESSAGES/qbz-ui.po index 20bea68ce..ea8e77ee6 100644 --- a/crates/qbz-ui/translations/ja/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/ja/LC_MESSAGES/qbz-ui.po @@ -4702,3 +4702,27 @@ msgstr "このシステムではデバイスの正確な上限を読み取れな msgid "Detected device limit" msgstr "検出されたデバイスの上限" + +msgid "Quality for this device" +msgstr "このデバイスの音質" + +msgid "Follow app setting ({})" +msgstr "アプリの設定に従う({})" + +msgid "Hi-Res — 24-bit, up to 96 kHz" +msgstr "Hi-Res — 24-bit、最大96 kHz" + +msgid "CD — 16-bit / 44.1 kHz" +msgstr "CD — 16-bit / 44.1 kHz" + +msgid "MP3 320" +msgstr "MP3 320" + +msgid "Qobuz only offers these tiers — there is no 48 kHz option. The step below Hi-Res is CD 44.1 kHz." +msgstr "Qobuzが提供するのはこれらの段階のみで、48 kHzのオプションはありません。Hi-Resの一つ下はCD 44.1 kHzです。" + +msgid "Limited by the quality cap for this device" +msgstr "このデバイスの音質上限により制限されています" + +msgid "capped for this device" +msgstr "このデバイス向けに上限適用中" diff --git a/crates/qbz-ui/translations/nl/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/nl/LC_MESSAGES/qbz-ui.po index d9593b5b7..a41e34005 100644 --- a/crates/qbz-ui/translations/nl/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/nl/LC_MESSAGES/qbz-ui.po @@ -4726,3 +4726,27 @@ msgstr "De exacte limieten van je apparaat konden op dit systeem niet worden uit msgid "Detected device limit" msgstr "Gedetecteerde apparaatlimiet" + +msgid "Quality for this device" +msgstr "Kwaliteit voor dit apparaat" + +msgid "Follow app setting ({})" +msgstr "App-instelling volgen ({})" + +msgid "Hi-Res — 24-bit, up to 96 kHz" +msgstr "Hi-Res — 24-bit, tot 96 kHz" + +msgid "CD — 16-bit / 44.1 kHz" +msgstr "CD — 16-bit / 44,1 kHz" + +msgid "MP3 320" +msgstr "MP3 320" + +msgid "Qobuz only offers these tiers — there is no 48 kHz option. The step below Hi-Res is CD 44.1 kHz." +msgstr "Qobuz biedt alleen deze niveaus — er is geen 48 kHz-optie. De stap onder Hi-Res is CD 44,1 kHz." + +msgid "Limited by the quality cap for this device" +msgstr "Beperkt door de kwaliteitslimiet voor dit apparaat" + +msgid "capped for this device" +msgstr "begrensd voor dit apparaat" diff --git a/crates/qbz-ui/translations/pt/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/pt/LC_MESSAGES/qbz-ui.po index 119770d98..f4cece7f5 100644 --- a/crates/qbz-ui/translations/pt/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/pt/LC_MESSAGES/qbz-ui.po @@ -4714,3 +4714,27 @@ msgstr "Não foi possível ler os limites exatos do seu dispositivo neste sistem msgid "Detected device limit" msgstr "Limite detetado do dispositivo" + +msgid "Quality for this device" +msgstr "Qualidade para este dispositivo" + +msgid "Follow app setting ({})" +msgstr "Seguir a definição da app ({})" + +msgid "Hi-Res — 24-bit, up to 96 kHz" +msgstr "Hi-Res — 24-bit, até 96 kHz" + +msgid "CD — 16-bit / 44.1 kHz" +msgstr "CD — 16-bit / 44.1 kHz" + +msgid "MP3 320" +msgstr "MP3 320" + +msgid "Qobuz only offers these tiers — there is no 48 kHz option. The step below Hi-Res is CD 44.1 kHz." +msgstr "A Qobuz só oferece estes níveis — não há opção de 48 kHz. O nível abaixo de Hi-Res é CD 44.1 kHz." + +msgid "Limited by the quality cap for this device" +msgstr "Limitado pelo limite de qualidade para este dispositivo" + +msgid "capped for this device" +msgstr "limitado para este dispositivo" diff --git a/crates/qbz-ui/translations/ru/LC_MESSAGES/qbz-ui.po b/crates/qbz-ui/translations/ru/LC_MESSAGES/qbz-ui.po index 2255f3a53..04b65d88f 100644 --- a/crates/qbz-ui/translations/ru/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-ui/translations/ru/LC_MESSAGES/qbz-ui.po @@ -4728,3 +4728,27 @@ msgstr "Не удалось прочитать точные пределы ва msgid "Detected device limit" msgstr "Обнаруженный предел устройства" + +msgid "Quality for this device" +msgstr "Качество для этого устройства" + +msgid "Follow app setting ({})" +msgstr "Следовать настройке приложения ({})" + +msgid "Hi-Res — 24-bit, up to 96 kHz" +msgstr "Hi-Res — 24 бит, до 96 кГц" + +msgid "CD — 16-bit / 44.1 kHz" +msgstr "CD — 16 бит / 44.1 кГц" + +msgid "MP3 320" +msgstr "MP3 320" + +msgid "Qobuz only offers these tiers — there is no 48 kHz option. The step below Hi-Res is CD 44.1 kHz." +msgstr "Qobuz предлагает только эти уровни — варианта 48 кГц нет. Ступень ниже Hi-Res — CD 44.1 кГц." + +msgid "Limited by the quality cap for this device" +msgstr "Ограничено пределом качества для этого устройства" + +msgid "capped for this device" +msgstr "ограничено для этого устройства" diff --git a/crates/qbz-ui/ui/shell/CastPicker.slint b/crates/qbz-ui/ui/shell/CastPicker.slint index ee98986b6..d32d3a5de 100644 --- a/crates/qbz-ui/ui/shell/CastPicker.slint +++ b/crates/qbz-ui/ui/shell/CastPicker.slint @@ -10,6 +10,7 @@ import { Typography } from "../foundation/typography.slint"; import { Radius } from "../foundation/radius.slint"; import { CastState, CastActions } from "../state.slint"; import { QbzIcon } from "../primitives/QbzIcon.slint"; +import { QbzSelect } from "../primitives/QbzSelect.slint"; // One discovered-device row. component CastDeviceRow inherits Rectangle { @@ -99,17 +100,21 @@ component CastTab inherits Rectangle { export component CastPicker inherits Rectangle { visible: CastState.picker-open; - // Over-cap disclosure suffix for the quality line (#638 fix 1): a - // locally-existing copy (cache / offline store) served above the - // requested tier — named plainly, never as an error (caps govern - // requests only; the bytes go out as-is, owner decision). - property over-cap-suffix: !CastState.quality-over-cap - ? "" - : (CastState.quality-origin == "offline" + // Quality-line suffix (#638). Over-cap wins: a locally-existing copy + // (cache / offline store) served above the requested tier — named + // plainly, never as an error (caps govern requests only; the bytes go + // out as-is, owner decision). Otherwise, when the per-renderer cap + // shaped the request (fix 4, cause 3), say so — the user's own choice, + // never an implied device limitation. + property quality-suffix: CastState.quality-over-cap + ? (CastState.quality-origin == "offline" ? " · " + @tr("offline copy — cap not applied") : (CastState.quality-origin == "cache" ? " · " + @tr("cached copy — cap not applied") - : "")); + : "")) + : (CastState.quality-limit-cause == 3 + ? " · " + @tr("capped for this device") + : ""); if CastState.picker-open: Rectangle { background: #000000bf; @@ -240,10 +245,45 @@ export component CastPicker inherits Rectangle { } // Delivered quality under the banner, when known — measured - // from the served bytes (#638 fix 1), plus the over-cap - // disclosure suffix when a local copy exceeds the cap. + // from the served bytes (#638 fix 1), plus the disclosure + // suffix (over-cap local copy, or the fix-4 cap at work). if CastState.connected && CastState.quality-detail != "": Text { - text: @tr("Streaming {} · {}", CastState.protocol == "dlna" ? "DLNA" : "Chromecast", CastState.quality-detail) + root.over-cap-suffix; + text: @tr("Streaming {} · {}", CastState.protocol == "dlna" ? "DLNA" : "Chromecast", CastState.quality-detail) + root.quality-suffix; + color: Theme.text-muted; + font-size: Typography.legal; + wrap: word-wrap; + } + + // Per-renderer quality cap (#638 fix 4) — a manual per-device + // choice of the tier QBZ REQUESTS when casting here, persisted + // per renderer id (hidden when the device has no stable + // identity). Label-left / control-trailing per the flyout rule; + // options come from Rust (reseeded on language change). + if CastState.connected && CastState.device-cap-available: HorizontalLayout { + spacing: 10px; + Text { + text: @tr("Quality for this device"); + color: Theme.text-primary; + font-size: Typography.body; + vertical-alignment: center; + horizontal-stretch: 1; + overflow: elide; + } + QbzSelect { + options: CastState.device-cap-options; + current-index: CastState.device-cap-index; + menu-width: 200px; + popup-width: 260px; + selected(index) => { + CastActions.set-device-quality-cap(CastState.device-cap-key, index); + } + } + } + + // The literal answer to #638: Qobuz sells four discrete + // tiers — there is no 48 kHz tier to offer. + if CastState.connected && CastState.device-cap-available: Text { + text: @tr("Qobuz only offers these tiers — there is no 48 kHz option. The step below Hi-Res is CD 44.1 kHz."); color: Theme.text-muted; font-size: Typography.legal; wrap: word-wrap; diff --git a/crates/qbz-ui/ui/state.slint b/crates/qbz-ui/ui/state.slint index bacca03af..0e8a93406 100644 --- a/crates/qbz-ui/ui/state.slint +++ b/crates/qbz-ui/ui/state.slint @@ -4580,6 +4580,20 @@ export global CastState { // (owner decision); the picker line discloses it instead of hiding it. in property quality-over-cap: false; in property quality-origin; // "cache" | "offline" | "" (network) + // Per-renderer manual quality cap (#638 fix 4) — the connected device's + // cap row in the picker. Only offered when the renderer has a STABLE + // identity (DLNA UDN always; Chromecast only when the mDNS TXT `id` + // record exists — a fullname-keyed cap would silently detach on + // rename). Options are pushed from Rust and reseeded on language + // change; option 0 embeds the live global streaming-quality label. The + // cap is the user's own quality/bandwidth choice — never a statement + // that the device cannot play the stream (renderers accept ~anything + // and downsample internally). + in property device-cap-available: false; + in property device-cap-key; // "dlna:" | "chromecast:" | "" + in property <[string]> device-cap-options: []; + in property device-cap-index: 0; // 0 follow · 1 hires · 2 cd · 3 mp3 + in property global-quality-label; // live Settings tier, e.g. "Hi-Res+" // Raw last-error for the picker error state (empty = none). in property error; } @@ -4590,6 +4604,9 @@ export global CastActions { callback refresh(); // re-arm discovery scan callback connect(string, string); // device-id, protocol callback disconnect(); + // Persist the manual quality cap for the connected renderer (#638 + // fix 4): cap-key, option index (0 = follow the app setting). + callback set-device-quality-cap(string, int); } // Single global hover-tooltip channel. Each hoverable control writes its text