From c4cf300c6b6716d880d23350696cbbbe2d20ec88 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Wed, 17 Jun 2026 01:55:24 -0600 Subject: [PATCH] feat(slint): Settings content-filtering blacklist row (count/disabled/manage) cc --- crates/qbz-slint/src/main.rs | 13 ++ .../settings/ContentFilteringSettings.slint | 115 ++++++++++++++++++ .../qbz-slint/ui/settings/SettingsView.slint | 12 ++ 3 files changed, 140 insertions(+) create mode 100644 crates/qbz-slint/ui/settings/ContentFilteringSettings.slint diff --git a/crates/qbz-slint/src/main.rs b/crates/qbz-slint/src/main.rs index bec6c485f..034bf524d 100644 --- a/crates/qbz-slint/src/main.rs +++ b/crates/qbz-slint/src/main.rs @@ -240,6 +240,17 @@ fn seed_tray_appearance(w: &AppWindow, tray: &tray_settings::TraySettings) { appearance.set_tray_icon_theme_index(tray_settings::icon_theme_index(&tray.tray_icon_theme)); } +/// Refresh the blacklist count + enabled flag on `BlacklistState` (T10). +/// The Settings content-filtering row binds to these, and Settings is reached +/// independently of the Manager (which seeds them on its own load), so we +/// re-read the wrapper whenever the Settings view is shown. Fail-open: with no +/// session the wrapper returns count 0 / enabled true. +fn seed_blacklist_status(w: &AppWindow) { + let st = w.global::(); + st.set_count(crate::artist_blacklist::count() as i32); + st.set_enabled(crate::artist_blacklist::is_enabled()); +} + /// Reveal the shell and load the Discover / Home view with real data, /// then kick off cached artwork downloads. async fn enter_shell( @@ -1278,6 +1289,7 @@ fn apply_entry( } nav::NavEntry::Settings => { let _ = weak.upgrade_in_event_loop(|w| { + seed_blacklist_status(&w); w.global::().set_view(ContentView::Settings); }); } @@ -4677,6 +4689,7 @@ fn main() -> Result<(), Box> { window.global::().on_request_settings(move || { nav::record(nav::NavEntry::Settings); if let Some(w) = weak.upgrade() { + seed_blacklist_status(&w); w.global::().set_view(ContentView::Settings); update_nav_flags(&w); } diff --git a/crates/qbz-slint/ui/settings/ContentFilteringSettings.slint b/crates/qbz-slint/ui/settings/ContentFilteringSettings.slint new file mode 100644 index 000000000..bbce7f8f8 --- /dev/null +++ b/crates/qbz-slint/ui/settings/ContentFilteringSettings.slint @@ -0,0 +1,115 @@ +// Settings > Blacklist (content filtering) — a single row that mirrors the +// Tauri SettingsView content-filtering section (SettingsView.svelte:5945-5969): +// +// - a blind-eye icon (Tauri's lucide `Ban`; the Slint build has no Ban asset, +// so it reuses the same blind-eye stand-in the Manager uses), +// - the "Artist Blacklist" label, +// - a status line "{count} artist(s) blocked" with a trailing "(disabled)" +// suffix when the feature is off, +// - a "Manage" affordance (chevron) that opens the Blacklist Manager view via +// the global BlacklistActions.open() seam (the same forward-open the manager +// back-chrome pairs with). +// +// There is NO enable/disable toggle here (Tauri parity): the global on/off +// switch lives inside the Manager. The count + enabled flag are seeded onto +// BlacklistState whenever the Settings view is shown (main.rs +// seed_blacklist_status), and the Manager re-seeds them on its own load. + +import { Theme } from "../foundation/semantic-colors.slint"; +import { Typography } from "../foundation/typography.slint"; +import { Radius } from "../foundation/radius.slint"; +import { BlacklistState, BlacklistActions } from "../state.slint"; +import { QbzIcon } from "../primitives/QbzIcon.slint"; + +// "Manage" affordance — same 160x34 / right-edge style as the other settings +// panels' SecondaryButton, but with a trailing chevron (Tauri's Manage link). +component ManageButton inherits Rectangle { + callback clicked(); + width: 160px; + height: 34px; + border-radius: Radius.sm; + border-width: 1px; + border-color: Theme.border-subtle; + background: ta.has-hover ? Theme.surface-hover : Theme.surface-elevated; + HorizontalLayout { + alignment: center; + spacing: 6px; + VerticalLayout { + alignment: center; + Text { + text: @tr("Manage"); + color: Theme.text-secondary; + font-size: Typography.body; + font-weight: Typography.medium; + vertical-alignment: center; + } + } + VerticalLayout { + alignment: center; + QbzIcon { + source: @image-url("../assets/icons/chevron-right.svg"); + width: 16px; + height: 16px; + tint: Theme.text-secondary; + } + } + } + ta := TouchArea { + mouse-cursor: pointer; + clicked => { + root.clicked(); + } + } +} + +export component ContentFilteringSettings inherits VerticalLayout { + spacing: 4px; + + HorizontalLayout { + height: 64px; + spacing: 24px; + + // Icon + label + status line (left). + HorizontalLayout { + horizontal-stretch: 1; + spacing: 12px; + VerticalLayout { + alignment: center; + QbzIcon { + source: @image-url("../assets/icons/blind-eye.svg"); + width: 18px; + height: 18px; + tint: Theme.text-secondary; + } + } + VerticalLayout { + alignment: center; + spacing: 3px; + Text { + text: @tr("Artist Blacklist"); + color: Theme.text-primary; + font-size: Typography.body; + font-weight: Typography.medium; + } + Text { + // "{count} artist(s) blocked" + "(disabled)" suffix when off. + text: BlacklistState.enabled + ? @tr("{} artist(s) blocked", BlacklistState.count) + : @tr("{} artist(s) blocked (disabled)", BlacklistState.count); + color: Theme.text-muted; + font-size: 12px; + } + } + } + + // Manage affordance (right). + VerticalLayout { + alignment: center; + ManageButton { + clicked => { + BlacklistActions.open(); + } + } + } + } +} diff --git a/crates/qbz-slint/ui/settings/SettingsView.slint b/crates/qbz-slint/ui/settings/SettingsView.slint index d9430ca81..a06a41132 100644 --- a/crates/qbz-slint/ui/settings/SettingsView.slint +++ b/crates/qbz-slint/ui/settings/SettingsView.slint @@ -16,6 +16,7 @@ import { PlaybackSettings } from "PlaybackSettings.slint"; import { AppearanceSettings } from "AppearanceSettings.slint"; import { OfflineSettings } from "OfflineSettings.slint"; import { LocalLibrarySettings } from "LocalLibrarySettings.slint"; +import { ContentFilteringSettings } from "ContentFilteringSettings.slint"; import { IntegrationsSettings } from "IntegrationsSettings.slint"; import { DeveloperSettings } from "DeveloperSettings.slint"; import { ScrollView } from "std-widgets.slint"; @@ -151,6 +152,16 @@ export component SettingsView inherits Rectangle { SettingsState.section = 4; } } + // Content filtering (Artist Blacklist) — placed between + // downloads (Offline) and Integrations per the Tauri order. + SubNavItem { + icon: @image-url("../assets/icons/blind-eye.svg"); + label: @tr("Blacklist"); + active: SettingsState.section == 7; + clicked => { + SettingsState.section = 7; + } + } SubNavItem { icon: @image-url("../assets/icons/refresh-cw.svg"); label: @tr("Integrations"); @@ -234,6 +245,7 @@ export component SettingsView inherits Rectangle { } } if !SettingsState.loading && SettingsState.section == 4: LocalLibrarySettings { } + if !SettingsState.loading && SettingsState.section == 7: ContentFilteringSettings { } if !SettingsState.loading && SettingsState.section == 6: IntegrationsSettings { } if !SettingsState.loading && SettingsState.section == 5: DeveloperSettings { } }