refactor(qbz-qt): phase 22 — full QML duplication sweep beyond cards
TrackRow.qml unified from 4 copies (context arms, net -716 LOC with strictly more behavior); QbzSectionHeader, QbzTabBar, QbzNavButton, QbzIconButton, QbzCircleAction, QbzEmptyState, QbzOfflinePlaceholder consolidated; sort dropdowns onto QbzContextMenu; QualityMini routed everywhere. Deliberately separate per the Slint architecture: QueueRow, FeedListRow, underline tab strips, ReleaseSection header. Restored the offline 'Open Settings' action the POC had stubbed. km
This commit is contained in:
21 files changed
+991
-1707
No files matched your search
@@ -391,31 +391,10 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
// Icon-only quality badge (QualityBadge.slint).
|
||||
Item {
|
||||
QualityMini {
|
||||
id: qBadge
|
||||
visible: root.qualityTier !== ""
|
||||
width: root.qualityTier === "hires" ? 42 : 30
|
||||
height: 30
|
||||
tier: root.qualityTier
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Image {
|
||||
visible: root.qualityTier === "hires"
|
||||
source: "assets/hi-res.svg"
|
||||
width: 42
|
||||
height: 28
|
||||
anchors.centerIn: parent
|
||||
sourceSize: Qt.size(84, 56)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
Rectangle {
|
||||
visible: root.qualityTier === "cd"
|
||||
width: 30
|
||||
height: 30
|
||||
radius: 3
|
||||
color: theme.surfaceElevated
|
||||
border.width: 1
|
||||
border.color: theme.borderSubtle
|
||||
QbzIcon { name: "cd"; width: 16; height: 16; anchors.centerIn: parent; tintName: "muted" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-307
@@ -88,308 +88,9 @@ Rectangle {
|
||||
|
||||
// Ghost CircleAction (secondary, on-surface variant): elevated disc,
|
||||
// strong ring, text-primary icon (accent when active).
|
||||
component CircleBtn: Rectangle {
|
||||
property string name: ""
|
||||
property bool active: false
|
||||
signal clicked(var mouse)
|
||||
width: 32
|
||||
height: 32
|
||||
radius: 16
|
||||
color: (cbArea.containsMouse || active) ? theme.surfaceHover : theme.surfaceElevated
|
||||
border.width: 1.5
|
||||
border.color: theme.borderMuted
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: 15
|
||||
height: 15
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.active ? "accent" : "primary"
|
||||
}
|
||||
MouseArea {
|
||||
id: cbArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: function (mouse) { parent.clicked(mouse) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Track list row (TrackRow.slint replica: number cell, no artwork,
|
||||
// favorite + download + menu columns).
|
||||
component AlbumTrackRow: Rectangle {
|
||||
property var row: ({})
|
||||
property int rowIndex: 0
|
||||
|
||||
readonly property bool isActive: QbzBridge.npTrackId !== "" && QbzBridge.npTrackId === row.id
|
||||
readonly property bool hovered: trArea.containsMouse || favArea.containsMouse || moreArea.containsMouse
|
||||
|
||||
width: parent ? parent.width : 0
|
||||
height: 50
|
||||
radius: 8
|
||||
color: hovered ? "#14ffffff" : (rowIndex % 2 === 1 ? "#07ffffff" : "transparent")
|
||||
|
||||
// Static now-playing mark: 3px accent pill on the left edge.
|
||||
Rectangle {
|
||||
visible: isActive
|
||||
x: 2
|
||||
y: 7
|
||||
width: 3
|
||||
height: parent.height - 14
|
||||
radius: 1.5
|
||||
color: theme.accent
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 12
|
||||
anchors.rightMargin: 12
|
||||
spacing: 14
|
||||
|
||||
// Number cell — swaps to play on hover (non-artwork variant).
|
||||
Item {
|
||||
width: 32
|
||||
height: 40
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Text {
|
||||
visible: !trArea.containsMouse
|
||||
anchors.centerIn: parent
|
||||
text: row.number
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 13
|
||||
}
|
||||
Rectangle {
|
||||
visible: trArea.containsMouse
|
||||
anchors.centerIn: parent
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: isActive && QbzBridge.npPlaying ? "transparent" : "#3dffffff"
|
||||
border.width: isActive && QbzBridge.npPlaying ? 1.5 : 0
|
||||
border.color: theme.accent
|
||||
QbzIcon {
|
||||
anchors.centerIn: parent
|
||||
name: isActive && QbzBridge.npPlaying ? "pause" : "play-fill"
|
||||
width: 14
|
||||
height: 14
|
||||
tintName: isActive && QbzBridge.npPlaying ? "accent" : "primary"
|
||||
}
|
||||
}
|
||||
}
|
||||
// Title + artist.
|
||||
Column {
|
||||
width: parent.width - 32 - 70 - 92 - 28 - 28 - 32 - 5 * 14
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 2
|
||||
Row {
|
||||
spacing: 6
|
||||
Text {
|
||||
text: row.title
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: 14
|
||||
font.weight: theme.weightMedium
|
||||
elide: Text.ElideRight
|
||||
width: Math.min(implicitWidth, parent.parent.width - (row.explicit ? 22 : 0))
|
||||
}
|
||||
Rectangle {
|
||||
visible: row.explicit
|
||||
width: 16
|
||||
height: 16
|
||||
radius: 3
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: theme.surfaceElevated
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "E"
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 9
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
width: parent.width
|
||||
visible: row.artist !== ""
|
||||
text: row.artist
|
||||
color: row.artistId !== "" && artistLinkArea.containsMouse ? theme.textPrimary : theme.textMuted
|
||||
font.pixelSize: 13
|
||||
elide: Text.ElideRight
|
||||
MouseArea {
|
||||
id: artistLinkArea
|
||||
anchors.fill: parent
|
||||
enabled: row.artistId !== ""
|
||||
hoverEnabled: true
|
||||
cursorShape: row.artistId !== "" ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: QbzBridge.openArtist(row.artistId)
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
width: 70
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: row.duration
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 13
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
// Bare quality badge (tier label + detail).
|
||||
Text {
|
||||
width: 92
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: row.qualityTier === "hires" ? "HI-RES" : (row.qualityTier === "cd" ? "CD" : "")
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 10
|
||||
font.weight: theme.weightBold
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
// Favorite (live).
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
radius: theme.radiusSm
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: favArea.containsMouse ? theme.surfaceElevated : "transparent"
|
||||
QbzIcon {
|
||||
anchors.centerIn: parent
|
||||
name: row.isFavorite ? "heart-filled" : "heart"
|
||||
width: 16
|
||||
height: 16
|
||||
tintName: row.isFavorite ? "favorite" : (favArea.containsMouse ? "primary" : "muted")
|
||||
}
|
||||
MouseArea {
|
||||
id: favArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
row.isFavorite = !row.isFavorite
|
||||
QbzBridge.libraryToggleFavorite("track", row.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Offline download — INERT stub (out of scope).
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: "transparent"
|
||||
QbzIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "cloud-download"
|
||||
width: 16
|
||||
height: 16
|
||||
tintName: "muted"
|
||||
}
|
||||
}
|
||||
// ⋯ menu.
|
||||
Rectangle {
|
||||
width: 32
|
||||
height: 32
|
||||
radius: theme.radiusSm
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: moreArea.containsMouse ? theme.surfaceElevated : "transparent"
|
||||
QbzIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "ellipsis"
|
||||
width: 16
|
||||
height: 16
|
||||
tintName: moreArea.containsMouse ? "primary" : "muted"
|
||||
}
|
||||
MouseArea {
|
||||
id: moreArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: function (mouse) { rowMenu.openAtCursor(moreArea, mouse.x, mouse.y) }
|
||||
}
|
||||
QbzContextMenu {
|
||||
id: rowMenu
|
||||
menuWidth: 196
|
||||
Repeater {
|
||||
model: [
|
||||
{ "label": QbzBridge.tr("Play", QbzBridge.trRev), "icon": "play-fill", "action": "play" },
|
||||
{ "label": QbzBridge.tr("Play next", QbzBridge.trRev), "icon": "list-plus", "action": "next" },
|
||||
{ "label": QbzBridge.tr("Add to queue", QbzBridge.trRev), "icon": "list-end", "action": "queue" },
|
||||
{ "label": row.isFavorite ? QbzBridge.tr("Remove from Library", QbzBridge.trRev) : QbzBridge.tr("Add to Library", QbzBridge.trRev), "icon": row.isFavorite ? "heart-filled" : "heart", "action": "favorite" },
|
||||
]
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
width: parent ? parent.width : 0
|
||||
height: 33
|
||||
radius: 5
|
||||
color: rmiArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 8
|
||||
spacing: 8
|
||||
QbzIcon { name: modelData.icon; width: 15; height: 15; anchors.verticalCenter: parent.verticalCenter; tintName: "secondary" }
|
||||
Text {
|
||||
height: parent.height
|
||||
width: parent.width - 23
|
||||
text: modelData.label
|
||||
color: theme.textSecondary
|
||||
font.pixelSize: 13
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: rmiArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
rowMenu.close()
|
||||
var a = modelData.action
|
||||
if (a === "play") QbzBridge.playAlbumFrom(header.id, row.id)
|
||||
else if (a === "next") QbzBridge.enqueueAlbumTrack(header.id, row.id, "next")
|
||||
else if (a === "queue") QbzBridge.enqueueAlbumTrack(header.id, row.id, "later")
|
||||
else if (a === "favorite") {
|
||||
row.isFavorite = !row.isFavorite
|
||||
QbzBridge.libraryToggleFavorite("track", row.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Shared drag (the row BODY is the source — TrackRow.slint):
|
||||
// press-drag >6px starts it; a normal click/double-click still
|
||||
// plays. The ghost + sidebar drops live in main.rs drag_*.
|
||||
property bool dragging: false
|
||||
property point downPos: Qt.point(0, 0)
|
||||
MouseArea {
|
||||
id: trArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
onPressed: function (mouse) { parent.downPos = Qt.point(mouse.x, mouse.y) }
|
||||
onPositionChanged: function (mouse) {
|
||||
if (!pressed) return
|
||||
const g = mapToItem(null, mouse.x, mouse.y)
|
||||
if (!parent.dragging
|
||||
&& (Math.abs(mouse.x - parent.downPos.x) > 6
|
||||
|| Math.abs(mouse.y - parent.downPos.y) > 6)) {
|
||||
parent.dragging = true
|
||||
QbzBridge.dragStart(row.id, row.title,
|
||||
row.artist + " · " + row.album, g.x, g.y)
|
||||
}
|
||||
if (parent.dragging) QbzBridge.dragMove(g.x, g.y)
|
||||
}
|
||||
onReleased: function (mouse) {
|
||||
if (parent.dragging) {
|
||||
QbzBridge.dragEnd()
|
||||
parent.dragging = false
|
||||
mouse.accepted = true
|
||||
}
|
||||
}
|
||||
onDoubleClicked: QbzBridge.playAlbumFrom(header.id, row.id)
|
||||
onClicked: mouse.accepted = false
|
||||
}
|
||||
}
|
||||
|
||||
// Sidebar label/award card (SidebarCard).
|
||||
component SidebarCard: Rectangle {
|
||||
property string name: ""
|
||||
@@ -635,12 +336,12 @@ Rectangle {
|
||||
onClicked: QbzBridge.playAlbum(header.id)
|
||||
}
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
name: "shuffle"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: QbzBridge.playAlbumShuffled(header.id)
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
name: header.isFavorite ? "heart-filled" : "heart"
|
||||
active: header.isFavorite === true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -651,10 +352,10 @@ Rectangle {
|
||||
}
|
||||
// Radio / Mixtape / Info — INERT stubs (POC-NOTE:
|
||||
// radio engines, mixtape store, album-info modal).
|
||||
CircleBtn { name: "radio"; anchors.verticalCenter: parent.verticalCenter }
|
||||
CircleBtn { name: "cassette-tape"; anchors.verticalCenter: parent.verticalCenter }
|
||||
CircleBtn { name: "info"; anchors.verticalCenter: parent.verticalCenter }
|
||||
CircleBtn {
|
||||
QbzCircleAction { name: "radio"; anchors.verticalCenter: parent.verticalCenter }
|
||||
QbzCircleAction { name: "cassette-tape"; anchors.verticalCenter: parent.verticalCenter }
|
||||
QbzCircleAction { name: "info"; anchors.verticalCenter: parent.verticalCenter }
|
||||
QbzCircleAction {
|
||||
id: albumMenuBtn
|
||||
name: "ellipsis"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -874,7 +575,22 @@ Rectangle {
|
||||
font.weight: theme.weightBold
|
||||
}
|
||||
}
|
||||
AlbumTrackRow { row: modelData; rowIndex: index }
|
||||
TrackRow {
|
||||
item: modelData
|
||||
number: index + 1
|
||||
zebra: true
|
||||
clickPlays: false
|
||||
artistLink: true
|
||||
qualityStyle: "text"
|
||||
showDownload: true
|
||||
downloadGlyph: true
|
||||
menuShowLater: false
|
||||
menuShowGoTo: false
|
||||
onPlayRequested: QbzBridge.playAlbumFrom(header.id, item.id)
|
||||
onEnqueueRequested: function (m) {
|
||||
QbzBridge.enqueueAlbumTrack(header.id, item.id, m === "next" ? "next" : "later")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,31 +122,7 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
component CircleBtn: Rectangle {
|
||||
property string name: ""
|
||||
property bool active: false
|
||||
signal clicked(var mouse)
|
||||
width: 32
|
||||
height: 32
|
||||
radius: 16
|
||||
color: (cbArea.containsMouse || active) ? theme.surfaceHover : theme.surfaceElevated
|
||||
border.width: 1.5
|
||||
border.color: theme.borderMuted
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: 15
|
||||
height: 15
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.active ? "accent" : "primary"
|
||||
}
|
||||
MouseArea {
|
||||
id: cbArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: function (mouse) { parent.clicked(mouse) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Popular Tracks row (TrackRow with artwork + album column).
|
||||
component PopularTrackRow: Rectangle {
|
||||
@@ -611,7 +587,7 @@ Rectangle {
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: 12
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
name: artist.isFollowing ? "heart-filled" : "heart"
|
||||
active: artist.isFollowing === true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -620,19 +596,19 @@ Rectangle {
|
||||
QbzBridge.libraryToggleFavorite("artist", artist.id)
|
||||
}
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
id: radioBtn
|
||||
name: "radio"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: radioPopup.openBelowRight(radioBtn)
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
name: "element-connect"
|
||||
active: root.networkOpen
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: root.networkOpen = !root.networkOpen
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
id: overflowBtn
|
||||
name: "ellipsis"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -805,12 +781,12 @@ Rectangle {
|
||||
onClicked: QbzBridge.playArtistTop(false)
|
||||
}
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
name: "square-check-big"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
// POC-NOTE: multi-select out of scope.
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
id: topMenuBtn
|
||||
name: "ellipsis"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -61,65 +61,7 @@ Rectangle {
|
||||
: QbzBridge.offlineMode === 2 ? 2
|
||||
: QbzBridge.offlineMode === 1 ? 1 : 0
|
||||
|
||||
// Circular history / collapse button (HeaderNavBtn).
|
||||
component HeaderNavBtn: Rectangle {
|
||||
property string name: ""
|
||||
property bool btnEnabled: true
|
||||
signal clicked()
|
||||
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
opacity: btnEnabled ? 1.0 : 0.4
|
||||
color: (hnArea.containsMouse && btnEnabled) ? theme.surfaceHover : theme.surfaceElevated
|
||||
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: 15
|
||||
height: 15
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.btnEnabled ? "primary" : "muted"
|
||||
}
|
||||
MouseArea {
|
||||
id: hnArea
|
||||
anchors.fill: parent
|
||||
enabled: parent.btnEnabled
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
// Square icon button (HeaderIconButton, 36px) / compact nav (30px).
|
||||
component HeaderIconBtn: Rectangle {
|
||||
property string name: ""
|
||||
property int btnSize: 36
|
||||
property int iconSize: 19
|
||||
property bool active: false
|
||||
signal clicked()
|
||||
|
||||
width: btnSize
|
||||
height: btnSize
|
||||
radius: theme.radiusSm
|
||||
color: active ? theme.surfaceElevated
|
||||
: hiArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: parent.iconSize
|
||||
height: parent.iconSize
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.active ? "accent"
|
||||
: hiArea.containsMouse ? "primary" : "secondary"
|
||||
}
|
||||
MouseArea {
|
||||
id: hiArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
// --- Left controls ---------------------------------------------------
|
||||
Row {
|
||||
@@ -129,18 +71,18 @@ Rectangle {
|
||||
height: 36
|
||||
spacing: 6
|
||||
|
||||
HeaderNavBtn {
|
||||
QbzNavButton {
|
||||
name: "panel-left"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: QbzBridge.cycleSidebar()
|
||||
}
|
||||
HeaderNavBtn {
|
||||
QbzNavButton {
|
||||
name: "chevron-left"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
btnEnabled: QbzBridge.canBack
|
||||
onClicked: QbzBridge.navigateBack()
|
||||
}
|
||||
HeaderNavBtn {
|
||||
QbzNavButton {
|
||||
name: "chevron-right"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
btnEnabled: QbzBridge.canForward
|
||||
@@ -156,24 +98,24 @@ Rectangle {
|
||||
spacing: 2
|
||||
|
||||
Item { width: 6; height: 1 }
|
||||
HeaderIconBtn {
|
||||
QbzIconButton { activeBackground: true
|
||||
name: "compass"
|
||||
btnSize: 30; iconSize: 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !QbzBridge.offline
|
||||
}
|
||||
HeaderIconBtn {
|
||||
QbzIconButton { activeBackground: true
|
||||
name: "music-library-2"
|
||||
btnSize: 30; iconSize: 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !QbzBridge.offline
|
||||
}
|
||||
HeaderIconBtn {
|
||||
QbzIconButton { activeBackground: true
|
||||
name: "hard-drive"
|
||||
btnSize: 30; iconSize: 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
HeaderIconBtn {
|
||||
QbzIconButton { activeBackground: true
|
||||
name: "qbz-symbolic"
|
||||
btnSize: 30; iconSize: 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -185,7 +127,7 @@ Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: theme.borderSubtle
|
||||
}
|
||||
HeaderIconBtn {
|
||||
QbzIconButton { activeBackground: true
|
||||
name: "list-music"
|
||||
btnSize: 30; iconSize: 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -476,7 +418,7 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
HeaderIconBtn {
|
||||
QbzIconButton { activeBackground: true
|
||||
name: "menu"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: appMenu.open()
|
||||
|
||||
+22
-195
@@ -50,98 +50,6 @@ Rectangle {
|
||||
// ============================ shared components =======================
|
||||
|
||||
// Circular page-control button (Carousel's NavButton).
|
||||
component NavBtn: Rectangle {
|
||||
property string name: ""
|
||||
property bool btnEnabled: true
|
||||
signal clicked()
|
||||
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
opacity: btnEnabled ? 1.0 : 0.4
|
||||
color: (nbArea.containsMouse && btnEnabled) ? theme.surfaceHover : theme.surfaceElevated
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: 15
|
||||
height: 15
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.btnEnabled ? "primary" : "muted"
|
||||
}
|
||||
MouseArea {
|
||||
id: nbArea
|
||||
anchors.fill: parent
|
||||
enabled: parent.btnEnabled
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
// "View all →" header link (Carousel.slint ViewAllLink) — shown when
|
||||
// the section carries a discover endpoint. POC-NOTE: the click is
|
||||
// INERT (the DiscoverBrowse full-list page is out of scope).
|
||||
component ViewAllLink: Rectangle {
|
||||
width: linkText.implicitWidth + 16
|
||||
height: 26
|
||||
radius: 4
|
||||
color: vaArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
Text {
|
||||
id: linkText
|
||||
anchors.centerIn: parent
|
||||
text: QbzBridge.tr("View all →", QbzBridge.trRev)
|
||||
color: vaArea.containsMouse ? theme.textPrimary : theme.textSecondary
|
||||
font.pixelSize: 14
|
||||
font.weight: theme.weightMedium
|
||||
}
|
||||
MouseArea {
|
||||
id: vaArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
}
|
||||
|
||||
// Section header: title + [View all] + page chevrons (Carousel header
|
||||
// metrics — the link sits LEFT of the chevrons, Tauri parity).
|
||||
component RailHeader: Item {
|
||||
property string title: ""
|
||||
property bool leftEnabled: false
|
||||
property bool rightEnabled: false
|
||||
property bool showViewAll: false
|
||||
signal pageLeft()
|
||||
signal pageRight()
|
||||
|
||||
width: parent ? parent.width : 0
|
||||
height: 28
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: parent.title
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontSection
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
Row {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 4
|
||||
ViewAllLink {
|
||||
visible: parent.parent.showViewAll
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
NavBtn {
|
||||
name: "chevron-left"
|
||||
btnEnabled: parent.parent.leftEnabled
|
||||
onClicked: parent.parent.pageLeft()
|
||||
}
|
||||
NavBtn {
|
||||
name: "chevron-right"
|
||||
btnEnabled: parent.parent.rightEnabled
|
||||
onClicked: parent.parent.pageRight()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Horizontal album rail (Carousel.slint): header + clipped ListView,
|
||||
// page chevrons (per-page step like the Slint paging).
|
||||
component AlbumRail: Column {
|
||||
@@ -153,7 +61,7 @@ Rectangle {
|
||||
readonly property int step: perPage * 232
|
||||
readonly property real maxScroll: Math.max(0, rail.contentWidth - rail.width)
|
||||
|
||||
RailHeader {
|
||||
QbzSectionHeader {
|
||||
title: sectionData.title
|
||||
leftEnabled: rail.contentX > 1
|
||||
rightEnabled: rail.contentX < maxScroll - 1
|
||||
@@ -232,7 +140,7 @@ Rectangle {
|
||||
readonly property int pageCount: Math.max(1, Math.ceil(total / perPage))
|
||||
readonly property real maxScroll: (pageCount - 1) * grid.width
|
||||
|
||||
RailHeader {
|
||||
QbzSectionHeader {
|
||||
title: sectionData.title
|
||||
leftEnabled: grid.contentX > 1
|
||||
rightEnabled: grid.contentX < maxScroll - 1
|
||||
@@ -284,7 +192,7 @@ Rectangle {
|
||||
readonly property int perPage: Math.max(1, Math.floor((rail.width + 32) / 232))
|
||||
readonly property int step: perPage * 232
|
||||
|
||||
RailHeader {
|
||||
QbzSectionHeader {
|
||||
title: sectionData.title
|
||||
leftEnabled: rail.contentX > 1
|
||||
rightEnabled: rail.contentX < maxScroll - 1
|
||||
@@ -537,36 +445,16 @@ Rectangle {
|
||||
}
|
||||
Component {
|
||||
id: recentComp
|
||||
RecentPlaceholder {
|
||||
QbzEmptyState {
|
||||
property var sectionData: parent.sectionData
|
||||
title: sectionData.title
|
||||
hint: sectionData.hint
|
||||
body: sectionData.hint
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Recently-played placeholder (HomeView.slint RecentPlaceholder).
|
||||
component RecentPlaceholder: Column {
|
||||
property string title: ""
|
||||
property string hint: ""
|
||||
width: parent ? parent.width : 0
|
||||
spacing: 10
|
||||
Text {
|
||||
text: title
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: 18
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
Text {
|
||||
text: hint
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 13
|
||||
}
|
||||
}
|
||||
|
||||
// Shimmer block + skeleton rows (HomeSkeleton.slint).
|
||||
component Shimmer: Rectangle {
|
||||
property bool phase: false
|
||||
color: theme.surfaceElevated
|
||||
@@ -596,38 +484,12 @@ Rectangle {
|
||||
|
||||
// ============================ offline gate ============================
|
||||
// (OfflinePlaceholder.slint replica; mounted INSTEAD of the view.)
|
||||
Column {
|
||||
QbzOfflinePlaceholder {
|
||||
visible: QbzBridge.offline
|
||||
anchors.centerIn: parent
|
||||
spacing: 0
|
||||
QbzIcon {
|
||||
name: "cloud-off"
|
||||
width: 56
|
||||
height: 56
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
tintName: "muted"
|
||||
}
|
||||
Item { width: 1; height: 18 }
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: QbzBridge.tr("You're offline", QbzBridge.trRev)
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontHeading
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
Item { width: 1; height: 8 }
|
||||
Text {
|
||||
width: 420
|
||||
text: QbzBridge.offlineMode === 2
|
||||
? QbzBridge.tr("Offline mode is enabled. Disable it in Settings to use Qobuz.", QbzBridge.trRev)
|
||||
: QbzBridge.tr("No internet connection. Your local library and downloads keep working.", QbzBridge.trRev)
|
||||
color: theme.textSecondary
|
||||
font.pixelSize: theme.fontBody
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
// POC-NOTE: induced-offline "Open Settings" button omitted — no
|
||||
// Settings view exists in the POC yet.
|
||||
// The induced-only "Open Settings" arm (Slint) is wired:
|
||||
showSettingsAction: true
|
||||
onSettingsClicked: QbzBridge.navigateTo("settings")
|
||||
}
|
||||
|
||||
// ============================ the view ================================
|
||||
@@ -646,56 +508,21 @@ Rectangle {
|
||||
// placeholder) + 16px spacing -> the pill starts at 48.
|
||||
x: 48
|
||||
y: 25 - height / 2
|
||||
height: tabPill.height
|
||||
spacing: 16
|
||||
|
||||
Rectangle {
|
||||
id: tabPill
|
||||
width: tabRow.width
|
||||
height: tabRow.height
|
||||
color: theme.surfaceElevated
|
||||
radius: 6
|
||||
Row {
|
||||
id: tabRow
|
||||
padding: 3
|
||||
spacing: 4
|
||||
Repeater {
|
||||
model: [
|
||||
{ "id": "home", "label": QbzBridge.tr("Home", QbzBridge.trRev) },
|
||||
{ "id": "editorPicks", "label": QbzBridge.tr("Editor's Picks", QbzBridge.trRev) },
|
||||
{ "id": "forYou", "label": QbzBridge.tr("For You", QbzBridge.trRev) },
|
||||
{ "id": "recommendations", "label": QbzBridge.tr("Recommendations", QbzBridge.trRev) },
|
||||
]
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
property bool active: root.activeTab === modelData.id
|
||||
width: tabText.implicitWidth + 28
|
||||
height: tabText.implicitHeight + 12
|
||||
radius: 4
|
||||
color: active ? theme.surfaceMain
|
||||
: tabArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
Text {
|
||||
id: tabText
|
||||
anchors.centerIn: parent
|
||||
text: modelData.label
|
||||
color: parent.active ? theme.textPrimary : theme.textMuted
|
||||
font.pixelSize: 13
|
||||
font.weight: theme.weightMedium
|
||||
}
|
||||
MouseArea {
|
||||
id: tabArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
// Data is per-tab JSON (no refetch on
|
||||
// switch); scroll resets to top.
|
||||
onClicked: {
|
||||
root.activeTab = modelData.id
|
||||
homeFlick.contentY = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QbzTabBar {
|
||||
tabs: [
|
||||
{ "id": "home", "label": QbzBridge.tr("Home", QbzBridge.trRev) },
|
||||
{ "id": "editorPicks", "label": QbzBridge.tr("Editor's Picks", QbzBridge.trRev) },
|
||||
{ "id": "forYou", "label": QbzBridge.tr("For You", QbzBridge.trRev) },
|
||||
{ "id": "recommendations", "label": QbzBridge.tr("Recommendations", QbzBridge.trRev) },
|
||||
]
|
||||
activeId: root.activeTab
|
||||
// Data is per-tab JSON (no refetch on switch); scroll
|
||||
// resets to top.
|
||||
onSelected: function (id) {
|
||||
root.activeTab = id
|
||||
homeFlick.contentY = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,69 +203,6 @@ Rectangle {
|
||||
// ============================ components =============================
|
||||
|
||||
// Segmented tab (SegmentedTabBar's Segment) with count badge.
|
||||
component SegTab: Rectangle {
|
||||
id: segTabRoot
|
||||
property string label: ""
|
||||
property int count: 0
|
||||
property bool active: false
|
||||
signal clicked()
|
||||
|
||||
width: segRow.implicitWidth
|
||||
height: segRow.implicitHeight
|
||||
radius: 4
|
||||
color: active ? theme.surfaceMain
|
||||
: segArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
|
||||
Row {
|
||||
id: segRow
|
||||
leftPadding: 12
|
||||
rightPadding: parent && parent.count > 0 ? 8 : 12
|
||||
topPadding: 6
|
||||
bottomPadding: 6
|
||||
spacing: 7
|
||||
Text {
|
||||
text: parent.parent.label
|
||||
color: parent.parent.active ? theme.textPrimary : theme.textMuted
|
||||
font.pixelSize: theme.fontLegal
|
||||
font.weight: theme.weightMedium
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Rectangle {
|
||||
visible: parent.parent.count > 0
|
||||
width: Math.max(18, countText.implicitWidth + 10)
|
||||
height: 16
|
||||
radius: 8
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: parent.parent.active ? "#26ffffff" : "#14ffffff"
|
||||
Text {
|
||||
id: countText
|
||||
anchors.centerIn: parent
|
||||
text: segTabRoot.count
|
||||
color: segTabRoot.active ? theme.textPrimary : theme.textSecondary
|
||||
font.pixelSize: 11
|
||||
font.weight: theme.weightMedium
|
||||
}
|
||||
}
|
||||
}
|
||||
// Active underline (redundant shape cue).
|
||||
Rectangle {
|
||||
visible: active
|
||||
x: 4
|
||||
width: parent.width - 8
|
||||
height: 2
|
||||
y: parent.height - 2
|
||||
radius: 1
|
||||
color: theme.accent
|
||||
}
|
||||
MouseArea {
|
||||
id: segArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
// Small toolbar toggle button (ToggleButton sm): 30px, active = accent.
|
||||
component ToolToggle: Rectangle {
|
||||
property string name: ""
|
||||
@@ -338,35 +275,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
// Card heart (live favorite toggle).
|
||||
component HeartBtn: Rectangle {
|
||||
property bool fav: false
|
||||
property string itemKind: ""
|
||||
property string itemId: ""
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: hbArea.containsMouse ? "#3dffffff" : "#24ffffff"
|
||||
border.width: 1.5
|
||||
border.color: "#ccffffff"
|
||||
QbzIcon {
|
||||
name: parent.fav ? "heart-filled" : "heart"
|
||||
width: 14
|
||||
height: 14
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.fav ? "favorite" : "primary"
|
||||
}
|
||||
MouseArea {
|
||||
id: hbArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
// Optimistic flip; the signal confirms or rolls back.
|
||||
parent.fav = !parent.fav
|
||||
QbzBridge.libraryToggleFavorite(itemKind, itemId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Quality mini-badge (hi-res image / cd box).
|
||||
// ===================== card families (Slint homologation) =============
|
||||
@@ -636,202 +545,15 @@ Rectangle {
|
||||
}
|
||||
|
||||
// --- Tracks-tab row (primitives/TrackRow.slint, 50px) -----------------
|
||||
component TrackListRow: Rectangle {
|
||||
property var item: ({})
|
||||
property int number: 0
|
||||
height: 50
|
||||
radius: 6
|
||||
color: trRowArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
|
||||
property bool dragging: false
|
||||
property point downPos: Qt.point(0, 0)
|
||||
MouseArea {
|
||||
id: trRowArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: function (mouse) { parent.downPos = Qt.point(mouse.x, mouse.y) }
|
||||
onPositionChanged: function (mouse) {
|
||||
if (!pressed) return
|
||||
const g = mapToItem(null, mouse.x, mouse.y)
|
||||
if (!parent.dragging
|
||||
&& (Math.abs(mouse.x - parent.downPos.x) > 6
|
||||
|| Math.abs(mouse.y - parent.downPos.y) > 6)) {
|
||||
parent.dragging = true
|
||||
QbzBridge.dragStart(item.id, item.title,
|
||||
item.artist + " · " + item.album, g.x, g.y)
|
||||
}
|
||||
if (parent.dragging) QbzBridge.dragMove(g.x, g.y)
|
||||
}
|
||||
onReleased: function (mouse) {
|
||||
if (parent.dragging) {
|
||||
QbzBridge.dragEnd()
|
||||
parent.dragging = false
|
||||
} else {
|
||||
QbzBridge.playTrack(item.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 12
|
||||
anchors.rightMargin: 12
|
||||
spacing: 14
|
||||
// # / hover play (TrackRow number cell, 32px).
|
||||
Rectangle {
|
||||
width: 32
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
Text {
|
||||
visible: !trRowArea.containsMouse
|
||||
anchors.centerIn: parent
|
||||
text: number
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 13
|
||||
}
|
||||
Rectangle {
|
||||
visible: trRowArea.containsMouse
|
||||
anchors.centerIn: parent
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: "#3dffffff"
|
||||
QbzIcon { name: "play-fill"; width: 14; height: 14; anchors.centerIn: parent; tintName: "primary" }
|
||||
}
|
||||
}
|
||||
// Title (+ explicit badge) / artist.
|
||||
Column {
|
||||
width: parent.width - 32 - 70 - 92 - 28 - 28 - 4 * 14
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 2
|
||||
Row {
|
||||
spacing: 6
|
||||
Text {
|
||||
width: Math.min(implicitWidth, parent.parent.width - (item.explicit ? 22 : 0))
|
||||
text: item.title
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: 14
|
||||
font.weight: theme.weightMedium
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Rectangle {
|
||||
visible: item.explicit
|
||||
width: 16
|
||||
height: 16
|
||||
radius: 3
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: theme.surfaceElevated
|
||||
Text { anchors.centerIn: parent; text: "E"; color: theme.textMuted; font.pixelSize: 10; font.weight: theme.weightSemibold }
|
||||
}
|
||||
}
|
||||
Text {
|
||||
width: parent.width
|
||||
text: item.artist
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 12
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
// Duration.
|
||||
Text {
|
||||
width: 70
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
horizontalAlignment: Text.AlignRight
|
||||
text: item.duration
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 12
|
||||
}
|
||||
// Quality mini.
|
||||
Rectangle {
|
||||
width: 92
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
QualityMini { tier: item.qualityTier; anchors.verticalCenter: parent.verticalCenter }
|
||||
}
|
||||
// Heart.
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: trHeartArea.containsMouse ? theme.surfaceElevated : "transparent"
|
||||
QbzIcon {
|
||||
name: item.isFavorite ? "heart-filled" : "heart"
|
||||
width: 15
|
||||
height: 15
|
||||
anchors.centerIn: parent
|
||||
tintName: item.isFavorite ? "favorite" : "muted"
|
||||
}
|
||||
MouseArea {
|
||||
id: trHeartArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
item.isFavorite = !item.isFavorite
|
||||
QbzBridge.libraryToggleFavorite("track", item.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
// ⋯ menu.
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: trMenuArea.containsMouse ? theme.surfaceElevated : "transparent"
|
||||
QbzIcon { name: "ellipsis"; width: 15; height: 15; anchors.centerIn: parent; tintName: "secondary" }
|
||||
MouseArea {
|
||||
id: trMenuArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: function (mouse) { trMenu.openAtCursor(trMenuArea, mouse.x, mouse.y) }
|
||||
}
|
||||
}
|
||||
}
|
||||
CardMenu {
|
||||
id: trMenu
|
||||
menuWidth: 196
|
||||
entries: root.trackMenuModel(item)
|
||||
onPicked: function (a) { root.trackAction(item, a) }
|
||||
}
|
||||
}
|
||||
|
||||
// ============================ view ===================================
|
||||
|
||||
// Offline gate (OfflinePlaceholder replica; the Slint offline RAIL is
|
||||
// out of scope — see header note).
|
||||
Column {
|
||||
QbzOfflinePlaceholder {
|
||||
visible: QbzBridge.offline
|
||||
anchors.centerIn: parent
|
||||
spacing: 0
|
||||
QbzIcon {
|
||||
name: "cloud-off"
|
||||
width: 56
|
||||
height: 56
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
tintName: "muted"
|
||||
}
|
||||
Item { width: 1; height: 18 }
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: QbzBridge.tr("You're offline", QbzBridge.trRev)
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontHeading
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
Item { width: 1; height: 8 }
|
||||
Text {
|
||||
width: 420
|
||||
text: QbzBridge.offlineMode === 2
|
||||
? QbzBridge.tr("Offline mode is enabled. Disable it in Settings to use Qobuz.", QbzBridge.trRev)
|
||||
: QbzBridge.tr("No internet connection. Your local library and downloads keep working.", QbzBridge.trRev)
|
||||
color: theme.textSecondary
|
||||
font.pixelSize: theme.fontBody
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
showSettingsAction: true
|
||||
onSettingsClicked: QbzBridge.navigateTo("settings")
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -856,12 +578,20 @@ Rectangle {
|
||||
id: tabRow
|
||||
padding: 3
|
||||
spacing: 4
|
||||
SegTab { label: QbzBridge.tr("All", QbzBridge.trRev); count: counts.all || 0; active: root.activeTab === "all"; onClicked: root.activeTab = "all" }
|
||||
SegTab { label: QbzBridge.tr("Tracks", QbzBridge.trRev); count: counts.tracks || 0; active: root.activeTab === "tracks"; onClicked: root.activeTab = "tracks" }
|
||||
SegTab { label: QbzBridge.tr("Albums", QbzBridge.trRev); count: counts.albums || 0; active: root.activeTab === "albums"; onClicked: root.activeTab = "albums" }
|
||||
SegTab { label: QbzBridge.tr("Artists", QbzBridge.trRev); count: counts.artists || 0; active: root.activeTab === "artists"; onClicked: root.activeTab = "artists" }
|
||||
SegTab { label: QbzBridge.tr("Playlists", QbzBridge.trRev); count: counts.playlists || 0; active: root.activeTab === "playlists"; onClicked: root.activeTab = "playlists" }
|
||||
SegTab { label: QbzBridge.tr("Labels", QbzBridge.trRev); count: counts.labels || 0; active: root.activeTab === "labels"; onClicked: root.activeTab = "labels" }
|
||||
QbzTabBar {
|
||||
counts: true
|
||||
underline: true
|
||||
activeId: root.activeTab
|
||||
tabs: [
|
||||
{ "id": "all", "label": QbzBridge.tr("All", QbzBridge.trRev), "count": counts.all || 0 },
|
||||
{ "id": "tracks", "label": QbzBridge.tr("Tracks", QbzBridge.trRev), "count": counts.tracks || 0 },
|
||||
{ "id": "albums", "label": QbzBridge.tr("Albums", QbzBridge.trRev), "count": counts.albums || 0 },
|
||||
{ "id": "artists", "label": QbzBridge.tr("Artists", QbzBridge.trRev), "count": counts.artists || 0 },
|
||||
{ "id": "playlists", "label": QbzBridge.tr("Playlists", QbzBridge.trRev), "count": counts.playlists || 0 },
|
||||
{ "id": "labels", "label": QbzBridge.tr("Labels", QbzBridge.trRev), "count": counts.labels || 0 },
|
||||
]
|
||||
onSelected: function (id) { root.activeTab = id }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -936,22 +666,11 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: allSortMenu.open()
|
||||
onClicked: allSortMenu.openBelowRight(allSortArea)
|
||||
}
|
||||
Popup {
|
||||
QbzContextMenu {
|
||||
id: allSortMenu
|
||||
x: parent.width - 172
|
||||
y: parent.height + 4
|
||||
width: 172
|
||||
padding: 5
|
||||
closePolicy: Popup.CloseOnPressOutside
|
||||
background: Rectangle {
|
||||
color: theme.surfaceMain
|
||||
radius: theme.radiusSm
|
||||
border.width: 1
|
||||
border.color: theme.borderMuted
|
||||
}
|
||||
contentItem: Column {
|
||||
menuWidth: 172
|
||||
Repeater {
|
||||
model: [
|
||||
{ "field": "date", "label": QbzBridge.tr("Date added", QbzBridge.trRev) },
|
||||
@@ -1006,7 +725,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1043,22 +761,11 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: albumsSortMenu.open()
|
||||
onClicked: albumsSortMenu.openBelowRight(albumsSortArea)
|
||||
}
|
||||
Popup {
|
||||
QbzContextMenu {
|
||||
id: albumsSortMenu
|
||||
x: parent.width - 172
|
||||
y: parent.height + 4
|
||||
width: 172
|
||||
padding: 5
|
||||
closePolicy: Popup.CloseOnPressOutside
|
||||
background: Rectangle {
|
||||
color: theme.surfaceMain
|
||||
radius: theme.radiusSm
|
||||
border.width: 1
|
||||
border.color: theme.borderMuted
|
||||
}
|
||||
contentItem: Column {
|
||||
menuWidth: 172
|
||||
Repeater {
|
||||
model: ["default", "title-asc", "title-desc", "artist-asc"]
|
||||
delegate: Rectangle {
|
||||
@@ -1085,7 +792,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Playlists sub-tab (Library / Following).
|
||||
@@ -1300,7 +1006,12 @@ Rectangle {
|
||||
height: root.activeTab === "tracks" ? 50 : 44
|
||||
Component {
|
||||
id: trackRowComp
|
||||
TrackListRow { item: modelData; number: index + 1 }
|
||||
TrackRow {
|
||||
item: modelData
|
||||
number: index + 1
|
||||
onPlayRequested: QbzBridge.playTrack(item.id)
|
||||
onEnqueueRequested: function (m) { QbzBridge.enqueueTrack(item.id, m) }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: feedRowComp
|
||||
|
||||
@@ -51,36 +51,7 @@ Rectangle {
|
||||
|
||||
// Square compact icon button (BarControls.IconButton): disabled = dim
|
||||
// 0.3 + non-clickable; active = accent tint.
|
||||
component BarIconBtn: Rectangle {
|
||||
property string name: ""
|
||||
property int iconSize: 16
|
||||
property bool active: false
|
||||
property bool btnEnabled: true
|
||||
signal clicked()
|
||||
|
||||
width: 32
|
||||
height: 32
|
||||
radius: theme.radiusSm
|
||||
opacity: btnEnabled ? 1.0 : 0.3
|
||||
color: (biArea.containsMouse && btnEnabled) ? theme.surfaceHover : "transparent"
|
||||
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: parent.iconSize
|
||||
height: parent.iconSize
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.active ? "accent"
|
||||
: (biArea.containsMouse && parent.btnEnabled)
|
||||
? "primary" : "secondary"
|
||||
}
|
||||
MouseArea {
|
||||
id: biArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: if (parent.btnEnabled) parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
// Thin vertical separator (PlayerBarSmall's Sep): a 1px line,
|
||||
// border-subtle, ~60% of the row height, vertically centred; the
|
||||
@@ -284,18 +255,18 @@ Rectangle {
|
||||
anchors.centerIn: parent
|
||||
spacing: 2
|
||||
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "info"
|
||||
btnEnabled: QbzBridge.npHasTrack
|
||||
// POC-NOTE: track-info panel is out of scope.
|
||||
}
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "shuffle"
|
||||
active: QbzBridge.npShuffle
|
||||
btnEnabled: QbzBridge.npHasTrack
|
||||
onClicked: QbzBridge.toggleShuffle()
|
||||
}
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "skip-back"
|
||||
btnEnabled: QbzBridge.npHasTrack
|
||||
onClicked: QbzBridge.previous()
|
||||
@@ -325,18 +296,18 @@ Rectangle {
|
||||
onClicked: if (QbzBridge.npHasTrack) QbzBridge.togglePlay()
|
||||
}
|
||||
}
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "skip-forward"
|
||||
btnEnabled: QbzBridge.npHasTrack
|
||||
onClicked: QbzBridge.next()
|
||||
}
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: QbzBridge.npRepeatMode === 2 ? "repeat-1" : "repeat"
|
||||
active: QbzBridge.npRepeatMode !== 0
|
||||
btnEnabled: QbzBridge.npHasTrack
|
||||
onClicked: QbzBridge.cycleRepeat()
|
||||
}
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "plus"
|
||||
btnEnabled: QbzBridge.npHasTrack
|
||||
// POC-NOTE: the grouped "Add to…" flyout is out of
|
||||
@@ -403,16 +374,16 @@ Rectangle {
|
||||
// Lyrics are inert visual replicas — their flyouts
|
||||
// (device pickers, audio toggles, NPB-mode menu) are
|
||||
// out of scope for the POC.
|
||||
BarIconBtn { name: "monitor-speaker" }
|
||||
BarIconBtn { name: "cast" }
|
||||
BarIconBtn { name: "settings-2" }
|
||||
BarIconBtn {
|
||||
QbzIconButton { name: "monitor-speaker" }
|
||||
QbzIconButton { name: "cast" }
|
||||
QbzIconButton { name: "settings-2" }
|
||||
QbzIconButton {
|
||||
id: smallViewBtn
|
||||
name: "layout-grid"
|
||||
active: smallViewMenu.opened
|
||||
onClicked: smallViewMenu.openBelowRight(smallViewBtn)
|
||||
}
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "mic-vocal"
|
||||
active: QbzBridge.lyricsOpen
|
||||
onClicked: QbzBridge.toggleLyrics()
|
||||
@@ -421,7 +392,7 @@ Rectangle {
|
||||
Item { width: 4; height: 1 }
|
||||
|
||||
// Volume — mute icon + (WIDE) inline horizontal slider.
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: QbzBridge.npMuted ? "volume-x" : "volume-2"
|
||||
active: QbzBridge.npMuted
|
||||
onClicked: QbzBridge.toggleMute()
|
||||
@@ -464,7 +435,7 @@ Rectangle {
|
||||
Item { width: 4; height: 1 }
|
||||
|
||||
// Queue panel toggle.
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "list-ordered"
|
||||
active: QbzBridge.queueOpen
|
||||
onClicked: QbzBridge.toggleQueue()
|
||||
|
||||
@@ -68,34 +68,7 @@ Rectangle {
|
||||
// --- Shared bits -------------------------------------------------------
|
||||
|
||||
// Square compact icon button (BarControls.IconButton).
|
||||
component BarIconBtn: Rectangle {
|
||||
property string name: ""
|
||||
property int iconSize: 16
|
||||
property bool active: false
|
||||
property bool btnEnabled: true
|
||||
signal clicked()
|
||||
|
||||
width: 32
|
||||
height: 32
|
||||
radius: theme.radiusSm
|
||||
opacity: btnEnabled ? 1.0 : 0.3
|
||||
color: (biArea.containsMouse && btnEnabled) ? theme.surfaceHover : "transparent"
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: parent.iconSize
|
||||
height: parent.iconSize
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.active ? "accent"
|
||||
: (biArea.containsMouse && parent.btnEnabled) ? "primary" : "secondary"
|
||||
}
|
||||
MouseArea {
|
||||
id: biArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: if (parent.btnEnabled) parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
// Dot LED (circle-dot on / circle off) + constant-colour label — the
|
||||
// New-mode output indicators (SongCard dot-leds).
|
||||
@@ -145,25 +118,12 @@ Rectangle {
|
||||
elide: Text.ElideRight
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Image {
|
||||
visible: QbzBridge.npQualityTier === "hires"
|
||||
source: "assets/hi-res.svg"
|
||||
width: 42
|
||||
height: 28
|
||||
QualityMini {
|
||||
// The stamp shows the cd glyph for ANY non-hires tier with
|
||||
// a label (not just "cd") — map that exactly.
|
||||
tier: QbzBridge.npQualityTier === "hires" ? "hires"
|
||||
: (QbzBridge.npQualityLabel !== "" ? "cd" : "")
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
sourceSize: Qt.size(84, 56)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
Rectangle {
|
||||
visible: QbzBridge.npQualityTier !== "hires" && QbzBridge.npQualityLabel !== ""
|
||||
width: 30
|
||||
height: 30
|
||||
radius: 3
|
||||
color: theme.surfaceElevated
|
||||
border.width: 1
|
||||
border.color: theme.borderSubtle
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
QbzIcon { name: "cd"; width: 16; height: 16; anchors.centerIn: parent; tintName: "muted" }
|
||||
}
|
||||
}
|
||||
Column {
|
||||
@@ -328,14 +288,14 @@ Rectangle {
|
||||
spacing: playCircle ? 12 : 4
|
||||
height: 44
|
||||
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "shuffle"
|
||||
active: QbzBridge.npShuffle
|
||||
btnEnabled: QbzBridge.npHasTrack
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: QbzBridge.toggleShuffle()
|
||||
}
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "skip-back"
|
||||
btnEnabled: QbzBridge.npHasTrack
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -364,13 +324,13 @@ Rectangle {
|
||||
onClicked: if (QbzBridge.npHasTrack) QbzBridge.togglePlay()
|
||||
}
|
||||
}
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "skip-forward"
|
||||
btnEnabled: QbzBridge.npHasTrack
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: QbzBridge.next()
|
||||
}
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: QbzBridge.npRepeatMode === 2 ? "repeat-1" : "repeat"
|
||||
active: QbzBridge.npRepeatMode > 0
|
||||
btnEnabled: QbzBridge.npHasTrack
|
||||
@@ -536,10 +496,10 @@ Rectangle {
|
||||
Item { visible: root.largeActive; width: 12; height: 1 }
|
||||
|
||||
// Qobuz Connect — inert (device flyout out of scope).
|
||||
BarIconBtn { name: "element-connect" }
|
||||
QbzIconButton { name: "element-connect" }
|
||||
|
||||
// Now-Playing view — the mode flyout (phase 18).
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "layout-grid"
|
||||
active: viewMenu.opened
|
||||
onClicked: viewMenu.openBelowRight(viewBtn)
|
||||
@@ -547,7 +507,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
// Lyrics.
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "mic-vocal"
|
||||
active: QbzBridge.lyricsOpen
|
||||
onClicked: QbzBridge.toggleLyrics()
|
||||
@@ -556,7 +516,7 @@ Rectangle {
|
||||
Item { width: 6; height: 1 }
|
||||
|
||||
// Volume.
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: QbzBridge.npMuted ? "volume-x" : "volume-2"
|
||||
active: QbzBridge.npMuted
|
||||
onClicked: QbzBridge.toggleMute()
|
||||
@@ -598,7 +558,7 @@ Rectangle {
|
||||
Item { width: 6; height: 1 }
|
||||
|
||||
// Queue panel toggle.
|
||||
BarIconBtn {
|
||||
QbzIconButton {
|
||||
name: "list-ordered"
|
||||
active: QbzBridge.queueOpen
|
||||
onClicked: QbzBridge.toggleQueue()
|
||||
|
||||
@@ -134,325 +134,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
// --- Circular header action (CircleAction, on-surface variant) -------
|
||||
component CircleBtn: Rectangle {
|
||||
property string name: ""
|
||||
property bool active: false
|
||||
property bool primary: false
|
||||
property bool btnEnabled: true
|
||||
signal clicked()
|
||||
width: primary ? 40 : 32
|
||||
height: primary ? 40 : 32
|
||||
radius: width / 2
|
||||
color: primary ? (cbArea.containsMouse && btnEnabled ? theme.accentHover : theme.accent)
|
||||
: (cbArea.containsMouse || active) ? theme.surfaceHover : theme.surfaceElevated
|
||||
border.width: primary ? 0 : 1.5
|
||||
border.color: theme.borderMuted
|
||||
opacity: btnEnabled ? 1.0 : 0.4
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: primary ? 20 : 15
|
||||
height: primary ? 20 : 15
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.primary ? "black" : (parent.active ? "accent" : "primary")
|
||||
}
|
||||
MouseArea {
|
||||
id: cbArea
|
||||
anchors.fill: parent
|
||||
enabled: parent.btnEnabled
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
// --- Track row (PlaylistView TrackRow: # / 36 art / title+artist /
|
||||
// Album link / Duration / Quality / heart / cloud reserve / ⋯) -------
|
||||
component PlTrackRow: Rectangle {
|
||||
required property var modelData
|
||||
required property int index
|
||||
width: parent ? parent.width : 0
|
||||
height: 50
|
||||
radius: 8
|
||||
color: rowArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
|
||||
// Shared drag (the row BODY is the source — no grip). Starts past
|
||||
// 6px of press-drag; the release either reorders (in-list, owner)
|
||||
// or adds to the sidebar target (main.rs drag_end).
|
||||
property bool dragging: false
|
||||
property point downPos: Qt.point(0, 0)
|
||||
|
||||
MouseArea {
|
||||
id: rowArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: function (mouse) {
|
||||
parent.downPos = Qt.point(mouse.x, mouse.y)
|
||||
}
|
||||
onPositionChanged: function (mouse) {
|
||||
if (!pressed) return
|
||||
const g = mapToItem(null, mouse.x, mouse.y)
|
||||
if (!parent.dragging
|
||||
&& (Math.abs(mouse.x - parent.downPos.x) > 6
|
||||
|| Math.abs(mouse.y - parent.downPos.y) > 6)) {
|
||||
parent.dragging = true
|
||||
// body-drag-started (issue #589): report the source
|
||||
// index BEFORE the shared drag starts.
|
||||
if (root.isOwner) {
|
||||
root.reorderFrom = index
|
||||
root.reorderOver = -1
|
||||
root.reorderDropPlaylist = ""
|
||||
}
|
||||
QbzBridge.dragStart(modelData.id, modelData.title,
|
||||
modelData.artist + " · " + modelData.album, g.x, g.y)
|
||||
}
|
||||
if (parent.dragging) {
|
||||
QbzBridge.dragMove(g.x, g.y)
|
||||
}
|
||||
}
|
||||
onReleased: function (mouse) {
|
||||
if (parent.dragging) {
|
||||
QbzBridge.dragEnd()
|
||||
parent.dragging = false
|
||||
} else {
|
||||
QbzBridge.playlistPlayTrack(modelData.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 12
|
||||
anchors.rightMargin: 12
|
||||
spacing: 14
|
||||
// # / hover play.
|
||||
Rectangle {
|
||||
width: 32
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
Text {
|
||||
visible: !rowArea.containsMouse
|
||||
anchors.centerIn: parent
|
||||
text: index + 1
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 13
|
||||
}
|
||||
Rectangle {
|
||||
visible: rowArea.containsMouse
|
||||
anchors.centerIn: parent
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: "#3dffffff"
|
||||
QbzIcon { name: "play-fill"; width: 14; height: 14; anchors.centerIn: parent; tintName: "primary" }
|
||||
}
|
||||
}
|
||||
// 36px artwork cell.
|
||||
Rectangle {
|
||||
width: 36
|
||||
height: 36
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
radius: 4
|
||||
color: theme.surfaceElevated
|
||||
clip: true
|
||||
RoundedImage {
|
||||
anchors.fill: parent
|
||||
source: modelData.artPath || ""
|
||||
radius: 4
|
||||
}
|
||||
}
|
||||
// Title (+ explicit) / artist.
|
||||
Column {
|
||||
width: parent.width - 32 - 36 - 220 - 70 - 92 - 28 - 28 - 32 - 8 * 14
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 2
|
||||
Row {
|
||||
spacing: 6
|
||||
Text {
|
||||
width: Math.min(implicitWidth, parent.parent.width - (modelData.explicit ? 22 : 0))
|
||||
text: modelData.title
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: 14
|
||||
font.weight: theme.weightMedium
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Rectangle {
|
||||
visible: modelData.explicit
|
||||
width: 16
|
||||
height: 16
|
||||
radius: 3
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: theme.surfaceElevated
|
||||
Text { anchors.centerIn: parent; text: "E"; color: theme.textMuted; font.pixelSize: 10; font.weight: theme.weightSemibold }
|
||||
}
|
||||
}
|
||||
Text {
|
||||
width: parent.width
|
||||
text: modelData.artist
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 12
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
// Album (link).
|
||||
Text {
|
||||
width: 220
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: modelData.album
|
||||
color: albumArea.containsMouse ? theme.accent : theme.textMuted
|
||||
font.pixelSize: 12
|
||||
elide: Text.ElideRight
|
||||
MouseArea {
|
||||
id: albumArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: modelData.albumId !== "" ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: if (modelData.albumId !== "") QbzBridge.openAlbum(modelData.albumId)
|
||||
}
|
||||
}
|
||||
Text {
|
||||
width: 70
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: modelData.duration
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 12
|
||||
}
|
||||
Rectangle {
|
||||
width: 92
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: 6
|
||||
Image {
|
||||
visible: modelData.qualityTier === "hires"
|
||||
source: "assets/hi-res.svg"
|
||||
width: 42
|
||||
height: 28
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
sourceSize: Qt.size(84, 56)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
Rectangle {
|
||||
visible: modelData.qualityTier === "cd"
|
||||
width: 30
|
||||
height: 30
|
||||
radius: 3
|
||||
color: theme.surfaceElevated
|
||||
border.width: 1
|
||||
border.color: theme.borderSubtle
|
||||
QbzIcon { name: "cd"; width: 16; height: 16; anchors.centerIn: parent; tintName: "muted" }
|
||||
}
|
||||
}
|
||||
}
|
||||
// Favorite.
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: heartArea.containsMouse ? theme.surfaceElevated : "transparent"
|
||||
QbzIcon {
|
||||
name: modelData.isFavorite ? "heart-filled" : "heart"
|
||||
width: 15
|
||||
height: 15
|
||||
anchors.centerIn: parent
|
||||
tintName: modelData.isFavorite ? "favorite" : "muted"
|
||||
}
|
||||
MouseArea {
|
||||
id: heartArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
modelData.isFavorite = !modelData.isFavorite
|
||||
QbzBridge.libraryToggleFavorite("track", modelData.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Cloud reserve (offline-download column — not ported; the
|
||||
// Slint reserves the slot so the grid stays aligned).
|
||||
Item { width: 28; height: 28 }
|
||||
// ⋯ menu.
|
||||
Rectangle {
|
||||
width: 32
|
||||
height: 32
|
||||
radius: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: menuArea.containsMouse ? theme.surfaceElevated : "transparent"
|
||||
QbzIcon { name: "ellipsis"; width: 15; height: 15; anchors.centerIn: parent; tintName: "secondary" }
|
||||
MouseArea {
|
||||
id: menuArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: function (mouse) { rowMenu.openAtCursor(menuArea, mouse.x, mouse.y) }
|
||||
}
|
||||
}
|
||||
}
|
||||
QbzContextMenu {
|
||||
id: rowMenu
|
||||
menuWidth: 220
|
||||
Repeater {
|
||||
model: [
|
||||
{ "label": QbzBridge.tr("Play", QbzBridge.trRev), "icon": "play-fill", "action": "play" },
|
||||
{ "label": QbzBridge.tr("Play next", QbzBridge.trRev), "icon": "list-start", "action": "next" },
|
||||
{ "label": QbzBridge.tr("Play later", QbzBridge.trRev), "icon": "list-plus", "action": "later" },
|
||||
{ "label": QbzBridge.tr("Add to queue", QbzBridge.trRev), "icon": "list-end", "action": "queue" },
|
||||
{ "label": QbzBridge.tr("Go to artist", QbzBridge.trRev), "icon": "user", "action": "go-artist", "show": modelData.artistId !== "" },
|
||||
{ "label": QbzBridge.tr("Go to album", QbzBridge.trRev), "icon": "disc", "action": "go-album", "show": modelData.albumId !== "" },
|
||||
{ "label": modelData.isFavorite ? QbzBridge.tr("Remove from Library", QbzBridge.trRev) : QbzBridge.tr("Add to Library", QbzBridge.trRev),
|
||||
"icon": modelData.isFavorite ? "heart-filled" : "heart", "action": "favorite" },
|
||||
{ "label": QbzBridge.tr("Remove from playlist", QbzBridge.trRev), "icon": "trash-2", "action": "remove", "show": root.isOwner },
|
||||
]
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
visible: modelData.show === undefined || modelData.show === true
|
||||
width: parent ? parent.width : 0
|
||||
height: visible ? 33 : 0
|
||||
radius: 5
|
||||
color: rmiArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 8
|
||||
spacing: 8
|
||||
QbzIcon { name: modelData.icon; width: 15; height: 15; anchors.verticalCenter: parent.verticalCenter; tintName: "secondary" }
|
||||
Text {
|
||||
height: parent.height
|
||||
text: modelData.label
|
||||
color: theme.textSecondary
|
||||
font.pixelSize: 13
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: rmiArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
rowMenu.close()
|
||||
var a = modelData.action
|
||||
var row = parent.parent.parent.modelData
|
||||
if (a === "play") QbzBridge.playlistPlayTrack(row.id)
|
||||
else if (a === "next") QbzBridge.playlistEnqueueTrack(row.id, "next")
|
||||
else if (a === "later") QbzBridge.playlistEnqueueTrack(row.id, "later")
|
||||
else if (a === "queue") QbzBridge.playlistEnqueueTrack(row.id, "queue")
|
||||
else if (a === "go-artist") QbzBridge.openArtist(row.artistId)
|
||||
else if (a === "go-album") QbzBridge.openAlbum(row.albumId)
|
||||
else if (a === "favorite") {
|
||||
row.isFavorite = !row.isFavorite
|
||||
QbzBridge.libraryToggleFavorite("track", row.id)
|
||||
}
|
||||
else if (a === "remove") QbzBridge.playlistRemoveTrack(row.playlistTrackId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============================ the view ================================
|
||||
Column {
|
||||
@@ -549,45 +231,45 @@ Rectangle {
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: 12
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
name: "play-fill"
|
||||
primary: true
|
||||
btnEnabled: root.allTracks.length > 0
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: QbzBridge.playlistPlayAll()
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
name: "shuffle"
|
||||
btnEnabled: root.allTracks.length > 0
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: QbzBridge.playlistShuffle()
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
name: (doc.isFavorite === true) ? "heart-filled" : "heart"
|
||||
active: doc.isFavorite === true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: QbzBridge.playlistToggleFavorite()
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
name: (doc.pinned === true) ? "pin-filled" : "pin"
|
||||
active: doc.pinned === true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: QbzBridge.playlistTogglePin()
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
visible: !root.isOwner
|
||||
name: (doc.isFollowing === true) ? "check" : "user-plus"
|
||||
active: doc.isFollowing === true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: QbzBridge.playlistToggleFollow()
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
visible: !root.isOwner && doc.isCopied !== true
|
||||
name: "copy"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: QbzBridge.playlistCopy()
|
||||
}
|
||||
CircleBtn {
|
||||
QbzCircleAction {
|
||||
visible: root.isOwner
|
||||
name: "pen-line"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -769,7 +451,28 @@ Rectangle {
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
cacheBuffer: 500
|
||||
model: root.tracks
|
||||
delegate: PlTrackRow { }
|
||||
delegate: TrackRow {
|
||||
required property var modelData
|
||||
required property int index
|
||||
width: parent ? parent.width : 0
|
||||
item: modelData
|
||||
number: index + 1
|
||||
showArtwork: true
|
||||
showAlbum: true
|
||||
showDownload: true
|
||||
menuShowRemove: root.isOwner
|
||||
onPlayRequested: QbzBridge.playlistPlayTrack(item.id)
|
||||
onEnqueueRequested: function (m) { QbzBridge.playlistEnqueueTrack(item.id, m) }
|
||||
onRemoveRequested: QbzBridge.playlistRemoveTrack(item.playlistTrackId)
|
||||
onBodyDragStarted: function (n) {
|
||||
// #589: report the source index BEFORE the shared drag.
|
||||
if (root.isOwner) {
|
||||
root.reorderFrom = index
|
||||
root.reorderOver = -1
|
||||
root.reorderDropPlaylist = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Drop indicator: a 2px accent line at the insertion slot,
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// QbzCircleAction — the on-surface circular header action (Slint
|
||||
// primitives/CircleAction.slint on-surface arm), consolidated in phase 22
|
||||
// from THREE copies (AlbumView.CircleBtn ≡ ArtistView.CircleBtn,
|
||||
// PlaylistView.CircleBtn = superset with the `primary` + `btnEnabled`
|
||||
// arms). 32px elevated disc + 1.5px muted ring (active = accent glyph);
|
||||
// `primary` = 40px accent disc (black glyph).
|
||||
// NOTE: the OVERLAY-palette circle buttons (on artwork) are the separate
|
||||
// CardOverlayButton.qml — different palette, deliberately not merged.
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
|
||||
Rectangle {
|
||||
property string name: ""
|
||||
property bool active: false
|
||||
property bool primary: false
|
||||
property bool btnEnabled: true
|
||||
signal clicked(var mouse)
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
width: primary ? 40 : 32
|
||||
height: primary ? 40 : 32
|
||||
radius: width / 2
|
||||
color: primary ? (cbArea.containsMouse && btnEnabled ? theme.accentHover : theme.accent)
|
||||
: (cbArea.containsMouse || active) ? theme.surfaceHover : theme.surfaceElevated
|
||||
border.width: primary ? 0 : 1.5
|
||||
border.color: theme.borderMuted
|
||||
opacity: btnEnabled ? 1.0 : 0.4
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: primary ? 20 : 15
|
||||
height: primary ? 20 : 15
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.primary ? "black" : (parent.active ? "accent" : "primary")
|
||||
}
|
||||
MouseArea {
|
||||
id: cbArea
|
||||
anchors.fill: parent
|
||||
enabled: parent.btnEnabled
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: function (mouse) { parent.clicked(mouse) }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// QbzEmptyState — the plain centered empty state (title + optional icon /
|
||||
// body / action), consolidated in phase 22 from HomeView.RecentPlaceholder,
|
||||
// QueuePanel's empty queue, SearchView's no-results and Cortinilla's
|
||||
// no-results. Slint has no shared EmptyState either (per-surface inline) —
|
||||
// this is a POC-only consolidation; arms: `iconName` ("" = none), `title`,
|
||||
// `body` ("" = hidden), `actionLabel` + `actionClicked()` ("" = no action).
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
|
||||
Column {
|
||||
property string iconName: ""
|
||||
property string title: ""
|
||||
property string body: ""
|
||||
property string actionLabel: ""
|
||||
signal actionClicked()
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
spacing: 0
|
||||
QbzIcon {
|
||||
visible: iconName !== ""
|
||||
name: iconName
|
||||
width: 40
|
||||
height: 40
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
tintName: "muted"
|
||||
}
|
||||
Item { visible: iconName !== ""; width: 1; height: 14 }
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: title
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontSection
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
Item { visible: body !== ""; width: 1; height: 6 }
|
||||
Text {
|
||||
visible: body !== ""
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: body
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 13
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
Item { visible: actionLabel !== ""; width: 1; height: 14 }
|
||||
SettingsButton {
|
||||
visible: actionLabel !== ""
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: actionLabel
|
||||
onClicked: parent.actionClicked()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// QbzIconButton — the square icon button (Slint BarControls IconButton /
|
||||
// HeaderIconButton), consolidated in phase 22 from PlayerBar.BarIconBtn +
|
||||
// NowPlayingBarSmall.BarIconBtn (verbatim twins), QueuePanel.PanelIconBtn
|
||||
// and HeaderBar.HeaderIconBtn.
|
||||
// Arms: `btnSize` (32 default; 30 compact panels, 36 header), `iconSize`,
|
||||
// `active` (accent glyph), `activeBackground` (HeaderBar: elevated fill
|
||||
// when active), `btnEnabled` (dims 0.3 + muted glyph, disarms).
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
|
||||
Rectangle {
|
||||
property string name: ""
|
||||
property int btnSize: 32
|
||||
property int iconSize: 16
|
||||
property bool active: false
|
||||
property bool activeBackground: false
|
||||
property bool btnEnabled: true
|
||||
signal clicked()
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
width: btnSize
|
||||
height: btnSize
|
||||
radius: theme.radiusSm
|
||||
opacity: btnEnabled ? 1.0 : 0.3
|
||||
color: (biArea.containsMouse && btnEnabled) ? theme.surfaceHover
|
||||
: (active && activeBackground) ? theme.surfaceElevated : "transparent"
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: parent.iconSize
|
||||
height: parent.iconSize
|
||||
anchors.centerIn: parent
|
||||
tintName: !parent.btnEnabled ? "muted"
|
||||
: parent.active ? "accent"
|
||||
: biArea.containsMouse ? "primary" : "secondary"
|
||||
}
|
||||
MouseArea {
|
||||
id: biArea
|
||||
anchors.fill: parent
|
||||
enabled: parent.btnEnabled
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: if (parent.btnEnabled) parent.clicked()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// QbzNavButton — the 28px circular page/history chevron (Slint NavButton),
|
||||
// consolidated in phase 22 from THREE identical copies (HomeView.NavBtn,
|
||||
// SectionRail.RailNavBtn, HeaderBar.HeaderNavBtn). Contract: icon `name`,
|
||||
// `btnEnabled` (dims to 0.4 + muted glyph, disarms), `clicked()`.
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
|
||||
Rectangle {
|
||||
property string name: ""
|
||||
property bool btnEnabled: true
|
||||
signal clicked()
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
opacity: btnEnabled ? 1.0 : 0.4
|
||||
color: (nbArea.containsMouse && btnEnabled) ? theme.surfaceHover : theme.surfaceElevated
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: 15
|
||||
height: 15
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.btnEnabled ? "primary" : "muted"
|
||||
}
|
||||
MouseArea {
|
||||
id: nbArea
|
||||
anchors.fill: parent
|
||||
enabled: parent.btnEnabled
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// QbzOfflinePlaceholder — the offline gate (offline/OfflinePlaceholder
|
||||
// .slint), consolidated in phase 22 from the TWO verbatim copies
|
||||
// (HomeView + LibraryView). Arms: `induced` (offlineMode === 2) switches
|
||||
// the body copy; `showSettingsAction` mounts the induced-only "Open
|
||||
// Settings" button (POC-NOTE: navigates via QbzBridge.navigateTo —
|
||||
// the Slint opens Settings the same way).
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
|
||||
Column {
|
||||
property bool induced: QbzBridge.offlineMode === 2
|
||||
property bool showSettingsAction: false
|
||||
signal settingsClicked()
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
spacing: 0
|
||||
QbzIcon {
|
||||
name: "cloud-off"
|
||||
width: 56
|
||||
height: 56
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
tintName: "muted"
|
||||
}
|
||||
Item { width: 1; height: 18 }
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: QbzBridge.tr("You're offline", QbzBridge.trRev)
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontHeading
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
Item { width: 1; height: 8 }
|
||||
Text {
|
||||
width: 420
|
||||
text: induced
|
||||
? QbzBridge.tr("Offline mode is enabled. Disable it in Settings to use Qobuz.", QbzBridge.trRev)
|
||||
: QbzBridge.tr("No internet connection. Your local library and downloads keep working.", QbzBridge.trRev)
|
||||
color: theme.textSecondary
|
||||
font.pixelSize: theme.fontBody
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
Item { visible: showSettingsAction && induced; width: 1; height: 18 }
|
||||
SettingsButton {
|
||||
visible: showSettingsAction && induced
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: QbzBridge.tr("Open Settings", QbzBridge.trRev)
|
||||
onClicked: parent.settingsClicked()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// QbzSectionHeader — the section/rail header (Slint Carousel header:
|
||||
// title + [View all] LEFT of the page chevrons), consolidated in phase 22
|
||||
// from HomeView.RailHeader (+ its ViewAllLink), SectionRail's header and
|
||||
// SearchView.SectionHeader. Slint has NO shared SectionHeader primitive
|
||||
// (each carousel inlines one) — this is a POC consolidation of the three
|
||||
// identical-in-intent copies.
|
||||
//
|
||||
// Arms: `title` (fontSection semibold); `showViewAll` + `viewAllLabel` +
|
||||
// `viewAllAccent` (Search's accent chip vs Home's secondary link) +
|
||||
// viewAllClicked(); `showChevrons` + `leftEnabled`/`rightEnabled` +
|
||||
// pageLeft()/pageRight() (the host owns the page-step math).
|
||||
// Deliberately NOT absorbed: ArtistView.ReleaseSection's header (adds a
|
||||
// sort dropdown + "See discography" — distinct arms, still stubs) and the
|
||||
// uppercase 10-11px eyebrow mini-headers (different type scale).
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
|
||||
Item {
|
||||
property string title: ""
|
||||
property bool showViewAll: false
|
||||
property string viewAllLabel: ""
|
||||
property bool viewAllAccent: false
|
||||
property bool showChevrons: true
|
||||
property bool leftEnabled: false
|
||||
property bool rightEnabled: false
|
||||
signal viewAllClicked()
|
||||
signal pageLeft()
|
||||
signal pageRight()
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
width: parent ? parent.width : 0
|
||||
height: 28
|
||||
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: parent.title
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontSection
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
Row {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 4
|
||||
// "View all" link/chip (accent = Search's, secondary = Home's).
|
||||
Rectangle {
|
||||
visible: parent.parent.showViewAll
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: vaText.implicitWidth + 16
|
||||
height: 26
|
||||
radius: 4
|
||||
color: vaArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
Text {
|
||||
id: vaText
|
||||
anchors.centerIn: parent
|
||||
text: parent.parent.parent.viewAllLabel !== ""
|
||||
? parent.parent.parent.viewAllLabel
|
||||
: QbzBridge.tr("View all →", QbzBridge.trRev)
|
||||
color: parent.parent.parent.viewAllAccent ? theme.accent
|
||||
: vaArea.containsMouse ? theme.textPrimary : theme.textSecondary
|
||||
font.pixelSize: 14
|
||||
font.weight: theme.weightMedium
|
||||
}
|
||||
MouseArea {
|
||||
id: vaArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: parent.parent.parent.viewAllClicked()
|
||||
}
|
||||
}
|
||||
QbzNavButton {
|
||||
visible: parent.parent.showChevrons
|
||||
name: "chevron-left"
|
||||
btnEnabled: parent.parent.leftEnabled
|
||||
onClicked: parent.parent.pageLeft()
|
||||
}
|
||||
QbzNavButton {
|
||||
visible: parent.parent.showChevrons
|
||||
name: "chevron-right"
|
||||
btnEnabled: parent.parent.rightEnabled
|
||||
onClicked: parent.parent.pageRight()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
// QbzTabBar — the segmented tab pill bar (primitives/SegmentedTabBar
|
||||
// .slint), consolidated in phase 22 from HomeView's discover tab pill and
|
||||
// LibraryView's SegTab row (+ the playlists sub-tab via `compact`).
|
||||
// Arms: `tabs` ([{id, label, count?}]), `activeId`, `counts` (11px count
|
||||
// chip), `underline` (2px accent active cue — the Slint redundant-shape
|
||||
// cue), `compact` (24px mini variant). Emits selected(id); the host owns
|
||||
// side effects (scroll resets, refetches).
|
||||
// Deliberately NOT absorbed (Slint keeps them per-surface too): the
|
||||
// SearchView underline tab strip, QueuePanel's text tabs, ArtistView's
|
||||
// scroll-spy jump links.
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
property var tabs: []
|
||||
property string activeId: ""
|
||||
property bool counts: false
|
||||
property bool underline: false
|
||||
property bool compact: false
|
||||
signal selected(string id)
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
width: segBarRow.width
|
||||
height: segBarRow.height
|
||||
color: theme.surfaceElevated
|
||||
radius: 6
|
||||
|
||||
Row {
|
||||
id: segBarRow
|
||||
padding: root.compact ? 2 : 3
|
||||
spacing: 4
|
||||
Repeater {
|
||||
model: root.tabs
|
||||
delegate: Rectangle {
|
||||
id: segRoot
|
||||
required property var modelData
|
||||
readonly property bool active: modelData.id === root.activeId
|
||||
readonly property int count: modelData.count || 0
|
||||
|
||||
width: segRow.implicitWidth
|
||||
height: segRow.implicitHeight
|
||||
radius: 4
|
||||
color: active ? theme.surfaceMain
|
||||
: segArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
|
||||
Row {
|
||||
id: segRow
|
||||
leftPadding: root.compact ? 8 : 12
|
||||
rightPadding: (root.compact ? 8 : 12) - (root.counts && segRoot.count > 0 ? 4 : 0)
|
||||
topPadding: root.compact ? 4 : 6
|
||||
bottomPadding: root.compact ? 4 : 6
|
||||
spacing: 7
|
||||
Text {
|
||||
text: segRoot.modelData.label
|
||||
color: segRoot.active ? theme.textPrimary : theme.textMuted
|
||||
font.pixelSize: root.compact ? 12 : theme.fontLegal
|
||||
font.weight: theme.weightMedium
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Rectangle {
|
||||
visible: root.counts && segRoot.count > 0
|
||||
width: Math.max(18, countText.implicitWidth + 10)
|
||||
height: 16
|
||||
radius: 8
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: segRoot.active ? "#26ffffff" : "#14ffffff"
|
||||
Text {
|
||||
id: countText
|
||||
anchors.centerIn: parent
|
||||
text: segRoot.count
|
||||
color: segRoot.active ? theme.textPrimary : theme.textSecondary
|
||||
font.pixelSize: 11
|
||||
font.weight: theme.weightMedium
|
||||
}
|
||||
}
|
||||
}
|
||||
// Active underline (redundant shape cue, Slint Segment).
|
||||
Rectangle {
|
||||
visible: root.underline && segRoot.active
|
||||
x: 4
|
||||
width: parent.width - 8
|
||||
height: 2
|
||||
y: parent.height - 2
|
||||
radius: 1
|
||||
color: theme.accent
|
||||
}
|
||||
MouseArea {
|
||||
id: segArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.selected(segRoot.modelData.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,35 +79,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
// Row action icon button (the panel's small IconButton).
|
||||
component PanelIconBtn: Rectangle {
|
||||
property string name: ""
|
||||
property int iconSize: 17
|
||||
property bool active: false
|
||||
property bool btnEnabled: true
|
||||
signal clicked()
|
||||
|
||||
width: 30
|
||||
height: 30
|
||||
radius: theme.radiusSm
|
||||
color: (piArea.containsMouse && btnEnabled) ? theme.surfaceHover : "transparent"
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: parent.iconSize
|
||||
height: parent.iconSize
|
||||
anchors.centerIn: parent
|
||||
tintName: !parent.btnEnabled ? "muted"
|
||||
: parent.active ? "accent"
|
||||
: piArea.containsMouse ? "primary" : "secondary"
|
||||
}
|
||||
MouseArea {
|
||||
id: piArea
|
||||
anchors.fill: parent
|
||||
enabled: parent.btnEnabled
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
// One UP NEXT / History row (QueueRow.slint).
|
||||
component QueueRow: Rectangle {
|
||||
@@ -542,7 +514,7 @@ Rectangle {
|
||||
Row {
|
||||
id: paginator
|
||||
spacing: theme.spacingMd
|
||||
PanelIconBtn {
|
||||
QbzIconButton { btnSize: 30
|
||||
name: "chevron-left"
|
||||
iconSize: 15
|
||||
btnEnabled: (doc.page || 0) > 0
|
||||
@@ -554,7 +526,7 @@ Rectangle {
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 12
|
||||
}
|
||||
PanelIconBtn {
|
||||
QbzIconButton { btnSize: 30
|
||||
name: "chevron-right"
|
||||
iconSize: 15
|
||||
btnEnabled: (doc.page || 0) < (doc.pageCount || 1) - 1
|
||||
@@ -665,17 +637,17 @@ Rectangle {
|
||||
spacing: theme.spacingXs
|
||||
|
||||
// Action 1 — Clear queue (wired).
|
||||
PanelIconBtn {
|
||||
QbzIconButton { btnSize: 30
|
||||
name: "trash-list"
|
||||
onClicked: QbzBridge.queueClear()
|
||||
}
|
||||
// Action 2 — Save as playlist (INERT: opens a picker modal
|
||||
// upstream — POC-NOTE).
|
||||
PanelIconBtn { name: "add-to-list" }
|
||||
QbzIconButton { btnSize: 30; name: "add-to-list" }
|
||||
// Action 3 — infinite play (INERT engine — POC-NOTE).
|
||||
PanelIconBtn { name: "infinity" }
|
||||
QbzIconButton { btnSize: 30; name: "infinity" }
|
||||
// Action 4 — sleep timer (INERT engine — POC-NOTE).
|
||||
PanelIconBtn { name: "clock" }
|
||||
QbzIconButton { btnSize: 30; name: "clock" }
|
||||
|
||||
// Inline queue search field (wired).
|
||||
Rectangle {
|
||||
|
||||
@@ -138,248 +138,6 @@ Rectangle {
|
||||
|
||||
// Track row (primitives/TrackRow.slint, 50px — number/play, title +
|
||||
// explicit, artist, duration, quality, ⋯ menu).
|
||||
component SearchTrackRow: Rectangle {
|
||||
property var item: ({})
|
||||
property int number: 0
|
||||
width: parent ? parent.width : 0
|
||||
height: 50
|
||||
radius: 6
|
||||
color: strArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
|
||||
property bool dragging: false
|
||||
property point downPos: Qt.point(0, 0)
|
||||
MouseArea {
|
||||
id: strArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: function (mouse) { parent.downPos = Qt.point(mouse.x, mouse.y) }
|
||||
onPositionChanged: function (mouse) {
|
||||
if (!pressed) return
|
||||
const g = mapToItem(null, mouse.x, mouse.y)
|
||||
if (!parent.dragging
|
||||
&& (Math.abs(mouse.x - parent.downPos.x) > 6
|
||||
|| Math.abs(mouse.y - parent.downPos.y) > 6)) {
|
||||
parent.dragging = true
|
||||
QbzBridge.dragStart(item.id, item.title,
|
||||
item.artist + " · " + item.album, g.x, g.y)
|
||||
}
|
||||
if (parent.dragging) QbzBridge.dragMove(g.x, g.y)
|
||||
}
|
||||
onReleased: function (mouse) {
|
||||
if (parent.dragging) {
|
||||
QbzBridge.dragEnd()
|
||||
parent.dragging = false
|
||||
} else {
|
||||
QbzBridge.playTrack(item.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 12
|
||||
anchors.rightMargin: 12
|
||||
spacing: 14
|
||||
Rectangle {
|
||||
width: 32
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
Text {
|
||||
visible: !strArea.containsMouse
|
||||
anchors.centerIn: parent
|
||||
text: number
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 13
|
||||
}
|
||||
Rectangle {
|
||||
visible: strArea.containsMouse
|
||||
anchors.centerIn: parent
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: "#3dffffff"
|
||||
QbzIcon { name: "play-fill"; width: 14; height: 14; anchors.centerIn: parent; tintName: "primary" }
|
||||
}
|
||||
}
|
||||
Column {
|
||||
width: parent.width - 32 - 70 - 92 - 28 - 3 * 14
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 2
|
||||
Row {
|
||||
spacing: 6
|
||||
Text {
|
||||
width: Math.min(implicitWidth, parent.parent.width - (item.explicit ? 22 : 0))
|
||||
text: item.title
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: 14
|
||||
font.weight: theme.weightMedium
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Rectangle {
|
||||
visible: item.explicit
|
||||
width: 16
|
||||
height: 16
|
||||
radius: 3
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: theme.surfaceElevated
|
||||
Text { anchors.centerIn: parent; text: "E"; color: theme.textMuted; font.pixelSize: 10; font.weight: theme.weightSemibold }
|
||||
}
|
||||
}
|
||||
Text {
|
||||
width: parent.width
|
||||
text: item.artist
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 12
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
Text {
|
||||
width: 70
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
horizontalAlignment: Text.AlignRight
|
||||
text: item.duration
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 12
|
||||
}
|
||||
Rectangle {
|
||||
width: 92
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
Row {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 6
|
||||
Image {
|
||||
visible: item.qualityTier === "hires"
|
||||
source: "assets/hi-res.svg"
|
||||
width: 42
|
||||
height: 28
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
sourceSize: Qt.size(84, 56)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
Rectangle {
|
||||
visible: item.qualityTier === "cd"
|
||||
width: 30
|
||||
height: 30
|
||||
radius: 3
|
||||
color: theme.surfaceElevated
|
||||
border.width: 1
|
||||
border.color: theme.borderSubtle
|
||||
QbzIcon { name: "cd"; width: 16; height: 16; anchors.centerIn: parent; tintName: "muted" }
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: stmArea.containsMouse ? theme.surfaceElevated : "transparent"
|
||||
QbzIcon { name: "ellipsis"; width: 15; height: 15; anchors.centerIn: parent; tintName: "secondary" }
|
||||
MouseArea {
|
||||
id: stmArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: function (mouse) { strMenu.openAtCursor(stmArea, mouse.x, mouse.y) }
|
||||
}
|
||||
}
|
||||
}
|
||||
QbzContextMenu {
|
||||
id: strMenu
|
||||
menuWidth: 196
|
||||
Repeater {
|
||||
model: [
|
||||
{ "label": QbzBridge.tr("Play", QbzBridge.trRev), "icon": "play-fill", "action": "play" },
|
||||
{ "label": QbzBridge.tr("Play next", QbzBridge.trRev), "icon": "list-start", "action": "next" },
|
||||
{ "label": QbzBridge.tr("Play later", QbzBridge.trRev), "icon": "list-plus", "action": "later" },
|
||||
{ "label": QbzBridge.tr("Add to queue", QbzBridge.trRev), "icon": "list-end", "action": "queue" },
|
||||
{ "label": item.artistId !== "" ? QbzBridge.tr("Go to artist", QbzBridge.trRev) : "", "icon": "user", "action": "go-artist" },
|
||||
{ "label": item.albumId !== "" ? QbzBridge.tr("Go to album", QbzBridge.trRev) : "", "icon": "disc", "action": "go-album" },
|
||||
]
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
visible: modelData.label !== ""
|
||||
width: parent ? parent.width : 0
|
||||
height: visible ? 33 : 0
|
||||
radius: 5
|
||||
color: smiArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 8
|
||||
spacing: 8
|
||||
QbzIcon { name: modelData.icon; width: 15; height: 15; anchors.verticalCenter: parent.verticalCenter; tintName: "secondary" }
|
||||
Text {
|
||||
height: parent.height
|
||||
text: modelData.label
|
||||
color: theme.textSecondary
|
||||
font.pixelSize: 13
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: smiArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
strMenu.close()
|
||||
var a = modelData.action
|
||||
if (a === "play") QbzBridge.playTrack(item.id)
|
||||
else if (a === "next") QbzBridge.enqueueTrack(item.id, "next")
|
||||
else if (a === "later") QbzBridge.enqueueTrack(item.id, "later")
|
||||
else if (a === "queue") QbzBridge.enqueueTrack(item.id, "queue")
|
||||
else if (a === "go-artist") QbzBridge.openArtist(item.artistId)
|
||||
else if (a === "go-album") QbzBridge.openAlbum(item.albumId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Section header with an optional "View all" (SectionHeader).
|
||||
component SectionHeader: Item {
|
||||
property string title: ""
|
||||
property bool showMore: false
|
||||
signal moreClicked()
|
||||
width: parent ? parent.width : 0
|
||||
height: 30
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: title
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontSection
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
Rectangle {
|
||||
visible: showMore
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: moreText.implicitWidth + 16
|
||||
height: 26
|
||||
radius: 4
|
||||
color: moreArea.containsMouse ? theme.surfaceHover : "transparent"
|
||||
Text {
|
||||
id: moreText
|
||||
anchors.centerIn: parent
|
||||
text: QbzBridge.tr("View all", QbzBridge.trRev)
|
||||
color: theme.accent
|
||||
font.pixelSize: 14
|
||||
font.weight: theme.weightMedium
|
||||
}
|
||||
MouseArea {
|
||||
id: moreArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: parent.parent.moreClicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// "Load more (loaded / total)" (LoadMoreButton).
|
||||
component LoadMoreButton: Item {
|
||||
property int loaded: 0
|
||||
@@ -628,10 +386,12 @@ Rectangle {
|
||||
visible: root.artistsCarousel.length > 0
|
||||
width: parent.width - 224
|
||||
spacing: 12
|
||||
SectionHeader {
|
||||
QbzSectionHeader {
|
||||
title: QbzBridge.tr("Artists", QbzBridge.trRev)
|
||||
showMore: true
|
||||
onMoreClicked: QbzBridge.searchTabChanged(3)
|
||||
showViewAll: true
|
||||
viewAllAccent: true
|
||||
showChevrons: false
|
||||
onViewAllClicked: QbzBridge.searchTabChanged(3)
|
||||
}
|
||||
ListView {
|
||||
width: parent.width
|
||||
@@ -653,10 +413,12 @@ Rectangle {
|
||||
visible: root.tab === 0 && (root.mp.kind || "") === "" && root.artists.length > 0
|
||||
width: parent.width
|
||||
spacing: 12
|
||||
SectionHeader {
|
||||
QbzSectionHeader {
|
||||
title: QbzBridge.tr("Artists", QbzBridge.trRev)
|
||||
showMore: true
|
||||
onMoreClicked: QbzBridge.searchTabChanged(3)
|
||||
showViewAll: true
|
||||
viewAllAccent: true
|
||||
showChevrons: false
|
||||
onViewAllClicked: QbzBridge.searchTabChanged(3)
|
||||
}
|
||||
ListView {
|
||||
width: parent.width
|
||||
@@ -678,10 +440,12 @@ Rectangle {
|
||||
visible: root.tab === 0 && root.albums.length > 0
|
||||
width: parent.width
|
||||
spacing: 12
|
||||
SectionHeader {
|
||||
QbzSectionHeader {
|
||||
title: QbzBridge.tr("Albums", QbzBridge.trRev)
|
||||
showMore: true
|
||||
onMoreClicked: QbzBridge.searchTabChanged(1)
|
||||
showViewAll: true
|
||||
viewAllAccent: true
|
||||
showChevrons: false
|
||||
onViewAllClicked: QbzBridge.searchTabChanged(1)
|
||||
}
|
||||
ListView {
|
||||
width: parent.width
|
||||
@@ -740,14 +504,22 @@ Rectangle {
|
||||
visible: (root.tab === 0 || root.tab === 2) && root.tracks.length > 0
|
||||
width: parent.width
|
||||
spacing: 4
|
||||
SectionHeader {
|
||||
QbzSectionHeader {
|
||||
title: QbzBridge.tr("Tracks", QbzBridge.trRev)
|
||||
showMore: root.tab === 0 && (root.doc.tracksTotal || 0) > root.previewCap
|
||||
onMoreClicked: QbzBridge.searchTabChanged(2)
|
||||
showViewAll: root.tab === 0 && (root.doc.tracksTotal || 0) > root.previewCap
|
||||
viewAllAccent: true
|
||||
showChevrons: false
|
||||
onViewAllClicked: QbzBridge.searchTabChanged(2)
|
||||
}
|
||||
Repeater {
|
||||
model: root.tab === 2 ? root.tracks : root.tracks.slice(0, root.previewCap)
|
||||
delegate: SearchTrackRow { item: modelData; number: index + 1 }
|
||||
delegate: TrackRow {
|
||||
item: modelData
|
||||
number: index + 1
|
||||
menuShowFavorite: false
|
||||
onPlayRequested: QbzBridge.playTrack(item.id)
|
||||
onEnqueueRequested: function (m) { QbzBridge.enqueueTrack(item.id, m) }
|
||||
}
|
||||
}
|
||||
}
|
||||
LoadMoreButton {
|
||||
@@ -783,10 +555,12 @@ Rectangle {
|
||||
visible: root.tab === 0 && root.playlists.length > 0
|
||||
width: parent.width
|
||||
spacing: 12
|
||||
SectionHeader {
|
||||
QbzSectionHeader {
|
||||
title: QbzBridge.tr("Playlists", QbzBridge.trRev)
|
||||
showMore: true
|
||||
onMoreClicked: QbzBridge.searchTabChanged(4)
|
||||
showViewAll: true
|
||||
viewAllAccent: true
|
||||
showChevrons: false
|
||||
onViewAllClicked: QbzBridge.searchTabChanged(4)
|
||||
}
|
||||
ListView {
|
||||
width: parent.width
|
||||
|
||||
@@ -20,58 +20,14 @@ Column {
|
||||
readonly property int step: perPage * 232
|
||||
readonly property real maxScroll: Math.max(0, rail.contentWidth - rail.width)
|
||||
|
||||
component RailNavBtn: Rectangle {
|
||||
property string name: ""
|
||||
property bool btnEnabled: true
|
||||
signal clicked()
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
opacity: btnEnabled ? 1.0 : 0.4
|
||||
color: (nbArea.containsMouse && btnEnabled) ? theme.surfaceHover : theme.surfaceElevated
|
||||
QbzIcon {
|
||||
name: parent.name
|
||||
width: 15
|
||||
height: 15
|
||||
anchors.centerIn: parent
|
||||
tintName: parent.btnEnabled ? "primary" : "muted"
|
||||
}
|
||||
MouseArea {
|
||||
id: nbArea
|
||||
anchors.fill: parent
|
||||
enabled: parent.btnEnabled
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.btnEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 28
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: root.title
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: theme.fontSection
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
Row {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 4
|
||||
RailNavBtn {
|
||||
name: "chevron-left"
|
||||
btnEnabled: rail.contentX > 1
|
||||
onClicked: rail.contentX = Math.max(0, rail.contentX - root.step)
|
||||
}
|
||||
RailNavBtn {
|
||||
name: "chevron-right"
|
||||
btnEnabled: rail.contentX < root.maxScroll - 1
|
||||
onClicked: rail.contentX = Math.min(root.maxScroll, rail.contentX + root.step)
|
||||
}
|
||||
}
|
||||
|
||||
QbzSectionHeader {
|
||||
title: root.title
|
||||
leftEnabled: rail.contentX > 1
|
||||
rightEnabled: rail.contentX < root.maxScroll - 1
|
||||
onPageLeft: rail.contentX = Math.max(0, rail.contentX - root.step)
|
||||
onPageRight: rail.contentX = Math.min(root.maxScroll, rail.contentX + root.step)
|
||||
}
|
||||
|
||||
Item {
|
||||
|
||||
@@ -0,0 +1,367 @@
|
||||
// TrackRow — THE track list row (primitives/TrackRow.slint, POC arm
|
||||
// subset), consolidated in phase 22 from FOUR copies (AlbumView
|
||||
// .AlbumTrackRow, PlaylistView.PlTrackRow, LibraryView.TrackListRow,
|
||||
// SearchView.SearchTrackRow). 50px, radius 8: number→play cell (pause
|
||||
// swap + accent pill when it is the now-playing row — Slint-universal),
|
||||
// optional 36px art cell, title+explicit / artist column, optional 220px
|
||||
// album link, duration, quality (icon QualityMini | bare text), optional
|
||||
// heart, optional download slot (offline column — glyph stub or reserved
|
||||
// spacer until the offline cache lands, POC-NOTE), ⋯ CardMenu.
|
||||
//
|
||||
// item contract: { id, title, artist, artistId, album, albumId, number?,
|
||||
// duration, qualityTier, explicit, isFavorite, artPath? } (plus
|
||||
// playlistTrackId for the remove-from-playlist arm).
|
||||
//
|
||||
// Arms: showArtwork / showAlbum / showFavorite / showDownload /
|
||||
// downloadGlyph / showMenu / zebra / artistLink / clickPlays /
|
||||
// qualityStyle ("icon"|"text") / menuShowLater / menuShowGoTo /
|
||||
// menuShowFavorite / menuShowRemove.
|
||||
// Signals: playRequested() (per-site play: album-scoped, playlist-scoped
|
||||
// or plain), enqueueRequested(mode) ("next"|"later"|"queue"),
|
||||
// removeRequested(), bodyDragStarted(index) (fired BEFORE the shared
|
||||
// dragStart — the #589 reorder pre-hook).
|
||||
// Favorite toggling and Go-to-artist/album are identical on every site —
|
||||
// handled internally. The row BODY is the drag source (6px threshold,
|
||||
// ghost + sidebar drops in main.rs).
|
||||
//
|
||||
// Deliberately NOT consolidated here (Slint-distinct): QueuePanel.QueueRow
|
||||
// (QueueItem data + queue-op menu + press-and-hold reorder) and
|
||||
// LibraryView.FeedListRow (mixed-kind feed row — inline in Slint too).
|
||||
|
||||
import QtQuick
|
||||
import com.blitzfc.qbz
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
property var item: ({})
|
||||
property int number: 0
|
||||
property bool showArtwork: false
|
||||
property bool showAlbum: false
|
||||
property bool showFavorite: true
|
||||
property bool showDownload: false
|
||||
property bool downloadGlyph: false
|
||||
property bool showMenu: true
|
||||
property bool zebra: false
|
||||
property bool artistLink: false
|
||||
property bool clickPlays: true
|
||||
property string qualityStyle: "icon"
|
||||
property bool menuShowLater: true
|
||||
property bool menuShowGoTo: true
|
||||
property bool menuShowFavorite: true
|
||||
property bool menuShowRemove: false
|
||||
|
||||
signal playRequested()
|
||||
signal enqueueRequested(string mode)
|
||||
signal removeRequested()
|
||||
signal bodyDragStarted(int index)
|
||||
|
||||
QbzTheme { id: theme }
|
||||
|
||||
width: parent ? parent.width : 0
|
||||
height: 50
|
||||
radius: 8
|
||||
color: hovered ? theme.surfaceHover : (zebra && number % 2 === 0 ? "#07ffffff" : "transparent")
|
||||
|
||||
readonly property bool hovered: trArea.containsMouse || favArea.containsMouse || moreArea.containsMouse
|
||||
readonly property bool isActive: QbzBridge.npTrackId === (item.id || "")
|
||||
readonly property int cellsRight: 70 + 92 + (showFavorite ? 28 : 0) + (showDownload ? 28 : 0) + (showMenu ? 32 : 0)
|
||||
readonly property int cellsLeft: 32 + (showArtwork ? 36 : 0) + (showAlbum ? 220 : 0)
|
||||
readonly property int gaps: (3 + (showArtwork ? 1 : 0) + (showAlbum ? 1 : 0)
|
||||
+ (showFavorite ? 1 : 0) + (showDownload ? 1 : 0) + (showMenu ? 1 : 0)) * 14
|
||||
|
||||
// Static now-playing mark: 3px accent pill on the left edge.
|
||||
Rectangle {
|
||||
visible: root.isActive
|
||||
x: 2
|
||||
y: 7
|
||||
width: 3
|
||||
height: parent.height - 14
|
||||
radius: 1.5
|
||||
color: theme.accent
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 12
|
||||
anchors.rightMargin: 12
|
||||
spacing: 14
|
||||
|
||||
// Number cell — swaps to play on hover (pause when active+playing).
|
||||
Item {
|
||||
width: 32
|
||||
height: 40
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Text {
|
||||
visible: !trArea.containsMouse
|
||||
anchors.centerIn: parent
|
||||
text: root.number
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 13
|
||||
}
|
||||
Rectangle {
|
||||
visible: trArea.containsMouse
|
||||
anchors.centerIn: parent
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: root.isActive && QbzBridge.npPlaying ? "transparent" : "#3dffffff"
|
||||
border.width: root.isActive && QbzBridge.npPlaying ? 1.5 : 0
|
||||
border.color: theme.accent
|
||||
QbzIcon {
|
||||
anchors.centerIn: parent
|
||||
name: root.isActive && QbzBridge.npPlaying ? "pause" : "play-fill"
|
||||
width: 14
|
||||
height: 14
|
||||
tintName: root.isActive && QbzBridge.npPlaying ? "accent" : "primary"
|
||||
}
|
||||
}
|
||||
}
|
||||
// 36px artwork cell (showArtwork arm).
|
||||
Rectangle {
|
||||
visible: root.showArtwork
|
||||
width: 36
|
||||
height: 36
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
radius: 4
|
||||
color: theme.surfaceElevated
|
||||
clip: true
|
||||
RoundedImage {
|
||||
anchors.fill: parent
|
||||
source: root.item.artPath || ""
|
||||
radius: 4
|
||||
}
|
||||
}
|
||||
// Title (+ explicit) / artist.
|
||||
Column {
|
||||
width: parent.width - root.cellsLeft - root.cellsRight - root.gaps
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 2
|
||||
Row {
|
||||
spacing: 6
|
||||
Text {
|
||||
text: root.item.title || ""
|
||||
color: theme.textPrimary
|
||||
font.pixelSize: 14
|
||||
font.weight: theme.weightMedium
|
||||
elide: Text.ElideRight
|
||||
width: Math.min(implicitWidth, parent.parent.width - (root.item.explicit ? 22 : 0))
|
||||
}
|
||||
Rectangle {
|
||||
visible: root.item.explicit === true
|
||||
width: 16
|
||||
height: 16
|
||||
radius: 3
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: theme.surfaceElevated
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "E"
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 10
|
||||
font.weight: theme.weightSemibold
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
width: parent.width
|
||||
visible: (root.item.artist || "") !== ""
|
||||
text: root.item.artist || ""
|
||||
color: root.artistLink && root.item.artistId && artistLinkArea.containsMouse
|
||||
? theme.textPrimary : theme.textMuted
|
||||
font.pixelSize: 12
|
||||
elide: Text.ElideRight
|
||||
MouseArea {
|
||||
id: artistLinkArea
|
||||
anchors.fill: parent
|
||||
enabled: root.artistLink && !!root.item.artistId
|
||||
hoverEnabled: true
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: QbzBridge.openArtist(root.item.artistId)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Album (link) column (showAlbum arm).
|
||||
Text {
|
||||
visible: root.showAlbum
|
||||
width: 220
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: root.item.album || ""
|
||||
color: albumArea.containsMouse ? theme.accent : theme.textMuted
|
||||
font.pixelSize: 12
|
||||
elide: Text.ElideRight
|
||||
MouseArea {
|
||||
id: albumArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: root.item.albumId ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: if (root.item.albumId) QbzBridge.openAlbum(root.item.albumId)
|
||||
}
|
||||
}
|
||||
// Duration.
|
||||
Text {
|
||||
width: 70
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: root.item.duration || ""
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 12
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
// Quality (92px): icon (QualityMini) or bare text.
|
||||
Rectangle {
|
||||
width: 92
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
QualityMini {
|
||||
visible: root.qualityStyle === "icon"
|
||||
tier: root.item.qualityTier || ""
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
Text {
|
||||
visible: root.qualityStyle === "text"
|
||||
anchors.centerIn: parent
|
||||
text: root.item.qualityTier === "hires" ? "HI-RES" : (root.item.qualityTier === "cd" ? "CD" : "")
|
||||
color: theme.textMuted
|
||||
font.pixelSize: 10
|
||||
font.weight: theme.weightBold
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
// Favorite (showFavorite arm).
|
||||
Rectangle {
|
||||
visible: root.showFavorite
|
||||
width: 28
|
||||
height: 28
|
||||
radius: theme.radiusSm
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: favArea.containsMouse ? theme.surfaceElevated : "transparent"
|
||||
QbzIcon {
|
||||
anchors.centerIn: parent
|
||||
name: root.item.isFavorite ? "heart-filled" : "heart"
|
||||
width: 16
|
||||
height: 16
|
||||
tintName: root.item.isFavorite ? "favorite" : (favArea.containsMouse ? "primary" : "muted")
|
||||
}
|
||||
MouseArea {
|
||||
id: favArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
root.item.isFavorite = !root.item.isFavorite
|
||||
QbzBridge.libraryToggleFavorite("track", root.item.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Download slot (showDownload arm): inert glyph stub or reserved
|
||||
// spacer (the offline-cache column — not ported, POC-NOTE; the
|
||||
// Slint reserves the slot so the grid stays aligned).
|
||||
Item {
|
||||
visible: root.showDownload
|
||||
width: 28
|
||||
height: 28
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
QbzIcon {
|
||||
visible: root.downloadGlyph
|
||||
anchors.centerIn: parent
|
||||
name: "cloud-download"
|
||||
width: 16
|
||||
height: 16
|
||||
tintName: "muted"
|
||||
}
|
||||
}
|
||||
// ⋯ menu (showMenu arm).
|
||||
Rectangle {
|
||||
visible: root.showMenu
|
||||
width: 32
|
||||
height: 32
|
||||
radius: theme.radiusSm
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: moreArea.containsMouse ? theme.surfaceElevated : "transparent"
|
||||
QbzIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "ellipsis"
|
||||
width: 16
|
||||
height: 16
|
||||
tintName: moreArea.containsMouse ? "primary" : "muted"
|
||||
}
|
||||
MouseArea {
|
||||
id: moreArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: function (mouse) { rowMenu.openAtCursor(moreArea, mouse.x, mouse.y) }
|
||||
}
|
||||
}
|
||||
}
|
||||
CardMenu {
|
||||
id: rowMenu
|
||||
menuWidth: 220
|
||||
entries: {
|
||||
var m = [
|
||||
{ "label": QbzBridge.tr("Play", QbzBridge.trRev), "icon": "play-fill", "action": "play" },
|
||||
{ "label": QbzBridge.tr("Play next", QbzBridge.trRev), "icon": "list-start", "action": "next" },
|
||||
]
|
||||
if (root.menuShowLater) m.push({ "label": QbzBridge.tr("Play later", QbzBridge.trRev), "icon": "list-plus", "action": "later" })
|
||||
m.push({ "label": QbzBridge.tr("Add to queue", QbzBridge.trRev), "icon": "list-end", "action": "queue" })
|
||||
if (root.menuShowGoTo && root.item.artistId) m.push({ "label": QbzBridge.tr("Go to artist", QbzBridge.trRev), "icon": "user", "action": "go-artist" })
|
||||
if (root.menuShowGoTo && root.item.albumId) m.push({ "label": QbzBridge.tr("Go to album", QbzBridge.trRev), "icon": "disc", "action": "go-album" })
|
||||
if (root.menuShowFavorite) m.push({
|
||||
"label": root.item.isFavorite ? QbzBridge.tr("Remove from Library", QbzBridge.trRev) : QbzBridge.tr("Add to Library", QbzBridge.trRev),
|
||||
"icon": root.item.isFavorite ? "heart-filled" : "heart", "action": "favorite" })
|
||||
if (root.menuShowRemove) m.push({ "label": QbzBridge.tr("Remove from playlist", QbzBridge.trRev), "icon": "trash-2", "action": "remove" })
|
||||
return m
|
||||
}
|
||||
onPicked: function (a) {
|
||||
if (a === "play") root.playRequested()
|
||||
else if (a === "next") root.enqueueRequested("next")
|
||||
else if (a === "later") root.enqueueRequested("later")
|
||||
else if (a === "queue") root.enqueueRequested("queue")
|
||||
else if (a === "go-artist") QbzBridge.openArtist(root.item.artistId)
|
||||
else if (a === "go-album") QbzBridge.openAlbum(root.item.albumId)
|
||||
else if (a === "favorite") {
|
||||
root.item.isFavorite = !root.item.isFavorite
|
||||
QbzBridge.libraryToggleFavorite("track", root.item.id)
|
||||
} else if (a === "remove") root.removeRequested()
|
||||
}
|
||||
}
|
||||
|
||||
// Shared drag (the row BODY is the source — TrackRow.slint): press-drag
|
||||
// >6px starts it (bodyDragStarted fires FIRST, the #589 pre-hook);
|
||||
// release plays (clickPlays) or ignores (album view: double-click).
|
||||
property bool dragging: false
|
||||
property point downPos: Qt.point(0, 0)
|
||||
MouseArea {
|
||||
id: trArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
cursorShape: root.clickPlays ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onPressed: function (mouse) { root.downPos = Qt.point(mouse.x, mouse.y) }
|
||||
onPositionChanged: function (mouse) {
|
||||
if (!pressed) return
|
||||
const g = mapToItem(null, mouse.x, mouse.y)
|
||||
if (!root.dragging
|
||||
&& (Math.abs(mouse.x - root.downPos.x) > 6
|
||||
|| Math.abs(mouse.y - root.downPos.y) > 6)) {
|
||||
root.dragging = true
|
||||
root.bodyDragStarted(root.number)
|
||||
QbzBridge.dragStart(root.item.id, root.item.title || "",
|
||||
(root.item.artist || "") + " · " + (root.item.album || ""), g.x, g.y)
|
||||
}
|
||||
if (root.dragging) QbzBridge.dragMove(g.x, g.y)
|
||||
}
|
||||
onReleased: function (mouse) {
|
||||
if (root.dragging) {
|
||||
QbzBridge.dragEnd()
|
||||
root.dragging = false
|
||||
mouse.accepted = true
|
||||
} else if (root.clickPlays) {
|
||||
root.playRequested()
|
||||
} else {
|
||||
mouse.accepted = false
|
||||
}
|
||||
}
|
||||
onDoubleClicked: root.playRequested()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user