Four things the owner hit in Local Library. The context menu did nothing there — local rows and cards now mount the shared menu the rest of the app uses, with the action set Slint gives local and Plex items. Anything with no seam in this port (add-to-playlist, add-to-mixtape, the tag editor, local favourites) is hidden or visibly disabled rather than a row that silently does nothing. The per-view search fields did not open and collapse the way the header's does. That behaviour moved into the shared QbzLineEdit, so the Local toolbar, the queue and the tree rail all get it from one place instead of four copies. The queue's field also escaped its 300px column; it is width-bound now. Filter, sorting and grouping become icon-only buttons with an explanatory tooltip, which is what the owner asked for and what the crowding called for. Found on the way, and affecting Qobuz cards too: the album card's ⋯ menu had no "Play later" at all, and its "Add to queue" row dispatched play-later — the row lied about what it did. Both fixed, with Slint's icon set for the three. cc
119 lines
4.1 KiB
QML
119 lines
4.1 KiB
QML
// Icon-only dropdown for the Local Library toolbars: a 34x30 bordered button
|
|
// — the SAME chrome as the quality/format filter button beside it
|
|
// (LocalLibraryView.slint:857) — that opens its option list as the shared
|
|
// controls/QbzContextMenu.qml, with a check on the current option and a hover
|
|
// tooltip naming the control AND its current value.
|
|
//
|
|
// DELIBERATE DIVERGENCE from the reference: LocalLibraryView.slint spends this
|
|
// space on full-text QbzSelects (sort :793 / :952 / :1033, group :824 / :988 /
|
|
// :1063). The owner asked for icon-only + tooltip because the toolbar row was
|
|
// too crowded. The option lists, their order, the persisted keys and the
|
|
// wiring are unchanged — only the trigger's presentation is.
|
|
|
|
import QtQuick
|
|
import com.blitzfc.qbz
|
|
import "../../controls"
|
|
import "../../theme"
|
|
|
|
Item {
|
|
id: root
|
|
|
|
property string iconName: ""
|
|
/// What the control IS ("Sort", "Group by") — the tooltip's lead.
|
|
property string label: ""
|
|
/// Plain label strings, in the same order the host maps to its keys.
|
|
property var options: []
|
|
property int currentIndex: 0
|
|
property int menuWidth: 190
|
|
/// Accent chrome while the control is off its default option (the
|
|
/// filter button's own "active" cue).
|
|
property bool marked: false
|
|
signal selected(int index)
|
|
|
|
QbzTheme { id: theme }
|
|
|
|
width: 34
|
|
height: 30
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
radius: 6
|
|
border.width: 1
|
|
border.color: root.marked ? theme.accent : theme.borderSubtle
|
|
color: btnArea.containsMouse ? theme.surfaceHover : theme.surfaceElevated
|
|
QbzIcon {
|
|
name: root.iconName
|
|
width: 15
|
|
height: 15
|
|
anchors.centerIn: parent
|
|
tintName: root.marked ? "accent" : "secondary"
|
|
}
|
|
MouseArea {
|
|
id: btnArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: menu.openBelowRight(root)
|
|
}
|
|
}
|
|
|
|
LocalTip {
|
|
visible: btnArea.containsMouse && !menu.visible
|
|
text: root.label
|
|
+ (root.currentIndex >= 0 && root.currentIndex < root.options.length
|
|
? ": " + root.options[root.currentIndex] : "")
|
|
}
|
|
|
|
QbzContextMenu {
|
|
id: menu
|
|
menuWidth: root.menuWidth
|
|
|
|
Repeater {
|
|
model: root.options
|
|
delegate: Rectangle {
|
|
id: optRow
|
|
required property var modelData
|
|
required property int index
|
|
width: parent ? parent.width : 0
|
|
height: 33
|
|
radius: 5
|
|
color: optArea.containsMouse ? theme.surfaceHover : "transparent"
|
|
Row {
|
|
anchors.fill: parent
|
|
anchors.leftMargin: 8
|
|
anchors.rightMargin: 8
|
|
spacing: 8
|
|
QbzIcon {
|
|
// "" renders nothing — the slot keeps the labels aligned.
|
|
name: optRow.index === root.currentIndex ? "check" : ""
|
|
width: 15
|
|
height: 15
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
tintName: "accent"
|
|
}
|
|
Text {
|
|
height: parent.height
|
|
width: parent.width - 23
|
|
text: optRow.modelData
|
|
color: optRow.index === root.currentIndex
|
|
? theme.accent : theme.textSecondary
|
|
font.pixelSize: 13
|
|
verticalAlignment: Text.AlignVCenter
|
|
elide: Text.ElideRight
|
|
}
|
|
}
|
|
MouseArea {
|
|
id: optArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: {
|
|
menu.close()
|
|
root.selected(optRow.index)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|