[vlc-commits] qml: fix docked playlist navigation
Pierre Lamot
git at videolan.org
Sun Jul 28 08:43:53 CEST 2019
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Wed Jul 17 14:36:40 2019 +0200| [1f7b2bea07126739855d1f06d6a8f916ac309683] | committer: Jean-Baptiste Kempf
qml: fix docked playlist navigation
this allows to specify the widget that asked the playlist to open
and to return to it when closing.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1f7b2bea07126739855d1f06d6a8f916ac309683
---
modules/gui/qt/qml/BannerSources.qml | 10 +++++++++-
modules/gui/qt/qml/mediacenter/MCMainDisplay.qml | 25 ++++++++++++++++--------
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/modules/gui/qt/qml/BannerSources.qml b/modules/gui/qt/qml/BannerSources.qml
index 1b3726c1bd..529b3e4851 100644
--- a/modules/gui/qt/qml/BannerSources.qml
+++ b/modules/gui/qt/qml/BannerSources.qml
@@ -45,6 +45,9 @@ Utils.NavigableFocusScope {
property alias subTabModel: model_music_id.model
signal toogleMenu()
+
+ property var playlistWidget: undefined
+
// Triggered when the toogleView button is selected
function toggleView () {
medialib.gridView = !medialib.gridView
@@ -348,7 +351,12 @@ Utils.NavigableFocusScope {
size: VLCStyle.icon_normal
text: VLCIcons.playlist
- onClicked: rootWindow.playlistVisible = !rootWindow.playlistVisible
+ onClicked: {
+ rootWindow.playlistVisible = !rootWindow.playlistVisible
+ if (playlistWidget && rootWindow.playlistVisible && rootWindow.playlistDocked)
+ playlistWidget.gainFocus(playlist_btn)
+
+ }
KeyNavigation.right: menu_selector
KeyNavigation.up: buttonView
diff --git a/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml b/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
index e1d94c9222..269e6f69ee 100644
--- a/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
@@ -89,7 +89,12 @@ Utils.NavigableFocusScope {
focus: true
id: medialibId
anchors.fill: parent
- onActionRight: rootWindow.playlistVisible = true
+ onActionRight: {
+ if (rootWindow.playlistDocked) {
+ rootWindow.playlistVisible = true
+ playlist.gainFocus(medialibId)
+ }
+ }
ColumnLayout {
id: column
@@ -110,6 +115,8 @@ Utils.NavigableFocusScope {
focus: true
model: root.tabModel
+ playlistWidget: playlist
+
onItemClicked: {
sourcesBanner.subTabModel = undefined
@@ -203,10 +210,13 @@ Utils.NavigableFocusScope {
focus: false
expandHorizontally: true
+ property var previousFocus: undefined
+
state: (rootWindow.playlistDocked && rootWindow.playlistVisible) ? "visible" : "hidden"
- onVisibleChanged: {
- if (playlist.visible)
- playlist.forceActiveFocus()
+
+ function gainFocus(previous) {
+ playlist.previousFocus = previous
+ playlist.forceActiveFocus()
}
component: Rectangle {
color: VLCStyle.colors.setColorAlpha(VLCStyle.colors.banner, 0.9)
@@ -225,16 +235,15 @@ Utils.NavigableFocusScope {
focus: true
anchors.fill: parent
onActionLeft: playlist.closeAndFocus(stackView.currentItem)
- onActionCancel: playlist.closeAndFocus(stackView.currentItem)
- onActionUp: playlist.closeAndFocus(sourcesBanner)
+ onActionCancel: playlist.closeAndFocus(playlist.previousFocus)
+ onActionUp: playlist.closeAndFocus(playlist.previousFocus)
}
}
}
function closeAndFocus(item){
+ rootWindow.playlistVisible = false
if (!item)
return
-
- rootWindow.playlistVisible = false
item.forceActiveFocus()
}
}
More information about the vlc-commits
mailing list