[vlc-commits] qml: remove autoHide from ControlBar
Prince Gupta
git at videolan.org
Mon Mar 15 10:32:59 UTC 2021
vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Mon Feb 8 20:02:06 2021 +0530| [4f60ee4bdb5f381428fd19d2694feff05457b643] | committer: Pierre Lamot
qml: remove autoHide from ControlBar
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4f60ee4bdb5f381428fd19d2694feff05457b643
---
modules/gui/qt/player/qml/ControlBar.qml | 7 ++++---
modules/gui/qt/player/qml/ControlButtons.qml | 15 +++++++++------
modules/gui/qt/player/qml/Player.qml | 18 ++++--------------
modules/gui/qt/player/qml/PlayerButtonsLayout.qml | 4 ++++
4 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/modules/gui/qt/player/qml/ControlBar.qml b/modules/gui/qt/player/qml/ControlBar.qml
index cbf00ab26b..705c7b197c 100644
--- a/modules/gui/qt/player/qml/ControlBar.qml
+++ b/modules/gui/qt/player/qml/ControlBar.qml
@@ -42,9 +42,8 @@ Widgets.NavigableFocusScope {
readonly property alias sliderY: row2.y
property int textPosition: ControlBar.TimeTextPosition.AboveSlider
property VLCColors colors: VLCStyle.nightColors
- property bool autoHide: _lockAutoHide === 0 && !lockAutoHide
- property bool lockAutoHide: false
- property int _lockAutoHide: 0 //count the number of element locking the autoHide
+
+ signal requestLockUnlockAutoHide(bool lock, var source)
Keys.priority: Keys.AfterItem
Keys.onPressed: defaultKeyAction(event, 0)
@@ -149,6 +148,8 @@ Widgets.NavigableFocusScope {
navigationUpItem: trackPositionSlider.enabled ? trackPositionSlider : root.navigationUpItem
colors: root.colors
+
+ onRequestLockUnlockAutoHide: root.requestLockUnlockAutoHide(lock, source)
}
}
}
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index 9729bc537f..d961d1f53c 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -33,6 +33,8 @@ Item{
property bool isMiniplayer: false
property var parentWindow: undefined
+ signal requestLockUnlockAutoHide(bool lock, var source)
+
property var buttonL: [
{ id: PlayerControlBarModel.PLAY_BUTTON, label: VLCIcons.play, text: i18n.qtr("Play")},
{ id: PlayerControlBarModel.STOP_BUTTON, label: VLCIcons.stop, text: i18n.qtr("Stop")},
@@ -432,10 +434,7 @@ Item{
size: VLCStyle.icon_medium
iconText: VLCIcons.audiosub
- onClicked: {
- root._lockAutoHide += 1
- langMenu.open()
- }
+ onClicked: langMenu.open()
text: i18n.qtr("Languages and tracks")
@@ -448,9 +447,13 @@ Item{
y: (!!rootPlayer) ? (rootPlayer.positionSliderY - height) : 0
z: 1
- onOpened: rootPlayer._menu = langMenu
+ onOpened: {
+ controlButtons.requestLockUnlockAutoHide(true, controlButtons)
+ rootPlayer._menu = langMenu
+ }
+
onMenuClosed: {
- root._lockAutoHide -= 1
+ controlButtons.requestLockUnlockAutoHide(false, controlButtons)
langBtn.forceActiveFocus()
rootPlayer._menu = undefined
}
diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index ac8862191b..b98c55bfe2 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -432,7 +432,6 @@ Widgets.NavigableFocusScope {
Widgets.DrawerExt {
id: controlBarView
- property var autoHide: controlBarView.contentItem.autoHide
readonly property int sliderY: contentItem.sliderY
anchors {
@@ -447,13 +446,14 @@ Widgets.NavigableFocusScope {
component: MouseArea {
id: controllerMouseArea
- property alias autoHide: controllerId.autoHide
readonly property alias sliderY: controllerId.sliderY
height: controllerId.implicitHeight + controllerId.anchors.bottomMargin
width: controlBarView.width
hoverEnabled: true
+ onContainsMouseChanged: rootPlayer.lockUnlockAutoHide(containsMouse, topcontrolView)
+
ControlBar {
id: controllerId
focus: true
@@ -462,18 +462,10 @@ Widgets.NavigableFocusScope {
anchors.rightMargin: VLCStyle.applicationHorizontalMargin
anchors.bottomMargin: VLCStyle.applicationVerticalMargin
colors: rootPlayer.colors
-
- lockAutoHide: playlistpopup.state === "visible"
- || !player.hasVideoOutput
- || !rootPlayer.hasEmbededVideo
- || controllerMouseArea.containsMouse
- onAutoHideChanged: {
- if (autoHide)
- toolbarAutoHide.restart()
- }
-
navigationParent: rootPlayer
navigationUpItem: playlistpopup.showPlaylist ? playlistpopup : (audioControls.visible ? audioControls : topcontrolView)
+
+ onRequestLockUnlockAutoHide: rootPlayer.lockUnlockAutoHide(lock, source)
}
}
}
@@ -549,8 +541,6 @@ Widgets.NavigableFocusScope {
{
if (!rootPlayer._autoHide)
return;
- if (!controlBarView.autoHide)
- return;
controlBarView.state = "hidden"
topcontrolView.state = "hidden"
videoSurface.forceActiveFocus()
diff --git a/modules/gui/qt/player/qml/PlayerButtonsLayout.qml b/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
index a4c0dc56b0..ec531b5494 100644
--- a/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
+++ b/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
@@ -43,6 +43,8 @@ Widgets.NavigableFocusScope {
property real spacing: VLCStyle.margin_normal // spacing between controls
property real layoutSpacing: VLCStyle.margin_xlarge // spacing between layouts (left, center, and right)
+ signal requestLockUnlockAutoHide(bool lock, var source)
+
enum Alignment {
Left = 0,
Center = 1,
@@ -66,6 +68,8 @@ Widgets.NavigableFocusScope {
isMiniplayer: false
parentWindow: g_root
+
+ onRequestLockUnlockAutoHide: playerButtonsLayout.requestLockUnlockAutoHide(lock, source)
}
ButtonsLayout {
More information about the vlc-commits
mailing list