feat(qt): Shift ranges on the artist page's album sections
"Play selected" arms a select mode over one album section, and its cards only ever toggled one at a time. Shift now adds the run from the last clicked card in the section's current sort order and Ctrl adds one, through the same SelectionModel every other select-mode list uses. The anchor drops when a section is armed or disarmed. cc
This commit is contained in:
1 file changed
+15
-7
@@ -350,15 +350,18 @@ Rectangle {
|
|||||||
property string albumSelectKey: ""
|
property string albumSelectKey: ""
|
||||||
property var albumSelected: ({})
|
property var albumSelected: ({})
|
||||||
readonly property int albumSelectedCount: Object.keys(root.albumSelected).length
|
readonly property int albumSelectedCount: Object.keys(root.albumSelected).length
|
||||||
function albumSelectToggle(id) {
|
/// The armed section's cards follow the same rule as every other
|
||||||
var m = Object.assign({}, root.albumSelected)
|
/// select-mode surface: Shift-click ranges over the section's cards in
|
||||||
if (m[id]) delete m[id]
|
/// their CURRENT sort order, Ctrl adds one (controls/SelectionModel.qml).
|
||||||
else m[id] = true
|
SelectionModel { id: albumSectionSel }
|
||||||
root.albumSelected = m
|
function albumSelectToggle(id, cards, mods) {
|
||||||
|
root.albumSelected = albumSectionSel.next(root.albumSelected, id, cards || [],
|
||||||
|
mods === undefined ? Qt.NoModifier : mods)
|
||||||
}
|
}
|
||||||
function albumSelectClear() {
|
function albumSelectClear() {
|
||||||
root.albumSelectKey = ""
|
root.albumSelectKey = ""
|
||||||
root.albumSelected = ({})
|
root.albumSelected = ({})
|
||||||
|
albumSectionSel.anchorId = ""
|
||||||
}
|
}
|
||||||
function albumSectionLabel(key) {
|
function albumSectionLabel(key) {
|
||||||
return root.albumSelectKey === key
|
return root.albumSelectKey === key
|
||||||
@@ -393,6 +396,7 @@ Rectangle {
|
|||||||
} else if (action === "play-selected") {
|
} else if (action === "play-selected") {
|
||||||
root.albumSelectKey = key
|
root.albumSelectKey = key
|
||||||
root.albumSelected = ({})
|
root.albumSelected = ({})
|
||||||
|
albumSectionSel.anchorId = ""
|
||||||
} else if (action === "cancel-selection") {
|
} else if (action === "cancel-selection") {
|
||||||
root.albumSelectClear()
|
root.albumSelectClear()
|
||||||
}
|
}
|
||||||
@@ -2261,7 +2265,9 @@ Rectangle {
|
|||||||
selectMode: root.albumSelectKey === (relSection.section.releaseType || "")
|
selectMode: root.albumSelectKey === (relSection.section.releaseType || "")
|
||||||
selected: root.albumSelected[modelData.id] === true
|
selected: root.albumSelected[modelData.id] === true
|
||||||
selectMarkBottom: true
|
selectMarkBottom: true
|
||||||
onSelectToggled: root.albumSelectToggle(modelData.id)
|
onSelectToggled: function (mods) {
|
||||||
|
root.albumSelectToggle(modelData.id, relSection.section.cards || [], mods)
|
||||||
|
}
|
||||||
|
|
||||||
// ---- smooth append (owner, 2026-08-02) ---------------
|
// ---- smooth append (owner, 2026-08-02) ---------------
|
||||||
// "que la aparicion de lo que se cargue, sea smooth" —
|
// "que la aparicion de lo que se cargue, sea smooth" —
|
||||||
@@ -3273,7 +3279,9 @@ Rectangle {
|
|||||||
selectMode: root.albumSelectKey === "library"
|
selectMode: root.albumSelectKey === "library"
|
||||||
selected: root.albumSelected[modelData.id] === true
|
selected: root.albumSelected[modelData.id] === true
|
||||||
selectMarkBottom: true
|
selectMarkBottom: true
|
||||||
onSelectToggled: root.albumSelectToggle(modelData.id)
|
onSelectToggled: function (mods) {
|
||||||
|
root.albumSelectToggle(modelData.id, root.libAlbumsSorted, mods)
|
||||||
|
}
|
||||||
albumId: modelData.id
|
albumId: modelData.id
|
||||||
title: modelData.title
|
title: modelData.title
|
||||||
artist: modelData.artist
|
artist: modelData.artist
|
||||||
|
|||||||
Reference in new issue
Block a user