[vlc-commits] qml: use stackViewExt for networkDisplay

Abel Tesfaye git at videolan.org
Wed Aug 21 15:08:42 CEST 2019


vlc | branch: master | Abel Tesfaye <Abeltesfaye45 at gmail.com> | Mon Aug  5 14:05:46 2019 +0300| [d45733ea83edf85455877a1ad0520044fbf2035e] | committer: Jean-Baptiste Kempf

qml: use stackViewExt for networkDisplay

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d45733ea83edf85455877a1ad0520044fbf2035e
---

 .../gui/qt/qml/mediacenter/MCNetworkDisplay.qml    | 63 ++++++++++++++++------
 1 file changed, 46 insertions(+), 17 deletions(-)

diff --git a/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml b/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
index 29d4a1228a..fa42e63e65 100644
--- a/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
@@ -134,25 +134,54 @@ Utils.NavigableFocusScope {
         }
     }
 
-    Utils.KeyNavigableListView {
+   Component{
+       id: gridComponent
+       Item {
+           height: view.height
+           width: view.width
+       }
+   }
+
+   Component{
+       id: listComponent
+       Utils.KeyNavigableListView {
+           height: view.height
+           width: view.width
+           model: delegateModel.parts.list
+           modelCount: delegateModel.items.count
+
+           focus: true
+           spacing: VLCStyle.margin_xxxsmall
+
+           onSelectAll: delegateModel.selectAll()
+           onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
+           onActionAtIndex: delegateModel.actionAtIndex(index)
+
+           onActionLeft: root.actionLeft(index)
+           onActionRight: root.actionRight(index)
+           onActionDown: root.actionDown(index)
+           onActionUp: root.actionUp(index)
+           onActionCancel: root.actionCancel(index)
+       }
+   }
+
+    Utils.StackViewExt {
         id: view
-        anchors.fill: parent
-        model: delegateModel.parts.list
-        modelCount: delegateModel.items.count
-
+        anchors.fill:parent
+        clip: true
         focus: true
-        spacing: VLCStyle.margin_xxxsmall
-
-        onSelectAll: delegateModel.selectAll()
-        onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
-        onActionAtIndex: delegateModel.actionAtIndex(index)
-
-        onActionLeft: root.actionLeft(index)
-        onActionRight: root.actionRight(index)
-        onActionDown: root.actionDown(index)
-        onActionUp: root.actionUp(index)
-        onActionCancel: root.actionCancel(index)
-    }
+        initialItem: medialib.gridView ? gridComponent : listComponent
+        property int currentIndex: -1
+        Connections {
+            target: medialib
+            onGridViewChanged: {
+                if (medialib.gridView)
+                    view.replace(gridComponent)
+                else
+                    view.replace(listComponent)
+            }
+        }
+}
 
     Label {
         anchors.centerIn: parent



More information about the vlc-commits mailing list