[vlc-commits] qml: replace the inline track/subtitle selection with a menu in the player
Pierre Lamot
git at videolan.org
Mon Oct 14 11:59:44 CEST 2019
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Wed Oct 9 17:11:25 2019 +0200| [0d1b2913c5f49536f6833e4c140b212db93f6dc8] | committer: Jean-Baptiste Kempf
qml: replace the inline track/subtitle selection with a menu in the player
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0d1b2913c5f49536f6833e4c140b212db93f6dc8
---
modules/gui/qt/qml/player/ControlButtons.qml | 81 +++++++++++++++++++++++++++-
modules/gui/qt/qml/player/Player.qml | 8 +++
2 files changed, 88 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/qml/player/ControlButtons.qml b/modules/gui/qt/qml/player/ControlButtons.qml
index 5f7da1c3b9..c75abf3301 100644
--- a/modules/gui/qt/qml/player/ControlButtons.qml
+++ b/modules/gui/qt/qml/player/ControlButtons.qml
@@ -206,7 +206,86 @@ Item{
id: langBtn
size: VLCStyle.icon_medium
text: VLCIcons.audiosub
- onClicked: root.showTrackBar()
+
+ onClicked: {
+ root._lockAutoHide += 1
+ langMenu.open()
+ }
+
+ PlayerMenu {
+ id: langMenu
+ parent: rootPlayer
+ onOpened: rootPlayer._menu = langMenu
+ onMenuClosed: {
+ root._lockAutoHide -= 1
+ langBtn.forceActiveFocus()
+ rootPlayer._menu = undefined
+ }
+ focus: true
+
+ title: qsTr("Languages and Tracks")
+
+ PlayerMenu {
+ id: subtrackMenu
+ onOpened: rootPlayer._menu = subtrackMenu
+ parentMenu: langMenu
+ title: qsTr("Subtitle Track")
+ enabled: player.isPlaying && player.subtitleTracks.count > 0
+ Repeater {
+ model: player.subtitleTracks
+ PlayerMenuItem {
+ parentMenu: subtrackMenu
+ text: model.display
+ checkable: true
+ checked: model.checked
+ onTriggered: model.checked = !model.checked
+ }
+ }
+ onMenuClosed: langMenu.menuClosed()
+ }
+
+ PlayerMenu {
+ id: audiotrackMenu
+ title: qsTr("Audio Track")
+
+ parentMenu: langMenu
+ onOpened: rootPlayer._menu = audiotrackMenu
+
+ enabled: player.isPlaying && player.audioTracks.count > 0
+ Repeater {
+ model: player.audioTracks
+ PlayerMenuItem {
+ parentMenu: audiotrackMenu
+
+ text: model.display
+ checkable: true
+ checked: model.checked
+ onTriggered: model.checked = !model.checked
+ }
+ }
+ onMenuClosed: langMenu.menuClosed()
+ }
+
+ PlayerMenu {
+ id: videotrackMenu
+ title: qsTr("Video Track")
+ parentMenu: langMenu
+ onOpened: rootPlayer._menu = videotrackMenu
+ enabled: player.isPlaying && player.videoTracks.count > 0
+ Repeater {
+ model: player.videoTracks
+ PlayerMenuItem {
+ parentMenu: videotrackMenu
+ text: model.display
+ checkable: true
+ checked: model.checked
+ onTriggered: model.checked = !model.checked
+ }
+ }
+ onMenuClosed: langMenu.menuClosed()
+ }
+ }
+
property bool acceptFocus: true
}
}
diff --git a/modules/gui/qt/qml/player/Player.qml b/modules/gui/qt/qml/player/Player.qml
index d91298ae3f..6e73684e7f 100644
--- a/modules/gui/qt/qml/player/Player.qml
+++ b/modules/gui/qt/qml/player/Player.qml
@@ -30,6 +30,14 @@ import "qrc:///menus/" as Menus
Utils.NavigableFocusScope {
id: rootPlayer
+ //menu/overlay to dismiss
+ property var _menu: undefined
+
+ function dismiss() {
+ if (_menu)
+ _menu.dismiss()
+ }
+
//center image
Rectangle {
visible: !rootWindow.hasEmbededVideo
More information about the vlc-commits
mailing list