[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: don't reuse the end position for DragItem on the subsequent drag
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Thu Mar 2 17:31:32 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
ecbea8c9 by Fatih Uzunoglu at 2023-03-02T17:11:01+00:00
qml: don't reuse the end position for DragItem on the subsequent drag
- - - - -
1302c05f by Fatih Uzunoglu at 2023-03-02T17:11:01+00:00
qml: add D&D functionality to the Playqueue button
- - - - -
3 changed files:
- modules/gui/qt/maininterface/qml/BannerSources.qml
- modules/gui/qt/maininterface/qml/MainDisplay.qml
- modules/gui/qt/widgets/qml/DragItem.qml
Changes:
=====================================
modules/gui/qt/maininterface/qml/BannerSources.qml
=====================================
@@ -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 {
=====================================
modules/gui/qt/maininterface/qml/MainDisplay.qml
=====================================
@@ -274,6 +274,8 @@ FocusScope {
model: root.tabModel
+ plListView: playlist
+
onItemClicked: {
var name = root.tabModel.get(index).name
selectedIndex = index
=====================================
modules/gui/qt/widgets/qml/DragItem.qml
=====================================
@@ -126,6 +126,12 @@ Item {
property int _currentRequest: 0
+ Drag.onActiveChanged: {
+ // FIXME: This should not be ideally necessary
+ // TODO: Rework D&D positioning
+ if (!Drag.active)
+ x = y = -1
+ }
//---------------------------------------------------------------------------------------------
// Implementation
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4ff98ff54ec63f77441f36b10f1c3f250f1cd723...1302c05fad54626a9fadf7549262ee1955ce9f0f
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4ff98ff54ec63f77441f36b10f1c3f250f1cd723...1302c05fad54626a9fadf7549262ee1955ce9f0f
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list