[vlc-devel] [PATCH 03/25] qml: move CSD and playlist controls of Player in TopBar widget
Prince Gupta
guptaprince8832 at gmail.com
Thu Mar 11 09:16:11 UTC 2021
---
modules/gui/qt/player/qml/Player.qml | 92 +++-------------------------
modules/gui/qt/player/qml/TopBar.qml | 69 +++++++++++++++++++++
2 files changed, 78 insertions(+), 83 deletions(-)
diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index 6f79bdaeac..928b1ff8ec 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -210,6 +210,7 @@ Widgets.NavigableFocusScope {
right: parent.right
}
+ z: 1
edge: Widgets.DrawerExt.Edges.Top
property var autoHide: topcontrolView.contentItem.autoHide
@@ -240,7 +241,13 @@ Widgets.NavigableFocusScope {
navigationParent: rootPlayer
navigationDownItem: playlistpopup.showPlaylist ? playlistpopup : (audioControls.visible ? audioControls : controlBarView)
- navigationRightItem: csdGroup
+
+ onTooglePlaylistVisibility: {
+ if (mainInterface.playlistDocked)
+ playlistpopup.showPlaylist = !playlistpopup.showPlaylist
+ else
+ mainInterface.playlistVisible = !mainInterface.playlistVisible
+ }
}
ResumeDialog {
@@ -486,7 +493,7 @@ Widgets.NavigableFocusScope {
colors: rootPlayer.colors
navigationParent: rootPlayer
- navigationUpItem: csdGroup
+ navigationUpItem: topcontrolView
navigationDownItem: controlBarView
navigationLeft: closePlaylist
navigationCancel: closePlaylist
@@ -507,87 +514,6 @@ Widgets.NavigableFocusScope {
}
}
- Widgets.DrawerExt {
- id: csdGroup
-
- anchors.right: parent.right
- anchors.top: parent.top
- state: topcontrolView.state
- edge: Widgets.DrawerExt.Edges.Top
- width: contentItem.width
- focus: true
-
- component: Column {
- spacing: VLCStyle.margin_xxsmall
- focus: true
-
- onActiveFocusChanged: if (activeFocus) menu_selector.forceActiveFocus()
-
- Loader {
- focus: false
- anchors.right: parent.right
- height: VLCStyle.icon_normal
- active: mainInterface.clientSideDecoration
- enabled: mainInterface.clientSideDecoration
- visible: mainInterface.clientSideDecoration
- source: "qrc:///widgets/CSDWindowButtonSet.qml"
- onLoaded: {
- item.color = Qt.binding(function() { return rootPlayer.colors.playerFg })
- item.hoverColor = Qt.binding(function() { return rootPlayer.colors.windowCSDButtonDarkBg })
- }
- }
-
- Row {
- anchors.right: parent.right
- anchors.rightMargin: VLCStyle.applicationHorizontalMargin + VLCStyle.margin_xxsmall
- focus: true
- spacing: VLCStyle.margin_xxsmall
- KeyNavigation.down: playlistpopup.state === "visible" ? playlistpopup : (audioControls.visible ? audioControls : controlBarView)
-
- Widgets.IconToolButton {
- id: menu_selector
-
- focus: true
- size: VLCStyle.banner_icon_size
- iconText: VLCIcons.ellipsis
- text: i18n.qtr("Menu")
- color: rootPlayer.colors.playerFg
- property bool acceptFocus: true
-
- onClicked: contextMenu.popup(this.mapToGlobal(0, height))
-
- KeyNavigation.left: topcontrolView
- KeyNavigation.right: playlistBtn
-
- QmlGlobalMenu {
- id: contextMenu
- ctx: mainctx
- }
- }
-
- Widgets.IconToolButton {
- id: playlistBtn
-
- objectName: PlayerControlBarModel.PLAYLIST_BUTTON
- size: VLCStyle.banner_icon_size
- iconText: VLCIcons.playlist
- text: i18n.qtr("Playlist")
- color: rootPlayer.colors.playerFg
- focus: false
- onClicked: {
- if (mainInterface.playlistDocked)
- playlistpopup.showPlaylist = !playlistpopup.showPlaylist
- else
- mainInterface.playlistVisible = !mainInterface.playlistVisible
- }
- property bool acceptFocus: true
-
- KeyNavigation.left: menu_selector
- }
- }
- }
- }
-
Timer {
id: toolbarAutoHide
running: true
diff --git a/modules/gui/qt/player/qml/TopBar.qml b/modules/gui/qt/player/qml/TopBar.qml
index 8fe27db35d..39a05c3e6d 100644
--- a/modules/gui/qt/player/qml/TopBar.qml
+++ b/modules/gui/qt/player/qml/TopBar.qml
@@ -41,6 +41,12 @@ Widgets.NavigableFocusScope{
property alias title: titleText.text
property VLCColors colors: VLCStyle.nightColors
+ signal tooglePlaylistVisibility()
+
+ function forceFocusOnPlaylistButton() {
+ playlistButton.forceActiveFocus()
+ }
+
Keys.priority: Keys.AfterItem
Keys.onPressed: defaultKeyAction(event, 0)
@@ -108,6 +114,7 @@ Widgets.NavigableFocusScope{
history.previous()
}
focus: true
+ KeyNavigation.right: menuSelector
}
Image {
@@ -135,7 +142,69 @@ Widgets.NavigableFocusScope{
textFormat: Text.PlainText
elide: Text.ElideRight
}
+ }
+
+ Column {
+ spacing: VLCStyle.margin_xxsmall
+ Layout.alignment: Qt.AlignRight | Qt.AlignTop
+
+ Loader {
+ focus: false
+ anchors.right: parent.right
+ height: VLCStyle.icon_normal
+ active: mainInterface.clientSideDecoration
+ enabled: mainInterface.clientSideDecoration
+ visible: mainInterface.clientSideDecoration
+ source: "qrc:///widgets/CSDWindowButtonSet.qml"
+ onLoaded: {
+ item.color = Qt.binding(function() { return topFocusScope.colors.playerFg })
+ item.hoverColor = Qt.binding(function() { return topFocusScope.colors.windowCSDButtonDarkBg })
+ }
+ }
+
+ Row {
+ anchors.right: parent.right
+ anchors.rightMargin: VLCStyle.applicationHorizontalMargin + VLCStyle.margin_xxsmall
+ focus: true
+ spacing: VLCStyle.margin_xxsmall
+
+ Widgets.IconToolButton {
+ id: menuSelector
+
+ focus: true
+ size: VLCStyle.banner_icon_size
+ iconText: VLCIcons.ellipsis
+ text: i18n.qtr("Menu")
+ color: rootPlayer.colors.playerFg
+ property bool acceptFocus: true
+
+ onClicked: contextMenu.popup(this.mapToGlobal(0, height))
+
+ KeyNavigation.left: backBtn
+ KeyNavigation.right: playlistButton
+
+ QmlGlobalMenu {
+ id: contextMenu
+ ctx: mainctx
+ }
+ }
+ Widgets.IconToolButton {
+ id: playlistButton
+
+ objectName: PlayerControlBarModel.PLAYLIST_BUTTON
+ size: VLCStyle.banner_icon_size
+ iconText: VLCIcons.playlist
+ text: i18n.qtr("Playlist")
+ color: rootPlayer.colors.playerFg
+ focus: false
+
+ property bool acceptFocus: true
+
+ KeyNavigation.left: menuSelector
+ onClicked: tooglePlaylistVisibility()
+ }
+ }
}
}
}
--
2.25.1
More information about the vlc-devel
mailing list