[vlc-commits] qml: fix miniplayer keyboard navigation
Fatih Uzunoglu
git at videolan.org
Mon Nov 16 10:04:10 CET 2020
vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Thu Aug 13 23:55:49 2020 +0300| [4b4ff85c6a23737b0e3014824a1c324e863e54b5] | committer: Pierre Lamot
qml: fix miniplayer keyboard navigation
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4b4ff85c6a23737b0e3014824a1c324e863e54b5
---
modules/gui/qt/player/qml/ControlButtons.qml | 12 +++++++++-
modules/gui/qt/player/qml/MiniPlayer.qml | 35 ++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index 27c7bdebcf..ffaf37192d 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -147,7 +147,7 @@ Item{
Component{
id:playBtnDelegate
- Button {
+ ToolButton {
id: playBtn
width: VLCStyle.icon_medium
height: width
@@ -165,6 +165,16 @@ Item{
property bool realHovered: false
+ Keys.onPressed: {
+ if (KeyHelper.matchOk(event) ) {
+ event.accepted = true
+ }
+ }
+ Keys.onReleased: {
+ if (!event.accepted && KeyHelper.matchOk(event))
+ mainPlaylistController.togglePlayPause()
+ }
+
contentItem: Label {
id: contentLabel
color: videoOverlays ? (playBtn.enabled ? playBtn.color : playBtn.colorDisabled)
diff --git a/modules/gui/qt/player/qml/MiniPlayer.qml b/modules/gui/qt/player/qml/MiniPlayer.qml
index 57d86c5232..5fc4cbc48d 100644
--- a/modules/gui/qt/player/qml/MiniPlayer.qml
+++ b/modules/gui/qt/player/qml/MiniPlayer.qml
@@ -81,6 +81,9 @@ Widgets.NavigableFocusScope {
left: parent.left
right: parent.right
}
+
+ Keys.onDownPressed: buttonrow_left.focus = true
+ Keys.onUpPressed: root.navigationUpItem.focus = true
}
@@ -125,6 +128,18 @@ Widgets.NavigableFocusScope {
navigationParent: root
navigationRightItem: buttonrow_center
+
+ focus: true
+
+ navigationUp: function(index) {
+ if (progressBar.enabled)
+ progressBar.focus = true
+ else
+ root.navigationUp(index)
+ }
+
+ Keys.priority: Keys.AfterItem
+ Keys.onPressed: defaultKeyAction(event, 0)
}
PlayerButtonsLayout {
@@ -141,6 +156,16 @@ Widgets.NavigableFocusScope {
navigationParent: root
navigationLeftItem: buttonrow_left
navigationRightItem: buttonrow_right
+
+ navigationUp: function(index) {
+ if (progressBar.enabled)
+ progressBar.focus = true
+ else
+ root.navigationUp(index)
+ }
+
+ Keys.priority: Keys.AfterItem
+ Keys.onPressed: defaultKeyAction(event, 0)
}
PlayerButtonsLayout {
@@ -156,6 +181,16 @@ Widgets.NavigableFocusScope {
navigationParent: root
navigationLeftItem: buttonrow_center
+
+ navigationUp: function(index) {
+ if (progressBar.enabled)
+ progressBar.focus = true
+ else
+ root.navigationUp(index)
+ }
+
+ Keys.priority: Keys.AfterItem
+ Keys.onPressed: defaultKeyAction(event, 0)
}
}
More information about the vlc-commits
mailing list