[vlc-commits] qml: add addressbar in services tab

Prince Gupta git at videolan.org
Fri Nov 27 14:52:24 CET 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Fri Nov 20 23:17:39 2020 +0530| [9763175e0a5970ac3a0a9a48a8f9d36026da292c] | committer: Pierre Lamot

qml: add addressbar in services tab

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/network/qml/DiscoverDisplay.qml     |  1 +
 modules/gui/qt/network/qml/ServicesHomeDisplay.qml | 31 ++++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/network/qml/DiscoverDisplay.qml b/modules/gui/qt/network/qml/DiscoverDisplay.qml
index 49b0f21f24..8d7543c007 100644
--- a/modules/gui/qt/network/qml/DiscoverDisplay.qml
+++ b/modules/gui/qt/network/qml/DiscoverDisplay.qml
@@ -49,6 +49,7 @@ Widgets.PageLoader {
     onCurrentItemChanged: {
         sortModel = currentItem.sortModel
         contentModel = currentItem.model
+        localMenuDelegate = !!currentItem.localMenuDelegate ? currentItem.localMenuDelegate : menuDelegate
     }
 
 
diff --git a/modules/gui/qt/network/qml/ServicesHomeDisplay.qml b/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
index 3ee2bbab1a..89de1f6104 100644
--- a/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
+++ b/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
@@ -32,6 +32,7 @@ Widgets.PageLoader {
 
     property var sortModel
     property var model
+    property Component localMenuDelegate: null
 
     defaultPage: "all"
     pageModel: [{
@@ -51,6 +52,7 @@ Widgets.PageLoader {
     onCurrentItemChanged: {
         sortModel = currentItem.sortModel
         model = currentItem.model
+        localMenuDelegate = !!currentItem.addressBar ? currentItem.addressBar : null
     }
 
     Component {
@@ -58,12 +60,20 @@ Widgets.PageLoader {
 
         NetworkBrowseDisplay {
             property alias source_name: deviceModel.source_name
+            property Component addressBar: NetworkAddressbar {
+                path: [{display: deviceModel.name, tree: {}}]
+
+                onHomeButtonClicked: history.push(["mc", "discover", "services"])
+
+                function changeTree(new_tree) {
+                }
+            }
 
             providerModel: deviceModel
             contextMenu: contextMenu
 
             function changeTree(new_tree) {
-                history.push(["mc", "discover", "services", "source_browse", { tree: new_tree }]);
+                history.push(["mc", "discover", "services", "source_browse", { tree: new_tree, "root_name": deviceModel.name, "source_name": source_name }]);
             }
 
             NetworkDeviceModel {
@@ -87,9 +97,26 @@ Widgets.PageLoader {
 
             providerModel: mediaModel
             contextMenu: contextMenu
+            property string root_name
+            property string source_name
+            property Component addressBar: NetworkAddressbar {
+                path: {
+                    var _path = mediaModel.path
+                    _path.unshift({display: root_name, tree: {"source_name": source_name, "isRoot": true}})
+                    return _path
+                }
+
+                onHomeButtonClicked: history.push(["mc", "discover", "services"])
+                function changeTree(new_tree) {
+                    if (!!new_tree.isRoot)
+                        history.push(["mc", "discover", "services", "source_root", { source_name: new_tree.source_name }])
+                    else
+                        history.push(["mc", "discover", "services", "source_browse", { tree: new_tree, "root": root_name }]);
+                }
+            }
 
             function changeTree(new_tree) {
-                history.push(["mc", "discover", "services", "source_browse", { tree: new_tree }]);
+                history.push(["mc", "discover", "services", "source_browse", { tree: new_tree, "root": root_name }]);
             }
 
             NetworkMediaModel {



More information about the vlc-commits mailing list