[vlc-commits] [Git][videolan/vlc][master] 3 commits: PageLoader: Add the 'stackViewItem' alias

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Mar 25 05:50:24 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
75626cb9 by Benjamin Arnaud at 2023-03-24T22:41:07+00:00
PageLoader: Add the 'stackViewItem' alias

- - - - -
c7f0cc61 by Benjamin Arnaud at 2023-03-24T22:41:07+00:00
BrowseDisplay: Refactor with 'stackViewItem' alias

- - - - -
d26d428d by Benjamin Arnaud at 2023-03-24T22:41:07+00:00
qml/BrowseDisplay: Fix warning when 'stackViewItem' is null

- - - - -


2 changed files:

- modules/gui/qt/network/qml/BrowseDisplay.qml
- modules/gui/qt/widgets/qml/PageLoader.qml


Changes:

=====================================
modules/gui/qt/network/qml/BrowseDisplay.qml
=====================================
@@ -23,6 +23,7 @@ import QtQml 2.11
 import org.videolan.vlc 0.1
 
 import "qrc:///widgets/" as Widgets
+import "qrc:///util/Helpers.js" as Helpers
 import "qrc:///style/"
 
 Widgets.PageLoader {
@@ -75,8 +76,8 @@ Widgets.PageLoader {
 
     // Connections
     Connections {
-        target: (stackView.currentItem instanceof BrowseHomeDisplay) ? stackView.currentItem
-                                                                     : null
+        target: (Helpers.isValidInstanceOf(stackViewItem, BrowseHomeDisplay)) ? stackViewItem
+                                                                              : null
 
         onSeeAll: {
             if (sd_source === -1)
@@ -84,17 +85,17 @@ Widgets.PageLoader {
             else
                 History.push(["mc", "network", "device", { title: title, sd_source: sd_source }])
 
-            stackView.currentItem.setCurrentItemFocus(reason)
+            stackViewItem.setCurrentItemFocus(reason)
         }
     }
 
     Connections {
-        target: stackView.currentItem
+        target: stackViewItem
 
         onBrowse: {
             History.push(["mc", "network", "browse", { tree: tree }])
 
-            stackView.currentItem.setCurrentItemFocus(reason)
+            stackViewItem.setCurrentItemFocus(reason)
         }
     }
 
@@ -158,7 +159,7 @@ Widgets.PageLoader {
             Navigation.cancelAction: function() {
                 History.previous()
 
-                stackView.currentItem.setCurrentItemFocus(Qt.BacktabFocusReason)
+                stackViewItem.setCurrentItemFocus(Qt.BacktabFocusReason)
             }
         }
     }
@@ -167,18 +168,18 @@ Widgets.PageLoader {
         id: componentBar
 
         NetworkAddressbar {
-            path: view.name === "browse" ? root.stackView.currentItem.providerModel.path : []
+            path: view.name === "browse" ? root.stackViewItem.providerModel.path : []
 
             onHomeButtonClicked: {
                 History.push(["mc", "network", "home"])
 
-                stackView.currentItem.setCurrentItemFocus(reason)
+                stackViewItem.setCurrentItemFocus(reason)
             }
 
             onBrowse: {
                 History.push(["mc", "network", "browse", { "tree": tree }])
 
-                stackView.currentItem.setCurrentItemFocus(reason)
+                stackViewItem.setCurrentItemFocus(reason)
             }
         }
     }


=====================================
modules/gui/qt/widgets/qml/PageLoader.qml
=====================================
@@ -42,6 +42,8 @@ FocusScope {
     property alias leftPadding: stackView.leftPadding
     property alias rightPadding: stackView.rightPadding
 
+    property alias stackViewItem: stackView.currentItem
+
     property alias stackView: stackView
 
     // Signals



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1ed24cb23a4a4cfd1786aa80cfbf6568ed89d3fb...d26d428d805dce4ef372bbc6368b2e12f223f572

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1ed24cb23a4a4cfd1786aa80cfbf6568ed89d3fb...d26d428d805dce4ef372bbc6368b2e12f223f572
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