From cca779924d95c90cb8c0a14bf86069574d291fec Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 14 Sep 2026 13:08:37 -0600 Subject: [PATCH] feat(qt): the Wallpaper background's blur is the user's to set The Wallpaper background blurred the desktop behind the window by a fixed 0.75. Its options box in Settings > Appearance now has a Wallpaper blur slider, shown for that mode only, from 0 % to 100 %: Qt's documented range for MultiEffect.blur, 0.0 (no blur) to 1.0 (full blur), at the field's blurMax of 64. The default stays 0.75, the look the mode shipped with. Dragging moves the live background through QbzShell.wallpaperBlur; the value is written to ui_prefs once, on release (the slider's `released`), as a two-decimal number, and clamped to Qt's range on read. The Wallpaper, blurred mode keeps its fixed atmosphere look. The label and description are in all eight catalogs. cc --- .../translations/de/LC_MESSAGES/qbz-ui.po | 8 +++ .../translations/en/LC_MESSAGES/qbz-ui.po | 8 +++ .../translations/es/LC_MESSAGES/qbz-ui.po | 8 +++ .../translations/fr/LC_MESSAGES/qbz-ui.po | 8 +++ .../translations/ja/LC_MESSAGES/qbz-ui.po | 8 +++ .../translations/nl/LC_MESSAGES/qbz-ui.po | 8 +++ .../translations/pt/LC_MESSAGES/qbz-ui.po | 8 +++ .../translations/ru/LC_MESSAGES/qbz-ui.po | 8 +++ .../qml/settings/AppearanceSettings.qml | 29 ++++++++++ crates/qbz-qt/qml/shell/AppShell.qml | 4 +- crates/qbz-qt/src/settings_qt.rs | 55 +++++++++++++++++++ crates/qbz-qt/src/shell_bridge.rs | 6 ++ 12 files changed, 157 insertions(+), 1 deletion(-) diff --git a/crates/qbz-i18n/translations/de/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/de/LC_MESSAGES/qbz-ui.po index 9350ec72b..7b63a7d54 100644 --- a/crates/qbz-i18n/translations/de/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/de/LC_MESSAGES/qbz-ui.po @@ -7723,3 +7723,11 @@ msgstr "System-Hintergrundbild" #: crates/qbz-qt/qml/views/PlaylistView.qml msgid "{} tracks will be removed from this playlist." msgstr "{} Titel werden aus dieser Playlist entfernt." + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "Wallpaper blur" +msgstr "Unschärfe des Hintergrundbilds" + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "How much the wallpaper behind the window is blurred: 0% keeps it sharp, 100% is the strongest blur." +msgstr "Wie stark das Hintergrundbild hinter dem Fenster weichgezeichnet wird: 0 % lässt es scharf, 100 % ist die stärkste Unschärfe." diff --git a/crates/qbz-i18n/translations/en/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/en/LC_MESSAGES/qbz-ui.po index 89d4a7dfb..4a98d92cb 100644 --- a/crates/qbz-i18n/translations/en/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/en/LC_MESSAGES/qbz-ui.po @@ -3378,3 +3378,11 @@ msgstr "System wallpaper" #: crates/qbz-qt/qml/views/PlaylistView.qml msgid "{} tracks will be removed from this playlist." msgstr "{} tracks will be removed from this playlist." + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "Wallpaper blur" +msgstr "Wallpaper blur" + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "How much the wallpaper behind the window is blurred: 0% keeps it sharp, 100% is the strongest blur." +msgstr "How much the wallpaper behind the window is blurred: 0% keeps it sharp, 100% is the strongest blur." diff --git a/crates/qbz-i18n/translations/es/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/es/LC_MESSAGES/qbz-ui.po index 71487a0ae..42d63a1ba 100644 --- a/crates/qbz-i18n/translations/es/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/es/LC_MESSAGES/qbz-ui.po @@ -7729,3 +7729,11 @@ msgstr "Fondo del sistema" #: crates/qbz-qt/qml/views/PlaylistView.qml msgid "{} tracks will be removed from this playlist." msgstr "Se quitarán {} pistas de esta playlist." + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "Wallpaper blur" +msgstr "Desenfoque del fondo de pantalla" + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "How much the wallpaper behind the window is blurred: 0% keeps it sharp, 100% is the strongest blur." +msgstr "Qué tan desenfocado se ve el fondo de pantalla detrás de la ventana: 0 % lo deja nítido y 100 % es el desenfoque máximo." diff --git a/crates/qbz-i18n/translations/fr/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/fr/LC_MESSAGES/qbz-ui.po index cf8555f94..fd06ad2be 100644 --- a/crates/qbz-i18n/translations/fr/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/fr/LC_MESSAGES/qbz-ui.po @@ -7721,3 +7721,11 @@ msgstr "Fond d'écran du système" #: crates/qbz-qt/qml/views/PlaylistView.qml msgid "{} tracks will be removed from this playlist." msgstr "{} titres seront retirés de cette playlist." + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "Wallpaper blur" +msgstr "Flou du fond d'écran" + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "How much the wallpaper behind the window is blurred: 0% keeps it sharp, 100% is the strongest blur." +msgstr "Intensité du flou du fond d'écran derrière la fenêtre : 0 % le laisse net, 100 % est le flou maximal." diff --git a/crates/qbz-i18n/translations/ja/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/ja/LC_MESSAGES/qbz-ui.po index 1ff5a9aaf..c9ce5e137 100644 --- a/crates/qbz-i18n/translations/ja/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/ja/LC_MESSAGES/qbz-ui.po @@ -7704,3 +7704,11 @@ msgstr "システムの壁紙" #: crates/qbz-qt/qml/views/PlaylistView.qml msgid "{} tracks will be removed from this playlist." msgstr "{} 曲をこのプレイリストから削除します。" + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "Wallpaper blur" +msgstr "壁紙のぼかし" + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "How much the wallpaper behind the window is blurred: 0% keeps it sharp, 100% is the strongest blur." +msgstr "ウィンドウの背後に見える壁紙のぼかしの強さ。0% でくっきり、100% で最も強くぼかします。" diff --git a/crates/qbz-i18n/translations/nl/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/nl/LC_MESSAGES/qbz-ui.po index 442e84d83..0e1f272e1 100644 --- a/crates/qbz-i18n/translations/nl/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/nl/LC_MESSAGES/qbz-ui.po @@ -7711,3 +7711,11 @@ msgstr "Systeemachtergrond" #: crates/qbz-qt/qml/views/PlaylistView.qml msgid "{} tracks will be removed from this playlist." msgstr "{} nummers worden uit deze afspeellijst verwijderd." + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "Wallpaper blur" +msgstr "Vervaging van de bureaubladachtergrond" + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "How much the wallpaper behind the window is blurred: 0% keeps it sharp, 100% is the strongest blur." +msgstr "Hoe sterk de bureaubladachtergrond achter het venster wordt vervaagd: 0% houdt hem scherp, 100% is de sterkste vervaging." diff --git a/crates/qbz-i18n/translations/pt/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/pt/LC_MESSAGES/qbz-ui.po index a862cf6c7..a119c1b52 100644 --- a/crates/qbz-i18n/translations/pt/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/pt/LC_MESSAGES/qbz-ui.po @@ -7721,3 +7721,11 @@ msgstr "Papel de parede do sistema" #: crates/qbz-qt/qml/views/PlaylistView.qml msgid "{} tracks will be removed from this playlist." msgstr "{} faixas serão removidas desta playlist." + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "Wallpaper blur" +msgstr "Desfoque do papel de parede" + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "How much the wallpaper behind the window is blurred: 0% keeps it sharp, 100% is the strongest blur." +msgstr "Quanto o papel de parede atrás da janela fica desfocado: 0% o mantém nítido, 100% é o desfoque máximo." diff --git a/crates/qbz-i18n/translations/ru/LC_MESSAGES/qbz-ui.po b/crates/qbz-i18n/translations/ru/LC_MESSAGES/qbz-ui.po index e17cb65d9..23ad50f7e 100644 --- a/crates/qbz-i18n/translations/ru/LC_MESSAGES/qbz-ui.po +++ b/crates/qbz-i18n/translations/ru/LC_MESSAGES/qbz-ui.po @@ -7742,3 +7742,11 @@ msgstr "Обои системы" #: crates/qbz-qt/qml/views/PlaylistView.qml msgid "{} tracks will be removed from this playlist." msgstr "Из этого плейлиста будет удалено {} треков." + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "Wallpaper blur" +msgstr "Размытие обоев" + +#: crates/qbz-qt/qml/settings/AppearanceSettings.qml +msgid "How much the wallpaper behind the window is blurred: 0% keeps it sharp, 100% is the strongest blur." +msgstr "Насколько размыты обои за окном: 0 % — чётко, 100 % — максимальное размытие." diff --git a/crates/qbz-qt/qml/settings/AppearanceSettings.qml b/crates/qbz-qt/qml/settings/AppearanceSettings.qml index ccf086ef1..d4abbcc6d 100644 --- a/crates/qbz-qt/qml/settings/AppearanceSettings.qml +++ b/crates/qbz-qt/qml/settings/AppearanceSettings.qml @@ -293,6 +293,35 @@ Column { } } } + // Wallpaper mode only: how blurred the X-ray view of the desktop is. + // Qt's own range for MultiEffect.blur, 0.0-1.0, shown as 0-100 %; the + // default is the 0.75 the mode shipped with (settings_qt.rs). The drag + // moves the live background; the value is stored on release. + SettingRow { kioskHost: root.kioskHost; + visible: root.backgroundIndex === 3 + label: QbzSession.tr("Wallpaper blur", QbzSession.trRev) + description: QbzSession.tr("How much the wallpaper behind the window is blurred: 0% keeps it sharp, 100% is the strongest blur.", QbzSession.trRev) + Row { + spacing: 12 + QbzSlider { kioskHost: root.kioskHost; + id: wallpaperBlurSlider + anchors.verticalCenter: parent.verticalCenter + minimum: 0 + maximum: 100 + value: Math.round(QbzShell.wallpaperBlur * 100) + onChanged: function (v) { QbzShell.wallpaperBlur = v / 100 } + onReleased: function (v) { QbzBridge.settingsSlider("wallpaper-blur", v) } + } + Text { + anchors.verticalCenter: parent.verticalCenter + width: 40 + horizontalAlignment: Text.AlignRight + text: wallpaperBlurSlider.value + "%" + color: theme.textSecondary + font.pixelSize: root.kioskHost ? theme.fontBody * 1.2 : theme.fontBody + } + } + } } SettingsSpacer { } diff --git a/crates/qbz-qt/qml/shell/AppShell.qml b/crates/qbz-qt/qml/shell/AppShell.qml index 885c04551..631e83573 100644 --- a/crates/qbz-qt/qml/shell/AppShell.qml +++ b/crates/qbz-qt/qml/shell/AppShell.qml @@ -140,7 +140,9 @@ Rectangle { visible: root.wallpaperModeOn source: root.wallpaperModeOn ? QbzShell.wallpaperUrl : "" hostWindow: root.hostWindow - blur: 0.75 + // The user's choice (Settings > Appearance, 0-100 % of Qt's 0.0-1.0), + // live while that slider drags; 0.75 by default. + blur: QbzShell.wallpaperBlur dim: theme.isDark ? QbzShell.ambientDim : 0.0 } Rectangle { diff --git a/crates/qbz-qt/src/settings_qt.rs b/crates/qbz-qt/src/settings_qt.rs index 63490f460..5943761e4 100644 --- a/crates/qbz-qt/src/settings_qt.rs +++ b/crates/qbz-qt/src/settings_qt.rs @@ -665,6 +665,30 @@ pub fn app_background_mode() -> i32 { .unwrap_or(0) as i32 } +/// The Wallpaper mode's blur, in MultiEffect's own units: Qt documents +/// `blur` from 0.0 (no blur) to 1.0 (full blur), reached at the field's +/// `blurMax` of 64 (shell/WallpaperField.qml). 0.75 is the look the mode +/// shipped with and stays the default; Settings > Appearance edits it as +/// 0-100 %. +pub const WALLPAPER_BLUR_DEFAULT: f32 = 0.75; + +pub fn wallpaper_blur() -> f32 { + clamp_wallpaper_blur(pref_f32("wallpaper_blur", WALLPAPER_BLUR_DEFAULT)) +} + +/// Qt's range, whatever a hand-edited ui_prefs.json holds; NaN is the default. +fn clamp_wallpaper_blur(value: f32) -> f32 { + if value.is_nan() { + return WALLPAPER_BLUR_DEFAULT; + } + value.clamp(0.0, 1.0) +} + +/// The Settings slider's 0-100 % step as the stored Qt value. +fn wallpaper_blur_from_percent(percent: i32) -> f32 { + percent.clamp(0, 100) as f32 / 100.0 +} + /// Live-tuning knobs (Slint AppearanceState defaults; the QBZ_BG_* envs are /// the same dev knobs the Slint seeds at startup). pub fn ambient_dim() -> f32 { @@ -4434,6 +4458,15 @@ pub async fn settings_select(runtime: &Arc>, key: &st } pub async fn settings_slider(runtime: &Arc>, key: &str, value: i32) { + if key == "wallpaper-blur" { + // Persisted on the slider's release; the drag itself already moved + // QbzShell.wallpaperBlur for the live preview. + let blur = wallpaper_blur_from_percent(value); + // Written from the whole percent as f64: an f32 widened on the way to + // JSON would store 0.62 as 0.6200000047683716. + save_pref("wallpaper_blur", serde_json::json!(f64::from(value.clamp(0, 100)) / 100.0)); + crate::shell_bridge::ui(move |mut b| b.as_mut().set_wallpaper_blur(blur)); + } if key == "buffer-seconds" { let seconds = value.clamp(1, 10) as u8; match with_audio(|s| s.set_stream_buffer_seconds(seconds)) { @@ -4907,6 +4940,28 @@ mod local_tab_order_tests { } } +#[cfg(test)] +mod wallpaper_blur_tests { + use super::*; + + #[test] + fn the_slider_percent_maps_onto_qts_blur_range() { + assert_eq!(wallpaper_blur_from_percent(0), 0.0); + assert_eq!(wallpaper_blur_from_percent(75), 0.75); + assert_eq!(wallpaper_blur_from_percent(100), 1.0); + assert_eq!(wallpaper_blur_from_percent(-20), 0.0); + assert_eq!(wallpaper_blur_from_percent(250), 1.0); + } + + #[test] + fn a_hand_edited_value_is_held_to_qts_range() { + assert_eq!(clamp_wallpaper_blur(1.7), 1.0); + assert_eq!(clamp_wallpaper_blur(-0.2), 0.0); + assert_eq!(clamp_wallpaper_blur(0.4), 0.4); + assert_eq!(clamp_wallpaper_blur(f32::NAN), WALLPAPER_BLUR_DEFAULT); + } +} + #[cfg(test)] mod theme_fieldset_doc_tests { use super::*; diff --git a/crates/qbz-qt/src/shell_bridge.rs b/crates/qbz-qt/src/shell_bridge.rs index f03202b3f..b0fd26b36 100644 --- a/crates/qbz-qt/src/shell_bridge.rs +++ b/crates/qbz-qt/src/shell_bridge.rs @@ -346,6 +346,10 @@ pub mod qbz_shell { #[qproperty(QString, ambient_accent)] // Look knobs (Slint AppearanceState defaults; QBZ_BG_* env seed). #[qproperty(f32, ambient_dim)] + /// The Wallpaper mode's blur, MultiEffect units 0.0-1.0 + /// (settings_qt::wallpaper_blur). Settings writes it while the slider + /// drags, for a live preview, and persists it on release. + #[qproperty(f32, wallpaper_blur)] /// Debug knob QBZ_BG_SCALE — RETIRED 2026-08-13: the ambient field /// renders inline now (no offscreen target to scale), and the knob /// measured as a non-lever anyway. Kept to avoid bridge churn. @@ -923,6 +927,7 @@ pub struct QbzShellRust { ambient_secondary: QString, ambient_accent: QString, ambient_dim: f32, + wallpaper_blur: f32, ambient_scale: f32, viz_tick_ms: i32, pane_layer: bool, @@ -1043,6 +1048,7 @@ impl Default for QbzShellRust { ambient_secondary: QString::from("#9632ff"), ambient_accent: QString::from("#3fd9c8"), ambient_dim: crate::settings_qt::ambient_dim(), + wallpaper_blur: crate::settings_qt::wallpaper_blur(), ambient_scale: crate::settings_qt::ambient_scale(), viz_tick_ms: crate::settings_qt::viz_tick_ms(), pane_layer: crate::settings_qt::pane_layer(),