summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/qml/Library.qml79
1 files changed, 79 insertions, 0 deletions
diff --git a/res/qml/Library.qml b/res/qml/Library.qml
index 706d4e263e..8311c2ee47 100644
--- a/res/qml/Library.qml
+++ b/res/qml/Library.qml
@@ -8,9 +8,88 @@ Item {
color: Theme.deckBackgroundColor
anchors.fill: parent
+ Mixxx.ControlProxy {
+ id: focusedWidgetControl
+
+ group: "[Library]"
+ key: "focused_widget"
+ Component.onCompleted: value = 3
+ }
+
+ Mixxx.ControlProxy {
+ group: "[Playlist]"
+ key: "SelectTrackKnob"
+ onValueChanged: {
+ listView.moveSelection(value);
+ }
+ }
+
+ Mixxx.ControlProxy {
+ group: "[Playlist]"
+ key: "SelectPrevTrack"
+ onValueChanged: {
+ if (value != 0)
+ listView.moveSelection(-1);
+
+ }
+ }
+
+ Mixxx.ControlProxy {
+ group: "[Playlist]"
+ key: "SelectNextTrack"
+ onValueChanged: {
+ if (value != 0)
+ listView.moveSelection(1);
+
+ }
+ }
+
+ Mixxx.ControlProxy {
+ group: "[Library]"
+ key: "MoveVertical"
+ onValueChanged: {
+ if (focusedWidgetControl.value == 3)
+ listView.moveSelection(value);
+
+ }
+ }
+
+ Mixxx.ControlProxy {
+ group: "[Library]"
+ key: "MoveUp"
+ onValueChanged: {
+ if (value != 0 && focusedWidgetControl.value == 3)
+ listView.moveSelection(-1);
+
+ }
+ }
+
+ Mixxx.ControlProxy {
+ group: "[Library]"
+ key: "MoveDown"
+ onValueChanged: {
+ if (value != 0 && focusedWidgetControl.value == 3)
+ listView.moveSelection(1);
+
+ }
+ }
+
ListView {
id: listView
+ function moveSelection(value) {
+ if (value == 0)
+ return ;
+
+ const rowCount = model.rowCount();
+ if (rowCount == 0)
+ return ;
+
+ let newIndex = currentIndex = (currentIndex + value) % rowCount;
+ while (newIndex < 0)newIndex += rowCount
+ currentIndex = newIndex;
+ }
+
anchors.fill: parent
anchors.margins: 10
clip: true