Skip to content

Commit

Permalink
qml: better mainplayer controlbar alignment & navigation
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Lamot <pierre@videolabs.io>
  • Loading branch information
fuzun authored and chubinou committed Nov 16, 2020
1 parent 85e667c commit 1909698
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions modules/gui/qt/player/qml/ControlBar.qml
Expand Up @@ -84,14 +84,15 @@ Widgets.NavigableFocusScope {
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.fillWidth: true
enabled: player.playingState == PlayerController.PLAYING_STATE_PLAYING || player.playingState == PlayerController.PLAYING_STATE_PAUSED
Keys.onDownPressed: buttons.focus = true
Keys.onDownPressed: buttons_left.focus = true

parentWindow: mainInterfaceRect
}

RowLayout {
Item {
Layout.fillWidth: true
Layout.bottomMargin: VLCStyle.margin_xsmall
Layout.preferredHeight: Math.max(buttons_left.implicitHeight, buttons_center.implicitHeight, buttons_right.implicitHeight)

PlayerButtonsLayout {
id: buttons_left
Expand All @@ -101,6 +102,10 @@ Widgets.NavigableFocusScope {

focus: true

anchors.left: parent.left

visible: model.count > 0 && (playerControlBarModel_center.count > 0 ? ((x+width) < buttons_center.x) : true)

navigationParent: root
navigationUp: function(index) {
if (trackPositionSlider.enabled)
Expand All @@ -109,14 +114,12 @@ Widgets.NavigableFocusScope {
root.navigationUp(index)
}

navigationRightItem: buttons_center

Keys.priority: Keys.AfterItem
Keys.onPressed: defaultKeyAction(event, 0)
}

Item {
Layout.fillWidth: true
}

PlayerButtonsLayout {
id: buttons_center

Expand All @@ -125,6 +128,8 @@ Widgets.NavigableFocusScope {

focus: true

anchors.horizontalCenter: parent.horizontalCenter

navigationParent: root
navigationUp: function(index) {
if (trackPositionSlider.enabled)
Expand All @@ -133,6 +138,8 @@ Widgets.NavigableFocusScope {
root.navigationUp(index)
}

navigationLeftItem: buttons_left
navigationRightItem: buttons_right

Keys.priority: Keys.AfterItem
Keys.onPressed: defaultKeyAction(event, 0)
Expand All @@ -150,6 +157,11 @@ Widgets.NavigableFocusScope {

focus: true

anchors.right: parent.right

visible: model.count > 0 && (playerControlBarModel_center.count > 0 ? ((buttons_center.x + buttons_center.width) < x)
: !(((buttons_left.x + buttons_left.width) > x) && playerControlBarModel_left.count > 0))

navigationParent: root
navigationUp: function(index) {
if (trackPositionSlider.enabled)
Expand All @@ -158,6 +170,8 @@ Widgets.NavigableFocusScope {
root.navigationUp(index)
}

navigationLeftItem: buttons_center

Keys.priority: Keys.AfterItem
Keys.onPressed: defaultKeyAction(event, 0)
}
Expand Down

0 comments on commit 1909698

Please sign in to comment.