[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: remove selection handling from video recent view

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Jan 24 12:53:32 UTC 2022



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


Commits:
364d4f09 by Prince Gupta at 2022-01-24T12:01:31+00:00
qml: remove selection handling from video recent view

it's broken and not required

- - - - -
8b4c5015 by Prince Gupta at 2022-01-24T12:01:31+00:00
qml: add drag and drop support in Video recent view

- - - - -
720458e7 by Prince Gupta at 2022-01-24T12:01:31+00:00
qml/KeyNavigableListView: only show vertical scrollbar when necessary

- - - - -


2 changed files:

- modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
- modules/gui/qt/widgets/qml/KeyNavigableListView.qml


Changes:

=====================================
modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
=====================================
@@ -34,9 +34,9 @@ FocusScope {
 
     property Item focusItem: listView
 
-    property int currentIndex: -1
+    property alias currentIndex: listView.currentIndex
 
-    property var model: undefined
+    property alias model: listView.model
 
     // Properties
 
@@ -48,10 +48,6 @@ FocusScope {
 
     // Events
 
-    onCurrentIndexChanged: {
-        recentVideoListView.currentIndex = _currentIndex
-    }
-
     onFocusChanged: {
         if (activeFocus && root.currentIndex === -1 && root.model.count > 0)
             root.currentIndex = 0
@@ -60,21 +56,16 @@ FocusScope {
     // Functions
 
     function setCurrentItemFocus(reason) {
-        listView.setCurrentItemFocus(reason);
+        listView.setCurrentItemFocus(reason)
     }
 
-    function _actionAtIndex(index, model, selectionModel) {
+    function _actionAtIndex(index) {
         g_mainDisplay.showPlayer()
-        MediaLib.addAndPlay( model.getIdsForIndexes( selectionModel.selectedIndexes ), [":restore-playback-pos=2"] )
+        MediaLib.addAndPlay( model.getIdForIndexes(index), [":restore-playback-pos=2"] )
     }
 
     // Childs
 
-    Util.SelectableDelegateModel {
-        id: recentVideoSelection
-        model: root.model
-    }
-
     VideoContextMenu {
         id: contextMenu
 
@@ -122,8 +113,6 @@ FocusScope {
 
             focus: true
 
-            model: root.model
-
             fadeColor: VLCStyle.colors.bg
 
             Navigation.parentItem: root
@@ -141,6 +130,8 @@ FocusScope {
                 pictureWidth: VLCStyle.gridCover_video_width
                 pictureHeight: VLCStyle.gridCover_video_height
 
+                selected: activeFocus
+
                 focus: true
 
                 unselectedUnderlay: shadows.unselected
@@ -149,9 +140,8 @@ FocusScope {
                 onItemDoubleClicked: gridItem.play()
 
                 onItemClicked: {
-                    recentVideoSelection.updateSelection( modifier , root.model.currentIndex, index )
                     listView.currentIndex = index
-                    listView.forceActiveFocus()
+                    this.forceActiveFocus(Qt.MouseFocusReason)
                 }
 
                 // NOTE: contextMenu.popup wants a list of indexes.
@@ -161,10 +151,18 @@ FocusScope {
                                       { "player-options": [":restore-playback-pos=2"] })
                 }
 
-                Connections {
-                    target: recentVideoSelection
+                dragItem: Widgets.DragItem {
+                    coverRole: "thumbnail"
+
+                    indexes: [index]
+
+                    onRequestData: {
+                        setData(identifier, [model])
+                    }
 
-                    onSelectionChanged: selected = recentVideoSelection.isSelected(root.model.index(index, 0))
+                    function getSelectedInputItem(cb) {
+                        return MediaLib.mlInputItem([model.id], cb)
+                    }
                 }
 
                 Behavior on opacity {
@@ -185,10 +183,7 @@ FocusScope {
                 width: VLCStyle.margin_normal
             }
 
-            onActionAtIndex: {
-                g_mainDisplay.showPlayer()
-                MediaLib.addAndPlay( model.getIdsForIndexes( recentVideoSelection.selectedIndexes ), [":restore-playback-pos=2"] )
-            }
+            onActionAtIndex: root._actionAtIndex(index)
 
             Widgets.GridShadows {
                 id: shadows


=====================================
modules/gui/qt/widgets/qml/KeyNavigableListView.qml
=====================================
@@ -175,7 +175,7 @@ ListView {
     //key navigation is reimplemented for item selection
     keyNavigationEnabled: false
 
-    ScrollBar.vertical: ScrollBar { id: scroll_id }
+    ScrollBar.vertical: ScrollBar { id: scroll_id; visible: root.contentHeight > root.height }
     ScrollBar.horizontal: ScrollBar { visible: root.contentWidth > root.width }
 
     highlightMoveDuration: 300 //ms



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e58c9ef32194cb1fd4d7274b9f50f95291076c6a...720458e713dc17664c2a6e8bf65f313e0e2d82cb

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e58c9ef32194cb1fd4d7274b9f50f95291076c6a...720458e713dc17664c2a6e8bf65f313e0e2d82cb
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list