vlc | branch: master | Prince Gupta <guptaprince8...@gmail.com> | Wed Sep 30 
00:22:55 2020 +0530| [1b205268ece2f10f3cb69af8a1cdf04d0995b1a3] | committer: 
Pierre Lamot

qml: support searching in ServicesHomeDisplay

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

 modules/gui/qt/network/qml/ServicesHomeDisplay.qml | 27 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt/network/qml/ServicesHomeDisplay.qml 
b/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
index 88b3bd1971..f8db63eb8e 100644
--- a/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
+++ b/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
@@ -68,6 +68,7 @@ Widgets.NavigableFocusScope {
         if (!found)
             stackView.replace(root.pageModel[0].component)
         stackView.currentItem.navigationParent = root
+        model = stackView.currentItem.model
     }
 
     Component {
@@ -130,7 +131,7 @@ Widgets.NavigableFocusScope {
         Widgets.KeyNavigableListView {
             id: servicesView
 
-            model: discoveryModel
+            model: discoveryFilterModel
             topMargin: VLCStyle.margin_large
             leftMargin: VLCStyle.margin_large
             rightMargin: VLCStyle.margin_large
@@ -211,9 +212,9 @@ Widgets.NavigableFocusScope {
 
                                 onClicked: {
                                     if (model.state === 
ServicesDiscoveryModel.NOTINSTALLED)
-                                        discoveryModel.installService(index)
+                                        
discoveryModel.installService(discoveryFilterModel.mapIndexToSource(index))
                                     else if (model.state === 
ServicesDiscoveryModel.INSTALLED)
-                                        discoveryModel.removeService(index)
+                                        
discoveryModel.installService(discoveryFilterModel.mapIndexToSource(index))
                                 }
                             }
                         }
@@ -248,6 +249,13 @@ Widgets.NavigableFocusScope {
                 ctx: mainctx
             }
 
+            SortFilterProxyModel {
+                id: discoveryFilterModel
+
+                sourceModel: discoveryModel
+                searchRole: "name"
+            }
+
         }
     }
 
@@ -258,7 +266,7 @@ Widgets.NavigableFocusScope {
             id: gridView
 
             delegateModel: selectionModel
-            model: sourcesModel
+            model: sourcesFilterModel
             topMargin: VLCStyle.margin_large
             cellWidth: VLCStyle.gridItem_network_width
             cellHeight: VLCStyle.gridCover_network_height + 
VLCStyle.margin_xsmall + VLCStyle.fontHeight_normal
@@ -350,7 +358,7 @@ Widgets.NavigableFocusScope {
             onSelectAll: selectionModel.selectAll()
             onSelectionUpdated: selectionModel.updateSelection( keyModifiers, 
oldIndex, newIndex )
             onActionAtIndex: {
-                var itemData = sourcesModel.getDataAt(index)
+                var itemData = sourcesFilterModel.getDataAt(index)
                 if (itemData.type === NetworkSourcesModel.TYPE_DUMMY)
                     history.push(["mc", "discover", "services", 
"services_manage"])
                 else
@@ -371,7 +379,14 @@ Widgets.NavigableFocusScope {
             Util.SelectableDelegateModel {
                 id: selectionModel
 
-                model: sourcesModel
+                model: sourcesFilterModel
+            }
+
+            SortFilterProxyModel {
+                id: sourcesFilterModel
+
+                sourceModel: sourcesModel
+                searchRole: "name"
             }
         }
     }

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to