From 74e9bd2f6e10c3014e8fbeed05da5964e0564f92 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 23 Feb 2023 14:55:54 -0600 Subject: [PATCH] adding selectionModel and small ui tweaks --- src/qml/presenter/Library.qml | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/qml/presenter/Library.qml b/src/qml/presenter/Library.qml index a337c0d..84a2840 100644 --- a/src/qml/presenter/Library.qml +++ b/src/qml/presenter/Library.qml @@ -7,7 +7,6 @@ import QtQml.Models 2.15 import org.kde.kirigami 2.13 as Kirigami import "./" as Presenter import org.presenter 1.0 -import mpv 1.0 Item { id: root @@ -152,7 +151,7 @@ Item { onSelectionChanged: { showPassiveNotification("deslected: " + deselected); showPassiveNotification("selected: " + selected); - console.log(selected); + /* console.log(selected); */ } } delegate: songDelegate @@ -277,7 +276,7 @@ Item { rightClickSongMenu.popup() else if ((mouse.button === Qt.LeftButton) && (mouse.modifiers === Qt.ShiftModifier)) { - selectSongs(index); + songLibraryList.selectSongs(index); } else { songSelectionModel.select(songProxyModel.idx(index), ItemSelectionModel.ClearAndSelect); @@ -332,6 +331,26 @@ Item { editType = "song"; editSwitch(songLibraryList.currentIndex); } + + function selectSongs(row) { + /* console.log("SELECT SOME SONGS!") */ + let currentRow = songSelectionModel.selectedIndexes[0].row; + if (row === currentRow) + return; + + if (row > currentRow) { + for (var i = currentRow; i <= row; i++) { + let idx = songProxyModel.idx(i); + songSelectionModel.select(idx, ItemSelectionModel.Select); + } + } + else { + for (var i = row; i <= currentRow; i++) { + let idx = songProxyModel.idx(i); + songSelectionModel.select(idx, ItemSelectionModel.Select); + } + } + } } Rectangle { @@ -1105,7 +1124,10 @@ Item { height: selectedLibrary == "presentations" ? 50 : 0 clip: true label: title - icon: "x-office-presentation-symbolic" + icon: Kirigami.Icon { + source: "x-office-presentation-symbolic" + fallback: "x-office-presentation" + } iconSize: Kirigami.Units.gridUnit subtitle: { if (fileValidation)