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
This commit is contained in:
12 files changed
+157
-1
No files matched your search
@@ -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."
|
||||
@@ -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."
|
||||
@@ -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."
|
||||
@@ -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."
|
||||
@@ -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% で最も強くぼかします。"
|
||||
@@ -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."
|
||||
@@ -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."
|
||||
@@ -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 % — максимальное размытие."
|
||||
@@ -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 { }
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<AppRuntime<LoggingAdapter>>, key: &st
|
||||
}
|
||||
|
||||
pub async fn settings_slider(runtime: &Arc<AppRuntime<LoggingAdapter>>, 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::*;
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in new issue
Block a user