feat(qt): one-time blind-mode disclaimer on Purchases

The WindowsDisclaimerModal mechanism on the purchases pref seam: a
purchases_disclaimer_seen key seeded on entry, a disclaimerVisible field
in the list document, and an OK that persists the dismissal for good. The
overlay uses the DiscoverConfigModal wheel-lock shape; the scrim does not
dismiss, so a stray click can never acknowledge it. Body ships as msgids
in all locales with the Star Wars line kept in English everywhere.

cc
This commit is contained in:
vicrodh committed 2026-08-31 11:35:45 -06:00
1 parent 5e6daf0e81
commit ad4d48eeef
10 files changed
+196

No files matched your search

+84
View File
@@ -549,4 +549,88 @@ Rectangle {
anchors.bottom: parent.bottom
target: flick
}
// ── One-time disclaimer modal (QoL round) ────────────────────────────
// The WindowsDisclaimerModal mechanism on the purchases pref seam:
// seeded from `purchases_disclaimer_seen` on entry, OK persists it and
// it never returns. Overlay shape + wheel-lock are the
// DiscoverConfigModal pattern (plain Item, not a Popup — each surface
// eats its own wheel; ADR-009 z ≥ 3000). The scrim does NOT dismiss:
// like the Windows disclaimer, the only way out is the button, so a
// stray click cannot silently acknowledge it forever.
Item {
visible: root.doc.disclaimerVisible === true
enabled: visible
anchors.fill: parent
z: 3100
Rectangle {
anchors.fill: parent
radius: theme.radiusMd
color: "#bf000000"
MouseArea {
anchors.fill: parent
onClicked: {}
onWheel: function (wheel) { wheel.accepted = true }
}
}
Rectangle {
width: Math.min(parent.width - 80, 520)
height: Math.min(discCol.implicitHeight + 48, parent.height - 80)
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
radius: theme.radiusMd
color: theme.surfaceCard
border.width: 1
border.color: theme.borderSubtle
clip: true
MouseArea {
anchors.fill: parent
onWheel: function (wheel) { wheel.accepted = true }
}
Column {
id: discCol
x: 24
y: 24
width: parent.width - 48
spacing: 14
Text {
width: parent.width
text: QbzSession.tr("About music purchases", QbzSession.trRev)
color: theme.textPrimary
font.pixelSize: 17
font.weight: Font.DemiBold
wrapMode: Text.WordWrap
}
Text {
width: parent.width
text: QbzSession.tr("Music purchases are not available in every country or region where the platform offers streaming. One of those countries, where nothing can be bought and only the streaming subscription is offered, is Mexico.", QbzSession.trRev)
color: theme.textSecondary
font.pixelSize: 13
wrapMode: Text.WordWrap
}
Text {
width: parent.width
text: QbzSession.tr("As it happens, the developer and maintainer of this software is from Mexico, so this section was built in blind mode — 'I am one with the Force and the Force is with me' — with some feedback from a couple of contributors, but in the end, in blind mode: it ships with no guarantee that it works and no promise to fix whatever is broken.", QbzSession.trRev)
color: theme.textSecondary
font.pixelSize: 13
wrapMode: Text.WordWrap
}
Item {
width: parent.width
height: 32
QbzPrimaryButton {
anchors.right: parent.right
label: QbzSession.tr("OK", QbzSession.trRev)
btnHeight: 32
onClicked: QbzPurchases.dismissDisclaimer()
}
}
}
}
}
}
+9
View File
@@ -129,6 +129,11 @@ pub mod qbz_purchases_bridge {
#[qinvokable]
fn dismiss_region_notice(self: Pin<&mut QbzPurchases>);
/// OK on the one-time disclaimer modal. Persisted
/// (`purchases_disclaimer_seen`).
#[qinvokable]
fn dismiss_disclaimer(self: Pin<&mut QbzPurchases>);
/// Open the purchased-album detail. RECORDS the album and starts the
/// fetch; the QML caller then calls `QbzShell.navigateTo("purchase-album")`
/// — in THAT order (§C.2).
@@ -274,6 +279,10 @@ impl qbz_purchases_bridge::QbzPurchases {
crate::purchases_qt::dismiss_region_notice();
}
pub fn dismiss_disclaimer(self: Pin<&mut Self>) {
crate::purchases_qt::dismiss_disclaimer();
}
pub fn open_album(self: Pin<&mut Self>, album_id: QString) {
crate::purchases_qt::open_album(album_id.to_string());
}
+19
View File
@@ -84,6 +84,9 @@ const PREF_HIDE_UNAVAILABLE: &str = "purchases_hide_unavailable";
const PREF_HIDE_DOWNLOADED: &str = "purchases_hide_downloaded";
const PREF_QUALITY_FILTER: &str = "purchases_quality_filter";
const PREF_REGION_NOTICE_SEEN: &str = "purchases_region_notice_seen";
/// The one-time blind-mode disclaimer modal (QoL round) — same mechanism as
/// the region notice: seeded from the pref on entry, dismissed once, forever.
const PREF_DISCLAIMER_SEEN: &str = "purchases_disclaimer_seen";
// ---------------------------------------------------------------------------
// Documents (contract §G.2 / §G.3 — FROZEN; two QML lanes are written against
@@ -196,6 +199,9 @@ struct ListDoc {
searching: bool,
#[serde(rename = "regionNoticeVisible")]
region_notice_visible: bool,
/// ADDITIVE (QoL round): the one-time disclaimer modal.
#[serde(rename = "disclaimerVisible")]
disclaimer_visible: bool,
/// The Tracks tab shows ONLY group + the two filters (§5).
toolbar: ToolbarDoc,
albums: Vec<AlbumRow>,
@@ -714,6 +720,7 @@ struct ListState {
search: String,
searching: bool,
region_notice_visible: bool,
disclaimer_visible: bool,
group: String,
sort: String,
ascending: bool,
@@ -748,6 +755,9 @@ impl Default for ListState {
search: String::new(),
searching: false,
region_notice_visible: true,
// FALSE until the entry seed reads the pref: the modal must never
// flash for a user who already dismissed it.
disclaimer_visible: false,
group: "off".to_string(),
// §G.2's spelling of the reference's `'date'` sort key.
sort: "purchased".to_string(),
@@ -919,6 +929,7 @@ fn build_list_doc(s: &ListState) -> ListDoc {
search: s.search.clone(),
searching: s.searching,
region_notice_visible: s.region_notice_visible,
disclaimer_visible: s.disclaimer_visible,
toolbar: ToolbarDoc {
group: s.group.clone(),
sort: s.sort.clone(),
@@ -1373,6 +1384,7 @@ pub fn open_list() {
s.hide_downloaded = crate::settings_qt::pref_bool(PREF_HIDE_DOWNLOADED, false);
s.quality_filter = crate::settings_qt::pref_str(PREF_QUALITY_FILTER, "all");
s.region_notice_visible = !crate::settings_qt::pref_bool(PREF_REGION_NOTICE_SEEN, false);
s.disclaimer_visible = !crate::settings_qt::pref_bool(PREF_DISCLAIMER_SEEN, false);
s.error.clear();
// THE GUARD (§5). `false -> true` is claimed here, under the lock, so
// two entries in the same frame cannot both fire the metadata load.
@@ -1704,6 +1716,13 @@ pub fn dismiss_region_notice() {
publish_list();
}
/// OK on the one-time disclaimer modal: persist and never show it again.
pub fn dismiss_disclaimer() {
crate::settings_qt::save_pref(PREF_DISCLAIMER_SEEN, serde_json::json!(true));
with_list(|s| s.disclaimer_visible = false);
publish_list();
}
// ---------------------------------------------------------------------------
// Detail
// ---------------------------------------------------------------------------