vlc | branch: master | Rohan Rajpal <[email protected]> | Mon Jul 29 00:44:23 2019 +0530| [2e2dba3347ddfa67634c9b02ce2e3bb937eb8b01] | committer: Jean-Baptiste Kempf
qml: Add topbar component to player Add the topbar to the player. Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2e2dba3347ddfa67634c9b02ce2e3bb937eb8b01 --- modules/gui/qt/qml/player/Player.qml | 79 +++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 19 deletions(-) diff --git a/modules/gui/qt/qml/player/Player.qml b/modules/gui/qt/qml/player/Player.qml index 6e18892c87..57258bb83d 100644 --- a/modules/gui/qt/qml/player/Player.qml +++ b/modules/gui/qt/qml/player/Player.qml @@ -118,10 +118,47 @@ Utils.NavigableFocusScope { } } + Utils.DrawerExt{ + id: topcontrolView + anchors{ + left: parent.left + right: parent.right + top: parent.top + } + edge: Utils.DrawerExt.Edges.Top + property var noAutoHide: topcontrolView.contentItem.noAutoHide + + state: "visible" + + component: TopBar{ + focus: true + width: topcontrolView.width + noAutoHide: noAutoHideInt || playlistpopup.state === "visible" + onNoAutoHideChanged: { + if (!noAutoHide) + toolbarAutoHide.restart() + } + + onActionDown: controlBarView.forceActiveFocus() + onActionUp: root.actionUp(index) + onActionLeft: root.actionLeft(index) + onActionRight: root.actionRight(index) + onActionCancel: root.actionCancel(index) + + Keys.onPressed: { + if (event.key === Qt.Key_Menu) { + toolbarAutoHide.toggleForceVisible() + } else { + rootWindow.sendHotkey(event.key); + } + } + } + } + Utils.DrawerExt { id: playlistpopup anchors { - top: parent.top + top: topcontrolView.bottom right: parent.right bottom: controlBarView.top } @@ -163,7 +200,6 @@ Utils.NavigableFocusScope { } } - Utils.DrawerExt { id: controlBarView focus: true @@ -184,7 +220,6 @@ Utils.NavigableFocusScope { height: 90 * VLCStyle.scale property alias noAutoHide: controllerId.noAutoHide - MouseArea { id: controllerMouseArea hoverEnabled: true @@ -201,7 +236,7 @@ Utils.NavigableFocusScope { toolbarAutoHide.restart() } - onActionUp: rootPlayer.actionUp(index) + onActionUp: topcontrolView.forceActiveFocus() onActionDown: rootPlayer.actionDown(index) onActionLeft: rootPlayer.actionLeft(index) onActionRight: rootPlayer.actionRight(index) @@ -214,15 +249,6 @@ Utils.NavigableFocusScope { else rootWindow.sendHotkey(event.key); } - - //filter global events to keep toolbar - //visible when user navigates within the control bar - EventFilter { - id: filter - source: rootQMLView - filterEnabled: controlBarView.state === "visible" && !controlBarView.noAutoHide - Keys.onPressed: toolbarAutoHide.setVisible(5000) - } } } } @@ -234,36 +260,51 @@ Utils.NavigableFocusScope { repeat: false interval: 3000 onTriggered: { - _setVisible(false) + _setVisibleControlBar(false) } - function _setVisible(visible) { + function _setVisibleControlBar(visible) { if (visible) { controlBarView.state = "visible" - controlBarView.forceActiveFocus() + topcontrolView.state = "visible" + if (!controlBarView.focus && !topcontrolView.focus) + controlBarView.forceActiveFocus() + videoSurface.cursorShape = Qt.ArrowCursor } else { - if (controlBarView.noAutoHide) + if (controlBarView.noAutoHide || topcontrolView.noAutoHide) return; controlBarView.state = "hidden" + topcontrolView.state = "hidden" videoSurface.forceActiveFocus() videoSurface.cursorShape = Qt.BlankCursor } } function setVisible(duration) { - _setVisible(true) + _setVisibleControlBar(true) toolbarAutoHide.interval = duration toolbarAutoHide.restart() } function toggleForceVisible() { - _setVisible(controlBarView.state !== "visible") + _setVisibleControlBar(controlBarView.state !== "visible") toolbarAutoHide.stop() } + + } + + //filter global events to keep toolbar + //visible when user navigates within the control bar + EventFilter { + id: filter + source: rootQMLView + filterEnabled: controlBarView.state === "visible" + && (controlBarView.focus || topcontrolView.focus) + Keys.onPressed: toolbarAutoHide.setVisible(5000) } Connections { _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
