feat(qt): the offline cache is purged from the manager only, with a tooltip and an explicit modal

Settings > Offline loses its "Clear cache" row: it ran the same
QbzOffline.clearAll() as the trash glyph in the Offline Cache Manager's
stats bar, so the whole cache had two entry points and one misleading text
("your downloaded albums are kept" — what is kept are the purchased
downloads in the music folder). The glyph now carries a hover tooltip (the
manager mounts the shared QbzTooltip overlay; the limit and folder glyphs
get one too) and its confirmation says exactly what goes — the live track
count and size — and what stays. The Tauri-era string leaves the eight
catalogs; the new ones enter them.

cc
This commit is contained in:
vicrodh committed 2026-09-13 10:26:33 -06:00
1 parent 9b93e58367
commit 198fbfc6fe
11 files changed
+203 -73

No files matched your search

+33 -7
View File
@@ -174,6 +174,9 @@ Rectangle {
id: gb
property string name: ""
property string tint: "muted"
/// Hover tooltip text, shown by the view's QbzTooltip overlay ("" =
/// none). Icon-only buttons get one; the row glyphs have their labels.
property string tip: ""
signal clicked()
width: root.kioskHost ? 44 : 30
height: root.kioskHost ? 44 : 30
@@ -191,7 +194,11 @@ Rectangle {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: gb.clicked()
onClicked: {
tips.hide("ghost-" + gb.name)
gb.clicked()
}
onContainsMouseChanged: tips.hover(containsMouse, gb, "ghost-" + gb.name, gb.tip)
}
}
@@ -270,17 +277,23 @@ Rectangle {
GhostBtn {
anchors.verticalCenter: parent.verticalCenter
name: "check"
tip: QbzSession.tr("Apply the size limit", QbzSession.trRev)
onClicked: QbzOffline.setLimit(parseInt(limitField.text) || 0)
}
GhostBtn {
anchors.verticalCenter: parent.verticalCenter
name: "folder"
tip: QbzSession.tr("Open the cache folder", QbzSession.trRev)
onClicked: QbzOffline.openFolder()
}
// The ONE place the whole offline cache can be purged (the
// Settings row that mirrored it was dropped 2026-09-13): a
// tooltip says so before the click, the modal says what goes.
GhostBtn {
anchors.verticalCenter: parent.verticalCenter
name: "trash-2"
tint: "warning"
tip: QbzSession.tr("Clear the whole offline cache…", QbzSession.trRev)
onClicked: clearConfirm.open()
}
}
@@ -643,19 +656,32 @@ Rectangle {
}
// Clear-all confirmation. The Slint fires it straight from the trash glyph;
// this port asks first, the way every other destructive row in Settings
// does (SettingsConfirmHost). Purging the cache can be an hours-long
// re-download and there is no undo.
// this port asks first. Purging the cache can be an hours-long re-download
// and there is no undo, so the body says exactly what goes (the live
// count and size from the stats bar) and what stays (purchased downloads
// in the music folder — a different tree, never touched by clear_all).
QbzConfirmModal {
kioskHost: root.kioskHost
kioskHost: root.kioskHost
id: clearConfirm
// Fills the VIEW, like BlacklistManagerView.qml:523 — without it the
// modal has no size and its scrim covers nothing.
anchors.fill: parent
title: QbzSession.tr("Clear cache", QbzSession.trRev)
body: QbzSession.tr("Frees up cached data. Your downloaded albums are kept — remove those from the offline manager above.", QbzSession.trRev)
title: QbzSession.tr("Clear the offline cache?", QbzSession.trRev)
body: QbzSession.tr("Removes everything saved for offline listening: {} using {}. Purchased downloads in your music folder are kept; anything cleared has to be downloaded again to play offline.", QbzSession.trRev)
.replace("{}", root.doc.tracksText || "")
.replace("{}", root.doc.sizeText || "")
confirmLabel: QbzSession.tr("Clear all", QbzSession.trRev)
danger: true
onConfirmed: QbzOffline.clearAll()
}
// Hover tooltips for the icon-only stats-bar buttons. QbzTooltip is the
// shared overlay; it takes no pointer and owns no animator, so an idle
// one costs nothing (ArtistSceneView.qml mounts it the same way). Below
// the modal's z (ADR-009), so an open confirmation always covers it.
QbzTooltip {
id: tips
anchors.fill: parent
z: 900
}
}