[vlc-commits] [Git][videolan/vlc][master] qml: intelligently show drop indicator in medialibrary playlist

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Oct 30 14:11:33 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
443a2a4e by Fatih Uzunoglu at 2023-10-30T13:35:52+00:00
qml: intelligently show drop indicator in medialibrary playlist

- - - - -


1 changed file:

- modules/gui/qt/medialibrary/qml/PlaylistMedia.qml


Changes:

=====================================
modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
=====================================
@@ -142,13 +142,16 @@ MainInterface.MainTableView {
     //---------------------------------------------------------------------------------------------
     // Drop interface
 
-    function isDroppable(drop) {
-        // NOTE: Internal drop (intra-playlist).
-        return Helpers.isValidInstanceOf(drop.source, Widgets.DragItem);
+    function isDroppable(drop, index) {
+        if (drop.source === dragItem) {
+            return Helpers.itemsMovable(selectionModel.sortedSelectedIndexesFlat, index)
+        } else {
+            return Helpers.isValidInstanceOf(drop.source, Widgets.DragItem)
+        }
     }
 
     function applyDrop(drop, index, delegate, before) {
-        if (root.isDroppable(drop) === false) {
+        if (root.isDroppable(drop, index + (before ? 0 : 1)) === false) {
             root.hideLine(delegate)
             return
         }
@@ -174,7 +177,7 @@ MainInterface.MainTableView {
     }
 
     function _dropUpdatePosition(drag, index, delegate, before) {
-        if (root.isDroppable(drag) === false) {
+        if (root.isDroppable(drag, index + (before ? 0 : 1)) === false) {
             root.hideLine(delegate)
             return
         }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/443a2a4e84ce03955362556a52eb72d747e37256

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/443a2a4e84ce03955362556a52eb72d747e37256
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