Ports the whole playlist-organisation domain, which had no counterpart in this frontend, plus the Library work the owner asked not to defer. Playlist Manager. New controller (playlist_manager_qt, _rows, _ops) over the already-ported folders_qt repository, which until now had zero consumers. Grid, list and folder-tree modes; sort, filter and search; folder cards and chips; drag reorder and up/down arrows. Reached from the sidebar's "..." menu, whose New folder / Manage playlists / Import rows had been rendering dimmed and inert behind a comment saying the seam did not exist. Folders. QbzFolderEdit plus the create/edit modals and PmFolderIcon: preset or custom-image icons, colour, hidden flag, delete. Deleting a folder nulls its LOCAL members' folder_id explicitly, because the app keeps the foreign_keys pragma off, so the schema's ON DELETE SET NULL never fires for them. QbzPlaylistEdit. One shared rename/description/delete editor replacing the inline popup in PlaylistView. Three corrections the old path had wrong: the description is carried through a rename instead of being written as NULL, a FOLLOWED playlist routes to unsubscribe (playlist/delete returns 200 and silently no-ops on a playlist you do not own), and the post-delete back navigation is conditional on actually being on that playlist's page, so deleting from the manager no longer navigates you off it. Importer. Spotify / Apple Music / Tidal / Deezer, over the shared qbz-playlist-import crate. Picker local mode. The reference's four-case matrix — target local or Qobuz, payload local refs or Qobuz ids. Local playlists list unconditionally and Qobuz ones only when online. Local refs onto a Qobuz playlist write the library.db sidecar at next_playlist_sidecar_position(pid, qobuz_count); the 0-based enumerate the reference used before collided slots and lost rows. The carried payload can no longer be parsed as a catalog id when it is a library row id. Unblocks the local bulk add-to-playlist. Library. A-Z jump strip, Albums list mode, Artists side panel, per-tab persistence and multi-select. Preferences land in the same <data-dir>/qbz/favorites_ui.json the shipping build writes, so switching between the two frontends keeps them. LibraryView is split into views/library/ on the way past 1800 lines. Local library. Group-by now persists; playback queues the order on screen rather than the SQL page order; switching album-identity mode invalidates the Artists tab; artist matching folds diacritics and compares normalized credit parts, so "Air" stops listing "Airbourne" and "Beyonce" stops being two artists. Offline. activate_offline never persisted a last-user marker, so every per-user path resolved to None and all local reads came back empty; a session that started offline saw no local playlists at all. The sidebar's load-once latch was function-local and therefore unreachable from the logout reset, so a second login never rebuilt the tree. Both are session-scoped now, and the sidebar Refresh row runs the local-safe verb instead of being dimmed with no way to recover. Also fixes, found while verifying rather than reported: artwork derivatives were written straight to their final path, so a QML Image resolving one mid-encode opened a truncated png and Qt cached that failure against the URL for the rest of the session; Library's track group separators referenced a Component declared in another delegate's scope and could never render; the genre filter was drawn on Tracks and Albums but applied only on All; an All-feed row called a player method that does not exist; and the sidebar's drop-hot highlight used Slint's #RRGGBBAA literals in Qt's #AARRGGBB slot. 17 new msgids across all 8 locales. cc
251 lines
9.9 KiB
QML
251 lines
9.9 KiB
QML
// AlbumListRow — primitives/AlbumListRow.slint:129+, the LIST arm of a
|
|
// CATALOG album collection (Discover Browse, Label Releases). 64px
|
|
// (`list-row-h`, DiscoverBrowseView.slint:29), radius 8, odd-row zebra,
|
|
// hover surface-hover — coherent with TrackRow.
|
|
//
|
|
// The local twin is views/local/LocalAlbumRow.qml (56px, local actions, a
|
|
// host-owned skeleton). This one is Qobuz-wired: the body opens the catalog
|
|
// album, and the ⋯ menu carries the five entries the Slint always shows
|
|
// (Open album / Play / Play next / Play later / Add to queue). Right-clicking
|
|
// the row opens the same menu at the pointer, like every other ⋯ site.
|
|
//
|
|
// "Block this album" is the sixth entry, live since QbzBlacklist landed
|
|
// (primitives/AlbumListRow.slint:434-441). It is pushed conditionally rather
|
|
// than sitting in the literal because the .slint gates it on a non-local /
|
|
// non-plex source — see the `entries` block.
|
|
//
|
|
// item contract: home_qt::HomeCard — { id, title, artist, artistId, year,
|
|
// qualityTier, qualityDetail, artUrl, artPath }. `artUrl` is the REMOTE cover
|
|
// url and `artPath` the local file:// cache path; only the former may be
|
|
// persisted (src/home_qt.rs:117-121).
|
|
|
|
import QtQuick
|
|
import com.blitzfc.qbz
|
|
import "../controls"
|
|
import "../theme"
|
|
|
|
Rectangle {
|
|
id: root
|
|
|
|
property var item: ({})
|
|
/// Row index — drives the even/odd zebra (coherent with TrackRow).
|
|
/// NOT named `index`: a Repeater injects one into the delegate context
|
|
/// and a same-named property here would shadow it.
|
|
property int rowIndex: 0
|
|
/// Cover override for hosts whose rows carry no `artPath` of their own.
|
|
/// The Library feed is id-keyed (`artKey` -> a decoded file:// path in
|
|
/// LibraryView's artMap), so its rows never gain the key AlbumCollection's
|
|
/// producers bake in; everything else keeps working unchanged because ""
|
|
/// falls straight back to `item.artPath`.
|
|
property string artSource: ""
|
|
/// Multi-select arm (FavoritesView.slint:514 — Library > Albums in LIST
|
|
/// mode only). Default off, so the two catalog call sites are untouched.
|
|
property bool selectMode: false
|
|
property bool checked: false
|
|
signal toggleSelect()
|
|
|
|
QbzTheme { id: theme }
|
|
|
|
// Same columns (and widths) as AlbumListHeader.qml.
|
|
readonly property int colArt: 52
|
|
readonly property int colQuality: 150
|
|
readonly property int colYear: 64
|
|
readonly property int colOverflow: 36
|
|
readonly property int colGap: 12
|
|
|
|
readonly property bool rowHovered: rowArea.containsMouse || moreArea.containsMouse
|
|
|| artistArea.containsMouse
|
|
|
|
width: parent ? parent.width : 0
|
|
height: 64
|
|
radius: theme.radiusSm
|
|
color: rowHovered ? theme.surfaceHover
|
|
: (rowIndex % 2 === 1 ? theme.alphaTier(4) : "transparent")
|
|
|
|
MouseArea {
|
|
id: rowArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: function (mouse) {
|
|
if (mouse.button === Qt.RightButton) {
|
|
// In select mode the row is a selection target, not a menu
|
|
// host (Tauri/Slint parity: a right-click toggles nothing
|
|
// there either).
|
|
if (!root.selectMode)
|
|
rowMenu.openAtCursor(rowArea, mouse.x, mouse.y)
|
|
return
|
|
}
|
|
if (root.selectMode) root.toggleSelect()
|
|
else QbzAlbum.openAlbum(root.item.id || "")
|
|
}
|
|
}
|
|
|
|
CardMenu {
|
|
id: rowMenu
|
|
menuWidth: 196
|
|
// A JS expression, not a literal: the block row is CONDITIONAL. The
|
|
// function form also re-evaluates on `trRev`, which the literal
|
|
// already did through each `tr(…, trRev)` call.
|
|
entries: {
|
|
var t = QbzSession.tr
|
|
var r = QbzSession.trRev
|
|
var m = [
|
|
{ "label": t("Open album", r), "icon": "library-big", "action": "open" },
|
|
{ "label": t("Play", r), "icon": "play-fill", "action": "play" },
|
|
{ "label": t("Play next", r), "icon": "list-start", "action": "next" },
|
|
{ "label": t("Play later", r), "icon": "list-plus", "action": "later" },
|
|
{ "label": t("Add to queue", r), "icon": "list-end", "action": "queue" },
|
|
]
|
|
// AlbumListRow.slint:434-441 gates the row on a non-local/plex
|
|
// source. `home_qt::HomeCard` carries NO `source` field, so this
|
|
// reads "" and the row shows — correct for these two catalog-only
|
|
// surfaces (Discover Browse, Label Releases). Written defensively
|
|
// so a producer that starts emitting `source` is honoured without
|
|
// a second edit here.
|
|
var src = root.item.source || ""
|
|
if (src !== "local" && src !== "plex")
|
|
m.push({ "label": t("Block this album", r), "icon": "blind-eye", "action": "block" })
|
|
return m
|
|
}
|
|
onPicked: function (a) {
|
|
var id = root.item.id || ""
|
|
if (id === "") return
|
|
if (a === "open") QbzAlbum.openAlbum(id)
|
|
else if (a === "play") QbzPlayer.playAlbum(id)
|
|
// `artUrl`, never `artPath`: the store keeps a denormalized cover
|
|
// url and a file:// cache path is dead on any other machine.
|
|
else if (a === "block") QbzBlacklist.blockAlbum(id, root.item.title || "",
|
|
root.item.artist || "", root.item.artUrl || "")
|
|
else QbzPlayer.enqueueAlbum(id, a)
|
|
}
|
|
}
|
|
|
|
Row {
|
|
anchors.fill: parent
|
|
anchors.leftMargin: 12
|
|
anchors.rightMargin: 12
|
|
spacing: root.colGap
|
|
|
|
// Selection checkbox — takes the leading slot in select mode
|
|
// (MultiSelectBar's companion; the art cell keeps its own width so
|
|
// the columns below the header never shift).
|
|
Item {
|
|
visible: root.selectMode
|
|
width: visible ? 18 : 0
|
|
height: parent.height
|
|
QbzCheckbox {
|
|
anchors.centerIn: parent
|
|
checked: root.checked
|
|
onToggled: root.toggleSelect()
|
|
}
|
|
}
|
|
|
|
// Art cell (52px column, 44px thumb centred).
|
|
Item {
|
|
width: root.colArt
|
|
height: parent.height
|
|
Rectangle {
|
|
width: 44
|
|
height: 44
|
|
anchors.centerIn: parent
|
|
radius: 4
|
|
color: theme.surfaceElevated
|
|
clip: true
|
|
RoundedImage {
|
|
anchors.fill: parent
|
|
source: root.artSource !== "" ? root.artSource : (root.item.artPath || "")
|
|
radius: 4
|
|
}
|
|
}
|
|
}
|
|
|
|
// ITEM — title over artist (the artist line links to the artist).
|
|
Column {
|
|
// The select checkbox adds a leading 18px cell AND a gap; without
|
|
// subtracting both, the row overflows its width by 30px the moment
|
|
// multi-select is switched on.
|
|
width: parent.width - root.colArt - root.colQuality - root.colYear
|
|
- root.colOverflow - 4 * root.colGap
|
|
- (root.selectMode ? 18 + root.colGap : 0)
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
spacing: 2
|
|
Text {
|
|
width: parent.width
|
|
text: root.item.title || ""
|
|
color: theme.textPrimary
|
|
font.pixelSize: theme.fontLink
|
|
font.weight: theme.weightMedium
|
|
elide: Text.ElideRight
|
|
}
|
|
Text {
|
|
id: artistText
|
|
width: parent.width
|
|
text: root.item.artist || ""
|
|
color: artistArea.containsMouse ? theme.textPrimary : theme.textMuted
|
|
font.pixelSize: 12
|
|
elide: Text.ElideRight
|
|
MouseArea {
|
|
id: artistArea
|
|
anchors.fill: parent
|
|
// Only a real artist id is clickable — otherwise the
|
|
// pointer promises a page that cannot open.
|
|
enabled: (root.item.artistId || "") !== ""
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: QbzArtist.openArtist(root.item.artistId)
|
|
}
|
|
}
|
|
}
|
|
|
|
// QUALITY — the SAME badge the album page shows (tier label over the
|
|
// exact bit-depth / sample-rate line).
|
|
Item {
|
|
width: root.colQuality
|
|
height: parent.height
|
|
QualityBadgeFull {
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
tier: root.item.qualityTier || ""
|
|
detail: root.item.qualityDetail || ""
|
|
}
|
|
}
|
|
|
|
Text {
|
|
width: root.colYear
|
|
height: parent.height
|
|
text: root.item.year || ""
|
|
color: theme.textMuted
|
|
font.pixelSize: 12
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
|
|
Item {
|
|
width: root.colOverflow
|
|
height: parent.height
|
|
Rectangle {
|
|
width: 32
|
|
height: 32
|
|
radius: 6
|
|
anchors.centerIn: parent
|
|
color: moreArea.containsMouse ? theme.surfaceElevated : "transparent"
|
|
QbzIcon {
|
|
name: "ellipsis"
|
|
width: 18
|
|
height: 18
|
|
anchors.centerIn: parent
|
|
tintName: moreArea.containsMouse ? "textPrimary" : "muted"
|
|
}
|
|
MouseArea {
|
|
id: moreArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: function (mouse) { rowMenu.openAtCursor(moreArea, mouse.x, mouse.y) }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|