Skip to content

Commit 36ba24c

Browse files
committed
feat(QML): add playlist, crates and browse
1 parent 426c3e5 commit 36ba24c

14 files changed

+746
-19
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3570,6 +3570,8 @@ if(QML)
35703570
src/qml/qmlmixxxcontrollerscreen.cpp
35713571
src/qml/qmlplayermanagerproxy.cpp
35723572
src/qml/qmlplayerproxy.cpp
3573+
src/qml/qmlplaylistproxy.cpp
3574+
src/qml/qmlcrateproxy.cpp
35733575
src/qml/qmlsidebarmodelproxy.cpp
35743576
src/qml/qmllibrarytracklistcolumn.cpp
35753577
src/qml/qmltrackproxy.cpp

res/qml/Library/Browser.qml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ Rectangle {
4949

5050
delegate: FocusScope {
5151
required property string label
52+
required property string itemName
5253
required property var icon
54+
required property bool creatable
5355

5456
readonly property real indentation: 40
5557
readonly property real padding: 5
@@ -151,7 +153,7 @@ Rectangle {
151153
color: Theme.textColor
152154
}
153155
Item {
154-
visible: rowMouseArea.containsMouse && isTreeNode && hasChildren
156+
visible: (rowMouseArea.containsMouse || popup.opened) && isTreeNode && hasChildren && creatable
155157
id: newItem
156158
height: parent.height
157159
anchors {
@@ -211,6 +213,60 @@ Rectangle {
211213
PathLine { y: 6; x: 8 }
212214
}
213215
}
216+
MouseArea {
217+
anchors.fill: parent
218+
onPressed: {
219+
popup.x = parent.width
220+
popup.y = parent.height / 2 - popup.height / 2
221+
popup.open()
222+
popup.forceActiveFocus(Qt.PopupFocusReason)
223+
}
224+
cursorShape: Qt.PointingHandCursor
225+
}
226+
Skin.ActionPopup {
227+
id: popup
228+
padding: 6
229+
focus: true
230+
Text {
231+
Layout.alignment: Qt.AlignHCenter
232+
text: qsTr("New %1").arg(itemName)
233+
font.weight: Font.Bold
234+
font.pixelSize: 14
235+
color: Theme.white
236+
}
237+
Skin.InputField {
238+
Layout.fillWidth: true
239+
Layout.preferredHeight: 36
240+
Layout.margins: 4
241+
focus: true
242+
id: newItemName
243+
input.onAccepted: {
244+
if (input.text)
245+
popup.close()
246+
}
247+
}
248+
RowLayout {
249+
Layout.fillWidth: true
250+
Skin.ActionButton {
251+
Layout.fillWidth: true
252+
label.text: qsTr("Cancel")
253+
onPressed: {
254+
popup.close()
255+
}
256+
}
257+
Skin.ActionButton {
258+
Layout.fillWidth: true
259+
opacity: newItemName.text || newItemName.input.text ? 1 : 0.4
260+
category: Skin.ActionButton.Action
261+
label.text: qsTr("Create")
262+
onPressed: {
263+
if (!newItemName.text)
264+
return;
265+
popup.close()
266+
}
267+
}
268+
}
269+
}
214270
}
215271
}
216272
}

res/qml/Library/SourceTree.qml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Mixxx.LibrarySourceTree {
2121
id: dragArea
2222
anchors.fill: parent
2323
capabilities: cell.caps
24+
playlists: playlistSource
25+
crates: crateSource
2426

2527
onPressed: {
2628
if (pressedButtons == Qt.LeftButton) {
@@ -191,4 +193,146 @@ Mixxx.LibrarySourceTree {
191193
label: qsTr("All...")
192194
columns: root.defaultColumns
193195
}
196+
Mixxx.LibraryPlaylistSource {
197+
id: playlistSource
198+
label: qsTr("Playlist")
199+
itemName: qsTr("playlist")
200+
creatable: true
201+
icon: "../images/library_playlist.png"
202+
203+
columns: root.defaultColumns
204+
}
205+
Mixxx.LibraryCrateSource {
206+
id: crateSource
207+
label: qsTr("Crate")
208+
itemName: qsTr("crate")
209+
creatable: true
210+
icon: "../images/library_crates.png"
211+
212+
columns: root.defaultColumns
213+
}
214+
Mixxx.LibraryExplorerSource {
215+
label: qsTr("Explorer")
216+
icon: "../images/library_explorer.png"
217+
columns: [
218+
Mixxx.TrackListColumn {
219+
220+
label: qsTr("Preview")
221+
delegate: Rectangle {
222+
color: decoration
223+
implicitHeight: 30
224+
225+
Image {
226+
anchors.fill: parent
227+
fillMode: Image.PreserveAspectCrop
228+
source: cover_art
229+
clip: true
230+
asynchronous: true
231+
}
232+
}
233+
},
234+
Mixxx.TrackListColumn {
235+
label: qsTr("Filename")
236+
delegate: DefaultDelegate {}
237+
},
238+
Mixxx.TrackListColumn {
239+
role: Mixxx.TrackListColumn.Role.Artist
240+
241+
label: qsTr("Artist")
242+
delegate: DefaultDelegate {}
243+
},
244+
Mixxx.TrackListColumn {
245+
role: Mixxx.TrackListColumn.Role.Title
246+
247+
label: qsTr("Title")
248+
delegate: DefaultDelegate {}
249+
},
250+
Mixxx.TrackListColumn {
251+
252+
label: qsTr("Album")
253+
delegate: DefaultDelegate {}
254+
},
255+
Mixxx.TrackListColumn {
256+
257+
label: qsTr("Track #")
258+
delegate: DefaultDelegate {}
259+
},
260+
Mixxx.TrackListColumn {
261+
262+
label: qsTr("Year")
263+
delegate: DefaultDelegate {}
264+
},
265+
Mixxx.TrackListColumn {
266+
267+
label: qsTr("Genre")
268+
delegate: DefaultDelegate {}
269+
},
270+
Mixxx.TrackListColumn {
271+
272+
label: qsTr("Composer")
273+
delegate: DefaultDelegate {}
274+
},
275+
Mixxx.TrackListColumn {
276+
277+
label: qsTr("Comment")
278+
delegate: DefaultDelegate {}
279+
},
280+
Mixxx.TrackListColumn {
281+
282+
label: qsTr("Duration")
283+
delegate: DefaultDelegate {}
284+
},
285+
Mixxx.TrackListColumn {
286+
287+
label: qsTr("BPM")
288+
delegate: DefaultDelegate {}
289+
},
290+
Mixxx.TrackListColumn {
291+
292+
label: qsTr("Key")
293+
delegate: DefaultDelegate {}
294+
},
295+
Mixxx.TrackListColumn {
296+
297+
label: qsTr("Type")
298+
delegate: DefaultDelegate {}
299+
},
300+
Mixxx.TrackListColumn {
301+
302+
label: qsTr("Bitrate")
303+
delegate: DefaultDelegate {}
304+
},
305+
Mixxx.TrackListColumn {
306+
role: Mixxx.TrackListColumn.Role.Location
307+
308+
label: qsTr("Location")
309+
delegate: DefaultDelegate {}
310+
},
311+
Mixxx.TrackListColumn {
312+
313+
label: qsTr("Album Artist")
314+
delegate: DefaultDelegate {}
315+
},
316+
Mixxx.TrackListColumn {
317+
318+
label: qsTr("Grouping")
319+
delegate: DefaultDelegate {}
320+
},
321+
Mixxx.TrackListColumn {
322+
323+
label: qsTr("File Modified")
324+
delegate: DefaultDelegate {}
325+
},
326+
Mixxx.TrackListColumn {
327+
328+
label: qsTr("File Created")
329+
delegate: DefaultDelegate {}
330+
},
331+
Mixxx.TrackListColumn {
332+
333+
label: qsTr("ReplayGain")
334+
delegate: DefaultDelegate {}
335+
}
336+
]
337+
}
194338
}

0 commit comments

Comments
 (0)