blob: d6589927efb7c9615c352b9dc43bbb89fdc483bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
import "." as Skin
import Mixxx 0.1 as Mixxx
import QtQml.Models 2.12
import QtQuick 2.12
import "Theme"
Item {
Rectangle {
color: Theme.deckBackgroundColor
anchors.fill: parent
LibraryControl {
id: libraryControl
onMoveSelection: listView.moveSelection(offset)
onLoadSelectedTrack: listView.loadSelectedTrack(group, play)
onLoadSelectedTrackIntoNextAvailableDeck: listView.loadSelectedTrackIntoNextAvailableDeck(play)
}
ListView {
id: listView
function moveSelection(value) {
if (value == 0)
return ;
const rowCount = model.rowCount();
if (rowCount == 0)
return ;
currentIndex = Mixxx.MathUtils.positiveModulo(currentIndex + value, rowCount);
}
function loadSelectedTrackIntoNextAvailableDeck(play) {
const url = model.get(currentIndex).fileUrl;
if (!url)
return ;
Mixxx.PlayerManager.loadLocationUrlIntoNextAvailableDeck(url, play);
}
function loadSelectedTrack(group, play) {
const url = model.get(currentIndex).fileUrl;
if (!url)
return ;
const player = Mixxx.PlayerManager.getPlayer(group);
if (!player)
return ;
player.loadTrackFromLocationUrl(url, play);
}
anchors.fill: parent
anchors.margins: 10
clip: true
focus: true
highlightMoveDuration: 250
highlightResizeDuration: 50
model: Mixxx.Library.model
delegate: Item {
id: itemDelegate
implicitWidth: listView.width
implicitHeight: 30
Text {
anchors.verticalCenter: parent.verticalCenter
text: artist + " - " + title
color: listView.currentIndex == index ? Theme.blue : Theme.deckTextColor
Behavior on color {
ColorAnimation {
duration: listView.highlightMoveDuration
}
}
}
Image {
id: dragItem
Drag.active: dragArea.drag.active
Drag.dragType: Drag.Automatic
Drag.supportedActions: Qt.CopyAction
Drag.mimeData: {
"text/uri-list": fileUrl,
"text/plain": fileUrl
}
anchors.fill: parent
}
MouseArea {
id: dragArea
anchors.fill: parent
drag.target: dragItem
onPressed: {
listView.currentIndex = index;
parent.grabToImage((result) => {
dragItem.Drag.imageSource = result.url;
});
}
}
}
highlight: Rectangle {
border.color: Theme.blue
border.width: 1
color: "transparent"
}
}
}
}
|