mirror of https://code.videolan.org/videolan/vlc
qml: add D&D functionality to the Playqueue button
This commit is contained in:
parent
ecbea8c907
commit
1302c05fad
|
@ -28,6 +28,7 @@ import org.videolan.vlc 0.1
|
|||
import org.videolan.compat 0.1
|
||||
|
||||
import "qrc:///style/"
|
||||
import "qrc:///playlist/" as PL
|
||||
import "qrc:///widgets/" as Widgets
|
||||
import "qrc:///menus/" as Menus
|
||||
import "qrc:///util/Helpers.js" as Helpers
|
||||
|
@ -50,6 +51,10 @@ FocusScope {
|
|||
property var extraLocalActions: undefined
|
||||
property alias localMenuDelegate: localMenuGroup.sourceComponent
|
||||
|
||||
// For now, used for d&d functionality
|
||||
// Not strictly necessary to set
|
||||
property PL.PlaylistListView plListView: null
|
||||
|
||||
property bool _showCSD: MainCtx.clientSideDecoration && !(MainCtx.intfMainWindow.visibility === Window.FullScreen)
|
||||
|
||||
signal itemClicked(int index)
|
||||
|
@ -429,6 +434,46 @@ FocusScope {
|
|||
highlighted: MainCtx.playlistVisible
|
||||
|
||||
onClicked: MainCtx.playlistVisible = !MainCtx.playlistVisible
|
||||
|
||||
DropArea {
|
||||
anchors.fill: parent
|
||||
|
||||
onContainsDragChanged: {
|
||||
if (containsDrag) {
|
||||
_timer.restart()
|
||||
|
||||
if (plListView)
|
||||
MainCtx.setCursor(Qt.DragCopyCursor)
|
||||
} else {
|
||||
_timer.stop()
|
||||
|
||||
if (plListView)
|
||||
MainCtx.restoreCursor()
|
||||
}
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
if (drag.hasUrls || Helpers.isValidInstanceOf(drag.source, Widgets.DragItem)) {
|
||||
drag.accept() // Not actually necessary, as it is accepted by default
|
||||
} else {
|
||||
drag.accepted = false
|
||||
}
|
||||
}
|
||||
|
||||
onDropped: {
|
||||
if (plListView)
|
||||
plListView.acceptDrop(plListView.model.count, drop)
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: _timer
|
||||
interval: VLCStyle.duration_humanMoment
|
||||
|
||||
onTriggered: {
|
||||
MainCtx.playlistVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Widgets.IconToolButton {
|
||||
|
|
|
@ -274,6 +274,8 @@ FocusScope {
|
|||
|
||||
model: root.tabModel
|
||||
|
||||
plListView: playlist
|
||||
|
||||
onItemClicked: {
|
||||
var name = root.tabModel.get(index).name
|
||||
selectedIndex = index
|
||||
|
|
Loading…
Reference in New Issue