[vlc-devel] [PATCH 3/3] qt: support searching in ServicesHomeDisplay
Prince Gupta
guptaprince8832 at gmail.com
Tue Sep 29 11:11:14 CEST 2020
---
.../qt/network/qml/ServicesHomeDisplay.qml | 28 +++++++++++++++----
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/modules/gui/qt/network/qml/ServicesHomeDisplay.qml b/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
index cc8c7135f4..30860a32a3 100644
--- a/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
+++ b/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
@@ -22,6 +22,7 @@ import QtQuick.Layouts 1.11
import QtQuick.Shapes 1.0
import org.videolan.medialib 0.1
+import org.videolan.vlc 0.1
import "qrc:///widgets/" as Widgets
import "qrc:///util/" as Util
@@ -67,6 +68,7 @@ Widgets.NavigableFocusScope {
if (!found)
stackView.replace(root.pageModel[0].component)
stackView.currentItem.navigationParent = root
+ model = stackView.currentItem.model
}
Component {
@@ -115,7 +117,7 @@ Widgets.NavigableFocusScope {
Widgets.KeyNavigableListView {
id: servicesView
- model: discoveryModel
+ model: discoveryFilterModel
topMargin: VLCStyle.margin_large
leftMargin: VLCStyle.margin_large
rightMargin: VLCStyle.margin_large
@@ -196,9 +198,9 @@ Widgets.NavigableFocusScope {
onClicked: {
if (model.state === ServicesDiscoveryModel.NOTINSTALLED)
- discoveryModel.installService(index)
+ discoveryModel.installService(discoveryFilterModel.mapToSource(index))
else if (model.state === ServicesDiscoveryModel.INSTALLED)
- discoveryModel.removeService(index)
+ discoveryModel.installService(discoveryFilterModel.mapToSource(index))
}
}
}
@@ -233,6 +235,13 @@ Widgets.NavigableFocusScope {
ctx: mainctx
}
+ SortFilterProxyModel {
+ id: discoveryFilterModel
+
+ sourceModel: discoveryModel
+ searchRole: "name"
+ }
+
}
}
@@ -243,7 +252,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
@@ -335,7 +344,7 @@ Widgets.NavigableFocusScope {
onSelectAll: selectionModel.selectAll()
onSelectionUpdated: selectionModel.updateSelection( keyModifiers, oldIndex, newIndex )
onActionAtIndex: {
- var itemData = sourcesModel.getDataAt(index)
+ var itemData = sourcesModel.getDataAt(sourcesFilterModel.mapIndexToSource(index))
if (itemData.type === NetworkSourcesModel.TYPE_DUMMY)
history.push(["mc", "discover", "services", "services_manage"])
else
@@ -356,7 +365,14 @@ Widgets.NavigableFocusScope {
Util.SelectableDelegateModel {
id: selectionModel
- model: sourcesModel
+ model: sourcesFilterModel
+ }
+
+ SortFilterProxyModel {
+ id: sourcesFilterModel
+
+ sourceModel: sourcesModel
+ searchRole: "name"
}
}
}
--
2.25.1
More information about the vlc-devel
mailing list