[vlc-devel] [PATCH 07/29] qml: add grid component for networks

Abel Tesfaye abeltesfaye45 at gmail.com
Tue Aug 20 12:42:24 CEST 2019


From: Abel Tesfaye <Abeltesfaye45 at gmail.com>

---
 .../qt/qml/mediacenter/MCNetworkDisplay.qml   | 37 +++++++++++++++++--
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml b/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
index fa42e63e65..ef11f9c808 100644
--- a/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
@@ -82,6 +82,15 @@ Utils.NavigableFocusScope {
 
         delegate: Package {
             id: element
+            Loader {
+                id: delegateLoaderGrid
+                focus: true
+                Package.name: "grid"
+                source: model.type == MLNetworkModel.TYPE_FILE ?
+                            "qrc:///mediacenter/NetworkFileDisplayGrid.qml" :
+                            "qrc:///mediacenter/NetworkDriveDisplayGrid.qml";
+            }
+
             Loader {
                 id: delegateLoader
                 focus: true
@@ -127,18 +136,38 @@ Utils.NavigableFocusScope {
     onActiveFocusChanged: {
         if (activeFocus && delegateModel.items.count > 0 && delegateModel.selectedGroup.count === 0) {
             var initialIndex = 0
-            if (view.currentIndex !== -1)
-                initialIndex = view.currentIndex
+            if (view.currentItem.currentIndex !== -1)
+                initialIndex = view.currentItem.currentIndex
             delegateModel.items.get(initialIndex).inSelected = true
-            view.currentIndex = initialIndex
+            view.currentItem.currentIndex = initialIndex
         }
     }
 
    Component{
        id: gridComponent
-       Item {
+
+       Utils.KeyNavigableGridView {
+           id: gridView_id
            height: view.height
            width: view.width
+
+           model: delegateModel.parts.grid
+           modelCount: delegateModel.items.count
+
+           focus: true
+
+           cellWidth: VLCStyle.network_normal + VLCStyle.margin_large
+           cellHeight: VLCStyle.network_normal + VLCStyle.margin_xlarge
+
+           onSelectAll: delegateModel.selectAll()
+           onSelectionUpdated:  delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
+           onActionAtIndex: delegateModel.actionAtIndex(index)
+
+           onActionLeft: root.actionLeft(index)
+           onActionRight: root.actionRight(index)
+           onActionUp: root.actionUp(index)
+           onActionDown: root.actionDown(index)
+           onActionCancel: root.actionCancel(index)
        }
    }
 
-- 
2.21.0



More information about the vlc-devel mailing list