[vlc-commits] qml: split Network view in Home and Browse views
Pierre Lamot
git at videolan.org
Mon Oct 14 11:59:34 CEST 2019
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Fri Sep 27 17:00:18 2019 +0200| [aa09c30401849bce2d26a3eb2627063505b22005] | committer: Jean-Baptiste Kempf
qml: split Network view in Home and Browse views
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aa09c30401849bce2d26a3eb2627063505b22005
---
modules/gui/qt/Makefile.am | 2 +
.../qt/qml/mediacenter/MCNetworkBrowseDisplay.qml | 246 ++++++++++++++++
.../gui/qt/qml/mediacenter/MCNetworkDisplay.qml | 319 ++-------------------
.../qt/qml/mediacenter/MCNetworkHomeDisplay.qml | 141 +++++++++
.../mediacenter/MCNetworksSectionSelectableDM.qml | 11 +-
modules/gui/qt/vlc.qrc | 2 +
6 files changed, 416 insertions(+), 305 deletions(-)
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 2559f58f08..9b776f2331 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -626,6 +626,8 @@ libqt_plugin_la_QML = \
gui/qt/qml/mediacenter/MCVideoDisplay.qml \
gui/qt/qml/mediacenter/MCVideoListDisplay.qml \
gui/qt/qml/mediacenter/MCNetworkDisplay.qml \
+ gui/qt/qml/mediacenter/MCNetworkBrowseDisplay.qml \
+ gui/qt/qml/mediacenter/MCNetworkHomeDisplay.qml \
gui/qt/qml/mediacenter/MCNetworksSectionSelectableDM.qml \
gui/qt/qml/mediacenter/MusicAlbumsDisplay.qml \
gui/qt/qml/mediacenter/MusicAlbumsGridExpandDelegate.qml \
diff --git a/modules/gui/qt/qml/mediacenter/MCNetworkBrowseDisplay.qml b/modules/gui/qt/qml/mediacenter/MCNetworkBrowseDisplay.qml
new file mode 100644
index 0000000000..7ae6ac4025
--- /dev/null
+++ b/modules/gui/qt/qml/mediacenter/MCNetworkBrowseDisplay.qml
@@ -0,0 +1,246 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+import QtQuick 2.11
+import QtQuick.Controls 2.4
+import QtQml.Models 2.2
+import QtQml 2.11
+
+import org.videolan.vlc 0.1
+import org.videolan.medialib 0.1
+
+import "qrc:///utils/" as Utils
+import "qrc:///style/"
+
+Utils.NavigableFocusScope {
+ id: root
+
+ property alias tree: providerModel.tree
+
+ property var extraLocalActions: ObjectModel {
+ Utils.TabButtonExt {
+ text: providerModel.indexed ? qsTr("Remove from medialibrary") : qsTr("Add to medialibrary")
+ visible: !providerModel.is_on_provider_list && providerModel.canBeIndexed
+ onClicked: providerModel.indexed = !providerModel.indexed
+ }
+ }
+
+ MLNetworkModel {
+ id: providerModel
+ ctx: mainctx
+ tree: undefined
+ }
+
+ MCNetworksSectionSelectableDM{
+ id: delegateModel
+ model: providerModel
+ }
+
+ /*
+ *define the intial position/selection
+ * This is done on activeFocus rather than Component.onCompleted because delegateModel.
+ * selectedGroup update itself after this event
+ */
+ onActiveFocusChanged: {
+ if (delegateModel.items.count > 0 && delegateModel.selectedGroup.count === 0) {
+ var initialIndex = 0
+ if (delegateModel.currentIndex !== -1)
+ initialIndex = delegateModel.currentIndex
+ delegateModel.items.get(initialIndex).inSelected = true
+ delegateModel.currentIndex = initialIndex
+ }
+ }
+
+ Utils.MenuExt {
+ id: contextMenu
+ property var delegateModel: undefined
+ property var model: ({})
+ closePolicy: Popup.CloseOnReleaseOutside | Popup.CloseOnEscape
+ focus:true
+
+ Instantiator {
+ id: instanciator
+ property var modelActions: {
+ "play": function() {
+ if (delegateModel) {
+ delegateModel.playSelection()
+ }
+ contextMenu.close()
+ },
+ "enqueue": function() {
+ if (delegateModel)
+ delegateModel.enqueueSelection()
+ contextMenu.close()
+ },
+ "index": function(index) {
+ contextMenu.model.indexed = contextMenu.model.indexed
+ contextMenu.close()
+ }
+ }
+
+ model: [{
+ active: true,
+ text: qsTr("Play"),
+ action: "play"
+ }, {
+ active: true,
+ text: qsTr("Enqueue"),
+ action: "enqueue"
+ }, {
+ active: contextMenu.model && !!contextMenu.model.can_index,
+ text: contextMenu.model && contextMenu.model.indexed ? qsTr("Remove from Media Library") : qsTr("Add to Media Library") ,
+ action: "index"
+ }
+ ]
+
+ onObjectAdded: model[index].active && contextMenu.insertItem( index, object )
+ onObjectRemoved: model[index].active && contextMenu.removeItem( object )
+ delegate: Utils.MenuItemExt {
+ focus: true
+ text: modelData.text
+ onTriggered: {
+ if (modelData.action && instanciator.modelActions[modelData.action]) {
+ instanciator.modelActions[modelData.action]()
+ }
+ }
+ }
+ }
+
+ onClosed: contextMenu.parent.forceActiveFocus()
+ }
+
+
+ Component{
+ id: gridComponent
+
+ Utils.ExpandGridView {
+ model: delegateModel
+ modelCount: delegateModel.items.count
+
+ headerDelegate: Utils.LabelSeparator {
+ text: providerModel.name
+ width: view.width
+ }
+
+ cellWidth: VLCStyle.network_normal + VLCStyle.margin_large
+ cellHeight: VLCStyle.network_normal + VLCStyle.margin_xlarge
+
+ delegate: Utils.GridItem {
+ id: delegateGrid
+ property var model: ({})
+
+ pictureWidth: VLCStyle.network_normal
+ pictureHeight: VLCStyle.network_normal
+
+ image: {
+ switch (model.type){
+ case MLNetworkModel.TYPE_DISC:
+ return "qrc:///type/disc.svg"
+ case MLNetworkModel.TYPE_CARD:
+ return "qrc:///type/capture-card.svg"
+ case MLNetworkModel.TYPE_STREAM:
+ return "qrc:///type/stream.svg"
+ case MLNetworkModel.TYPE_PLAYLIST:
+ return "qrc:///type/playlist.svg"
+ case MLNetworkModel.TYPE_FILE:
+ return "qrc:///type/file_black.svg"
+ default:
+ return "qrc:///type/directory_black.svg"
+ }
+ }
+ subtitle: model.mrl || ""
+ title: model.name || qsTr("Unknown share")
+ showContextButton: true
+
+ onItemClicked : {
+ delegateModel.updateSelection( modifier , delegateModel.currentIndex, index)
+ delegateModel.currentIndex = index
+ delegateGrid.forceActiveFocus()
+ }
+
+ onItemDoubleClicked: {
+ if (model.type === MLNetworkModel.TYPE_NODE || model.type === MLNetworkModel.TYPE_DIRECTORY)
+ history.push( ["mc", "network", { tree: model.tree } ], History.Go)
+ else
+ medialib.addAndPlay( model.mrl )
+ }
+
+ onContextMenuButtonClicked: {
+ contextMenu.model = model
+ contextMenu.delegateModel = delegateModel
+ contextMenu.popup(menuParent)
+ }
+ }
+
+ onSelectAll: delegateModel.selectAll()
+ onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
+ onActionAtIndex: delegateModel.actionAtIndex(index)
+
+ navigationParent: root
+ navigationCancel: function() {
+ history.previous(History.Go)
+ }
+ }
+ }
+
+ Component{
+ id: listComponent
+ Utils.KeyNavigableListView {
+ height: view.height
+ width: view.width
+ model: delegateModel.parts.list
+ modelCount: delegateModel.items.count
+ currentIndex: delegateModel.currentIndex
+
+ focus: true
+ spacing: VLCStyle.margin_xxxsmall
+
+ onSelectAll: delegateModel.selectAll()
+ onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
+ onActionAtIndex: delegateModel.actionAtIndex(index)
+
+ navigationParent: root
+ navigationCancel: function() {
+ history.previous(History.Go)
+ }
+
+ header: Utils.LabelSeparator {
+ text: providerModel.name
+ width: view.width
+ }
+ }
+ }
+
+ Utils.StackViewExt {
+ id: view
+ anchors.fill:parent
+ clip: true
+ focus: true
+ initialItem: medialib.gridView ? gridComponent : listComponent
+
+ Connections {
+ target: medialib
+ onGridViewChanged: {
+ if (medialib.gridView)
+ view.replace(gridComponent)
+ else
+ view.replace(listComponent)
+ }
+ }
+
+ }
+}
diff --git a/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml b/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
index bc1e9cf629..27efd31e49 100644
--- a/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
@@ -29,294 +29,26 @@ import "qrc:///style/"
Utils.NavigableFocusScope {
id: root
- property var extraLocalActions: ObjectModel {
- Utils.TabButtonExt {
- text: providerModel.indexed ? qsTr("Unindex Folder") : qsTr("Index Folder")
- visible: !view.isOnProviderList && providerModel.canBeIndexed
- onClicked: providerModel.indexed = !providerModel.indexed
- }
- }
-
- property alias tree: providerModel.tree
- Utils.MenuExt {
- id: contextMenu
- property var delegateModel: undefined
- property var model: ({})
- closePolicy: Popup.CloseOnReleaseOutside | Popup.CloseOnEscape
- focus:true
-
- Instantiator {
- id: instanciator
- property var modelActions: {
- "play": function() {
- if (delegateModel) {
- delegateModel.playSelection()
- }
- contextMenu.close()
- },
- "enqueue": function() {
- if (delegateModel)
- delegateModel.enqueueSelection()
- contextMenu.close()
- },
- "index": function(index) {
- contextMenu.model.indexed = contextMenu.model.indexed
- contextMenu.close()
- }
- }
-
- model: [{
- active: true,
- text: qsTr("Play"),
- action: "play"
- }, {
- active: true,
- text: qsTr("Enqueue"),
- action: "enqueue"
- }, {
- active: contextMenu.model && !!contextMenu.model.can_index,
- text: contextMenu.model && contextMenu.model.indexed ? qsTr("Add to Media Library") : qsTr("Remove to Media Library"),
- action: "index"
- }
- ]
-
- onObjectAdded: model[index].active && contextMenu.insertItem( index, object )
- onObjectRemoved: model[index].active && contextMenu.removeItem( object )
- delegate: Utils.MenuItemExt {
- focus: true
- text: modelData.text
- onTriggered: {
- if (modelData.action && instanciator.modelActions[modelData.action]) {
- instanciator.modelActions[modelData.action]()
- }
- }
- }
- }
-
- onClosed: contextMenu.parent.forceActiveFocus()
- }
-
- MLNetworkModel {
- id: providerModel
- ctx: mainctx
- tree: undefined
- }
-
- MLNetworkModel {
- id: machineModel
- ctx: mainctx
- tree: undefined
- sd_source: "SD_CAT_DEVICES"
- }
- MLNetworkModel {
- id: lanModel
- ctx: mainctx
- tree: undefined
- sd_source: "SD_CAT_LAN"
- }
-
- MCNetworksSectionSelectableDM{
- id: delegateModel
- model: providerModel
- viewIndexPropertyName: "currentIndexProvider"
- }
+ property var extraLocalActions: undefined
- MCNetworksSectionSelectableDM{
- id: machineDM
- model: machineModel
- viewIndexPropertyName: "currentIndexMachine"
- }
+ property var tree: undefined
+ onTreeChanged: loadView()
+ Component.onCompleted: loadView()
- MCNetworksSectionSelectableDM{
- id: lanDM
- model: lanModel
- viewIndexPropertyName: "currentIndexLan"
+ //reset view
+ function loadDefaultView() {
+ root.tree = undefined
}
- /*
- *define the intial position/selection
- * This is done on activeFocus rather than Component.onCompleted because delegateModel.
- * selectedGroup update itself after this event
- */
- onActiveFocusChanged: {
- if (delegateModel.items.count > 0 && delegateModel.selectedGroup.count === 0) {
- var initialIndex = 0
- if (view.currentIndexProvider !== -1)
- initialIndex = view.currentIndexProvider
- delegateModel.items.get(initialIndex).inSelected = true
- view.currentIndexProvider = initialIndex
- }
- }
-
-
- Component{
- id: topComponent
-
- Utils.NavigableFocusScope {
- id: topFocusScope
- height: view.height
- width: view.width
-
- Label {
- anchors.centerIn: parent
- visible: (machineDM.items.count === 0 && lanDM.items.count === 0 )
- font.pixelSize: VLCStyle.fontHeight_xxlarge
- color: root.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.text
- text: qsTr("No network shares found")
- }
-
- ScrollView {
- id: flickable
- anchors.fill: parent
- ScrollBar.vertical: ScrollBar{}
- focus: true
-
- Column {
- width: parent.width
- height: implicitHeight
-
- spacing: VLCStyle.margin_normal
-
- Utils.LabelSeparator {
- text: qsTr("Devices")
- width: flickable.width
- visible: machineDM.items.count !== 0
- }
-
- Utils.KeyNavigableListView {
- id: deviceSection
-
- focus: false
- visible: machineDM.items.count !== 0
-
- width: flickable.width
- height: VLCStyle.gridItem_default_height
- orientation: ListView.Horizontal
-
- model: machineDM.parts.grid
- modelCount: machineDM.items.count
-
- onSelectAll: machineDM.selectAll()
- onSelectionUpdated: machineDM.updateSelection( keyModifiers, oldIndex, newIndex )
- onActionAtIndex: machineDM.actionAtIndex(index)
-
- navigationParent: topFocusScope
- navigationDown: function (index) {
- if (lanSection.visible)
- lanSection.focus = true;
- else
- topFocusScope.navigationDown(index);
- }
- }
-
- Utils.LabelSeparator {
- text: qsTr("LAN")
- width: flickable.width
- visible: lanDM.items.count !== 0
- }
-
- Utils.KeyNavigableListView {
- id: lanSection
-
- visible: lanDM.items.count !== 0
- focus: false
-
- width: flickable.width
- height: VLCStyle.gridItem_default_height
- orientation: ListView.Horizontal
-
- model: lanDM.parts.grid
- modelCount: lanDM.items.count
-
- onSelectAll: lanDM.selectAll()
- onSelectionUpdated: lanDM.updateSelection( keyModifiers, oldIndex, newIndex )
- onActionAtIndex: lanDM.actionAtIndex(index)
-
-
- navigationParent: topFocusScope
- navigationUp: function (index) {
- if (deviceSection.visible)
- deviceSection.focus = true;
- else
- topFocusScope.navigationUp(index);
- }
- }
- }
-
- }
-
- navigationParent: root
-
- onActiveFocusChanged: {
- if (!deviceSection.focus && !lanSection.focus) {
- if (deviceSection.visible)
- deviceSection.focus = true
- else if (lanSection.visible)
- lanSection.focus = true
- }
- }
-
- }
- }
-
- Component{
- id: gridComponent
-
- Utils.KeyNavigableGridView {
- id: gridView_id
- height: view.height
- width: view.width
-
- model: delegateModel.parts.grid
- modelCount: delegateModel.items.count
- currentIndex: view.currentIndexProvider
-
- focus: true
-
- cellWidth: VLCStyle.network_normal + VLCStyle.margin_large
- cellHeight: VLCStyle.network_normal + VLCStyle.margin_xlarge
-
- onSelectAll: delegateModel.selectAll()
- onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
- onActionAtIndex: delegateModel.actionAtIndex(index)
-
- navigationParent: root
- navigationCancel: function() {
- history.previous(History.Go)
- }
-
- header: Utils.LabelSeparator {
- text: providerModel.name
- width: view.width
- }
- }
- }
-
- Component{
- id: listComponent
- Utils.KeyNavigableListView {
- height: view.height
- width: view.width
- model: delegateModel.parts.list
- modelCount: delegateModel.items.count
- currentIndex: view.currentIndexProvider
-
- focus: true
- spacing: VLCStyle.margin_xxxsmall
-
- onSelectAll: delegateModel.selectAll()
- onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
- onActionAtIndex: delegateModel.actionAtIndex(index)
-
- navigationParent: root
- navigationCancel: function() {
- history.previous(History.Go)
- }
-
- header: Utils.LabelSeparator {
- text: providerModel.name
- width: view.width
- }
+ function loadView() {
+ var page = "";
+ if (root.tree === undefined)
+ page ="qrc:///mediacenter/MCNetworkHomeDisplay.qml"
+ else
+ page = "qrc:///mediacenter/MCNetworkBrowseDisplay.qml"
+ view.replace(page)
+ if (root.tree) {
+ view.currentItem.tree = root.tree
}
}
@@ -325,23 +57,10 @@ Utils.NavigableFocusScope {
anchors.fill:parent
clip: true
focus: true
- initialItem: isOnProviderList ? topComponent : medialib.gridView ? gridComponent : listComponent
- property bool isOnProviderList: providerModel.is_on_provider_list
- property int currentIndexProvider: -1
- property int currentIndexMachine: -1
- property int currentIndexLan: -1
- Connections {
- target: medialib
- onGridViewChanged: {
- if (view.isOnProviderList)
- return
- if (medialib.gridView)
- view.replace(gridComponent)
- else
- view.replace(listComponent)
- }
+ onCurrentItemChanged: {
+ extraLocalActions = view.currentItem.extraLocalActions
+ view.currentItem.navigationParent = root
}
}
-
}
diff --git a/modules/gui/qt/qml/mediacenter/MCNetworkHomeDisplay.qml b/modules/gui/qt/qml/mediacenter/MCNetworkHomeDisplay.qml
new file mode 100644
index 0000000000..4aa07c7703
--- /dev/null
+++ b/modules/gui/qt/qml/mediacenter/MCNetworkHomeDisplay.qml
@@ -0,0 +1,141 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+import QtQuick 2.11
+import QtQuick.Controls 2.4
+import QtQml.Models 2.2
+import QtQml 2.11
+
+import org.videolan.medialib 0.1
+
+import "qrc:///utils/" as Utils
+import "qrc:///style/"
+
+Utils.NavigableFocusScope {
+ id: topFocusScope
+ focus: true
+
+ Label {
+ anchors.centerIn: parent
+ visible: (machineDM.items.count === 0 && lanDM.items.count === 0 )
+ font.pixelSize: VLCStyle.fontHeight_xxlarge
+ color: topFocusScope.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.text
+ text: qsTr("No network shares found")
+ }
+
+ MCNetworksSectionSelectableDM{
+ id: machineDM
+ model: MLNetworkModel {
+ id: machineModel
+ ctx: mainctx
+ tree: undefined
+ sd_source: "SD_CAT_DEVICES"
+ }
+ }
+
+ MCNetworksSectionSelectableDM{
+ id: lanDM
+ model: MLNetworkModel {
+ id: lanModel
+ ctx: mainctx
+ tree: undefined
+ sd_source: "SD_CAT_LAN"
+ }
+ }
+
+ ScrollView {
+ id: flickable
+ anchors.fill: parent
+ ScrollBar.vertical: ScrollBar{}
+ focus: true
+
+ Column {
+ width: parent.width
+ height: implicitHeight
+
+ spacing: VLCStyle.margin_normal
+
+ Utils.LabelSeparator {
+ text: qsTr("Devices")
+ width: flickable.width
+ visible: machineDM.items.count !== 0
+ }
+
+ Utils.KeyNavigableListView {
+ id: deviceSection
+
+ focus: false
+ visible: machineDM.items.count !== 0
+ onVisibleChanged: topFocusScope.resetFocus()
+
+ width: flickable.width
+ height: VLCStyle.gridItem_default_height
+ orientation: ListView.Horizontal
+
+ model: machineDM.parts.grid
+ modelCount: machineDM.items.count
+
+ onSelectAll: machineDM.selectAll()
+ onSelectionUpdated: machineDM.updateSelection( keyModifiers, oldIndex, newIndex )
+ onActionAtIndex: machineDM.actionAtIndex(index)
+
+ navigationParent: topFocusScope
+ navigationDownItem: lanSection.visible ? lanSection : undefined
+ }
+
+ Utils.LabelSeparator {
+ text: qsTr("LAN")
+ width: flickable.width
+ visible: lanDM.items.count !== 0
+ }
+
+ Utils.KeyNavigableListView {
+ id: lanSection
+
+ visible: lanDM.items.count !== 0
+ onVisibleChanged: topFocusScope.resetFocus()
+ focus: false
+
+ width: flickable.width
+ height: VLCStyle.gridItem_default_height
+ orientation: ListView.Horizontal
+
+ model: lanDM.parts.grid
+ modelCount: lanDM.items.count
+
+ onSelectAll: lanDM.selectAll()
+ onSelectionUpdated: lanDM.updateSelection( keyModifiers, oldIndex, newIndex )
+ onActionAtIndex: lanDM.actionAtIndex(index)
+
+ navigationParent: topFocusScope
+ navigationUpItem: deviceSection.visible ? deviceSection : undefined
+ }
+ }
+
+ }
+
+ Component.onCompleted: resetFocus()
+ onActiveFocusChanged: resetFocus()
+ function resetFocus() {
+ if (!deviceSection.focus && !lanSection.focus) {
+ if (deviceSection.visible)
+ deviceSection.focus = true
+ else if (lanSection.visible)
+ lanSection.focus = true
+ }
+ }
+}
diff --git a/modules/gui/qt/qml/mediacenter/MCNetworksSectionSelectableDM.qml b/modules/gui/qt/qml/mediacenter/MCNetworksSectionSelectableDM.qml
index bd9f0b5c63..ece2cb227b 100644
--- a/modules/gui/qt/qml/mediacenter/MCNetworksSectionSelectableDM.qml
+++ b/modules/gui/qt/qml/mediacenter/MCNetworksSectionSelectableDM.qml
@@ -28,6 +28,8 @@ import "qrc:///style/"
Utils.SelectableDelegateModel {
id: delegateModel
+ property int currentIndex: -1
+
property string viewIndexPropertyName: "currentIndex"
delegate: Package {
id: element
@@ -37,8 +39,8 @@ Utils.SelectableDelegateModel {
Package.name: "grid"
onItemClicked : {
- delegateModel.updateSelection( modifier , view[viewIndexPropertyName], index)
- view[viewIndexPropertyName] = index
+ delegateModel.updateSelection( modifier , delegateModel.currentIndex, index)
+ delegateModel.currentIndex = index
delegateGrid.forceActiveFocus()
}
@@ -62,8 +64,8 @@ Utils.SelectableDelegateModel {
Package.name: "list"
onItemClicked : {
- delegateModel.updateSelection( modifier, view[viewIndexPropertyName], index )
- view[viewIndexPropertyName] = index
+ delegateModel.updateSelection( modifier, delegateModel.currentIndex, index )
+ delegateModel.currentIndex = index
delegateList.forceActiveFocus()
}
@@ -91,7 +93,6 @@ Utils.SelectableDelegateModel {
for (var i = 0; i < delegateModel.selectedGroup.count; i++) {
var obj = delegateModel.selectedGroup.get(i)
if (obj.model.can_index) {
- console.log("index", obj.model.mrl, obj.model.indexed)
obj.model.indexed = !obj.model.indexed
}
}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 6132f4bd6a..215ea35363 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -228,6 +228,8 @@
<file alias="MCVideoListDisplay.qml">qml/mediacenter/MCVideoListDisplay.qml</file>
<file alias="VideoGridItem.qml">qml/mediacenter/VideoGridItem.qml</file>
<file alias="AudioGridItem.qml">qml/mediacenter/AudioGridItem.qml</file>
+ <file alias="MCNetworkHomeDisplay.qml">qml/mediacenter/MCNetworkHomeDisplay.qml</file>
+ <file alias="MCNetworkBrowseDisplay.qml">qml/mediacenter/MCNetworkBrowseDisplay.qml</file>
</qresource>
<qresource prefix="/style">
<file alias="qmldir">qml/style/qmldir</file>
More information about the vlc-commits
mailing list