[vlc-commits] qml: allow to define extra buttons specific to the current view in the banner source
Pierre Lamot
git at videolan.org
Mon Oct 14 11:59:14 CEST 2019
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Sep 24 16:10:21 2019 +0200| [5801e2eda61dde307aad30823e2b55ba64f14aab] | committer: Jean-Baptiste Kempf
qml: allow to define extra buttons specific to the current view in the banner source
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5801e2eda61dde307aad30823e2b55ba64f14aab
---
modules/gui/qt/qml/BannerSources.qml | 22 ++++++++++++++++++++++
modules/gui/qt/qml/mediacenter/MCMainDisplay.qml | 4 ++++
2 files changed, 26 insertions(+)
diff --git a/modules/gui/qt/qml/BannerSources.qml b/modules/gui/qt/qml/BannerSources.qml
index e68c0941f7..5f8341ec94 100644
--- a/modules/gui/qt/qml/BannerSources.qml
+++ b/modules/gui/qt/qml/BannerSources.qml
@@ -45,6 +45,7 @@ Utils.NavigableFocusScope {
property alias subTabModel: localMenuGroup.model
signal toogleMenu()
+ property var extraLocalActions: undefined
property var playlistWidget: undefined
@@ -191,6 +192,10 @@ Utils.NavigableFocusScope {
}
model: ObjectModel {
+ id: localContextModel
+
+ property int countExtra: 0
+
Utils.IconToolButton {
id: list_grid_btn
size: VLCStyle.icon_normal
@@ -218,6 +223,23 @@ Utils.NavigableFocusScope {
}
}
+ Connections {
+ target: root
+ onExtraLocalActionsChanged : {
+ for (var i = 0; i < localContextModel.countExtra; i++) {
+ localContextModel.remove(localContextModel.count - localContextModel.countExtra, localContextModel.countExtra)
+ }
+
+ if (root.extraLocalActions && root.extraLocalActions instanceof ObjectModel) {
+ for (i = 0; i < root.extraLocalActions.count; i++)
+ localContextModel.append(root.extraLocalActions.get(i))
+ localContextModel.countExtra = root.extraLocalActions.count
+ } else {
+ localContextModel.countExtra = 0
+ }
+ }
+ }
+
navigationParent: root
navigationRightItem: localMenuGroup
navigationUpItem: historyGroup.navigable ? historyGroup : globalMenuGroup
diff --git a/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml b/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
index d78b53f9fc..7f1f01a171 100644
--- a/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
@@ -127,6 +127,7 @@ Utils.NavigableFocusScope {
subTabModel = stackView.currentItem.tabModel
sortModel = stackView.currentItem.sortModel
contentModel = stackView.currentItem.contentModel
+ extraLocalActions = stackView.currentItem.extraLocalActions
selectedIndex = index
}
@@ -136,6 +137,7 @@ Utils.NavigableFocusScope {
stackView.currentItem.loadIndex(index)
sortModel = stackView.currentItem.sortModel
contentModel = stackView.currentItem.contentModel
+ extraLocalActions = stackView.currentItem.extraLocalActions
}
navigationParent: root
@@ -186,6 +188,8 @@ Utils.NavigableFocusScope {
sourcesBanner.subTabModel = stackView.currentItem.tabModel
sourcesBanner.sortModel = stackView.currentItem.sortModel
sourcesBanner.contentModel = stackView.currentItem.contentModel
+ sourcesBanner.extraLocalActions = stackView.currentItem.extraLocalActions
+
// Restore sourcesBanner state
sourcesBanner.selectedIndex = pageModel.findIndex(function (e) {
return e.name === root.view
More information about the vlc-commits
mailing list