[vlc-devel] [RFC 74/82] qml: provide a player view for video and music
Pierre Lamot
pierre at videolabs.io
Fri Feb 1 14:02:18 CET 2019
From: Chenrui He <hechenrui123 at gmail.com>
the player provides:
- basic playback operations
- access to the playqueue to change track or manipulate it
- track selection (audio/video/sub)
---
modules/gui/qt/Makefile.am | 6 +
modules/gui/qt/qml/player/ControlBar.qml | 212 ++++++++++++++++++
modules/gui/qt/qml/player/ModalControlBar.qml | 81 +++++++
modules/gui/qt/qml/player/Player.qml | 194 ++++++++++++++++
modules/gui/qt/qml/player/SliderBar.qml | 89 ++++++++
modules/gui/qt/qml/player/TrackInfo.qml | 76 +++++++
modules/gui/qt/qml/player/TrackSelector.qml | 122 ++++++++++
modules/gui/qt/vlc.qrc | 8 +
8 files changed, 788 insertions(+)
create mode 100644 modules/gui/qt/qml/player/ControlBar.qml
create mode 100644 modules/gui/qt/qml/player/ModalControlBar.qml
create mode 100644 modules/gui/qt/qml/player/Player.qml
create mode 100644 modules/gui/qt/qml/player/SliderBar.qml
create mode 100644 modules/gui/qt/qml/player/TrackInfo.qml
create mode 100644 modules/gui/qt/qml/player/TrackSelector.qml
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 57c6bfb156..1036ee6f68 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -523,6 +523,12 @@ libqt_plugin_la_RES = \
gui/qt/pixmaps/search_clear.svg \
gui/qt/pixmaps/lock.svg \
gui/qt/qml/about/About.qml \
+ gui/qt/qml/player/Player.qml \
+ gui/qt/qml/player/TrackInfo.qml \
+ gui/qt/qml/player/TrackSelector.qml \
+ gui/qt/qml/player/ControlBar.qml \
+ gui/qt/qml/player/ModalControlBar.qml \
+ gui/qt/qml/player/SliderBar.qml \
gui/qt/qml/dialogs/Dialogs.qml \
gui/qt/qml/dialogs/ModalDialog.qml \
gui/qt/qml/utils/DNDLabel.qml \
diff --git a/modules/gui/qt/qml/player/ControlBar.qml b/modules/gui/qt/qml/player/ControlBar.qml
new file mode 100644
index 0000000000..a975b9863d
--- /dev/null
+++ b/modules/gui/qt/qml/player/ControlBar.qml
@@ -0,0 +1,212 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+import QtQuick 2.11
+import QtQuick.Controls 2.4
+import QtQuick.Layouts 1.3
+
+import org.videolan.vlc 0.1
+
+import "qrc:///style/"
+import "qrc:///utils/" as Utils
+import "qrc:///menus/" as Menus
+
+
+Utils.NavigableFocusScope {
+ id: root
+
+ signal showTrackBar()
+ signal showPlaylist()
+
+ property bool showPlaylistButton: false
+
+ Keys.priority: Keys.AfterItem
+ Keys.onPressed: defaultKeyAction(event, 0)
+
+ onActionCancel: playlistCtrl.stop()
+
+ PlaylistControlerModel {
+ id: playlistCtrl
+ playlistPtr: mainctx.playlist
+ }
+
+
+ ColumnLayout {
+ anchors.fill: parent
+ spacing: 0
+
+ SliderBar {
+ id: trackPositionSlider
+ Layout.alignment: Qt.AlignLeft | Qt.AlignTop
+ Layout.fillWidth: true
+ enabled: player.playingState == PlayerControler.PLAYING_STATE_PLAYING || player.playingState == PlayerControler.PLAYING_STATE_PAUSED
+ Keys.onDownPressed: buttons.focus = true
+
+ }
+
+ Utils.NavigableFocusScope {
+ id: buttons
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ focus: true
+
+ onActionUp: {
+ if (trackPositionSlider.enabled)
+ trackPositionSlider.focus = true
+ else
+ root.actionUp(index)
+ }
+ onActionDown: root.actionDown(index)
+ onActionLeft: root.actionLeft(index)
+ onActionRight: root.actionRight(index)
+ onActionCancel: root.actionCancel(index)
+
+ Keys.priority: Keys.AfterItem
+ Keys.onPressed: defaultKeyAction(event, 0)
+
+ TrackInfo {
+ anchors.left: parent.left
+ anchors.right: centerbuttons.left
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ }
+
+ ToolBar {
+ id: centerbuttons
+ anchors.centerIn: parent
+
+ focusPolicy: Qt.StrongFocus
+ focus: true
+
+ background: Rectangle {
+ color: "transparent"
+ }
+
+ Component.onCompleted: {
+ playBtn.focus= true
+ }
+
+ RowLayout {
+ focus: true
+ anchors.fill: parent
+ Utils.IconToolButton {
+ size: VLCStyle.icon_large
+ checked: playlistCtrl.random
+ text: VLCIcons.shuffle_on
+ onClicked: playlistCtrl.toggleRandom()
+ KeyNavigation.right: prevBtn
+ }
+
+ Utils.IconToolButton {
+ id: prevBtn
+ size: VLCStyle.icon_large
+ text: VLCIcons.previous
+ onClicked: playlistCtrl.prev()
+ KeyNavigation.right: playBtn
+ }
+
+ Utils.IconToolButton {
+ id: playBtn
+ size: VLCStyle.icon_large
+ text: (player.playingState !== PlayerControler.PLAYING_STATE_PAUSED
+ && player.playingState !== PlayerControler.PLAYING_STATE_STOPPED)
+ ? VLCIcons.pause
+ : VLCIcons.play
+ onClicked: playlistCtrl.togglePlayPause()
+ focus: true
+ KeyNavigation.right: nextBtn
+ }
+
+ Utils.IconToolButton {
+ id: nextBtn
+ size: VLCStyle.icon_large
+ text: VLCIcons.next
+ onClicked: playlistCtrl.next()
+ KeyNavigation.right: randomBtn
+ }
+
+ Utils.IconToolButton {
+ id: randomBtn
+ size: VLCStyle.icon_large
+ checked: playlistCtrl.repeatMode !== PlaylistControlerModel.PLAYBACK_REPEAT_NONE
+ text: (playlistCtrl.repeatMode == PlaylistControlerModel.PLAYBACK_REPEAT_CURRENT)
+ ? VLCIcons.repeat_one
+ : VLCIcons.repeat_all
+ onClicked: playlistCtrl.toggleRepeatMode()
+ KeyNavigation.right: langBtn
+ }
+ }
+ }
+
+ ToolBar {
+ id: rightButtons
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+
+ focusPolicy: Qt.StrongFocus
+ background: Rectangle {
+ color: "transparent"
+ }
+ Component.onCompleted: {
+ rightButtons.contentItem.focus= true
+ }
+
+ RowLayout {
+ anchors.fill: parent
+
+
+ Utils.IconToolButton {
+ id: langBtn
+ size: VLCStyle.icon_large
+ text: VLCIcons.audiosub
+ onClicked: root.showTrackBar()
+ KeyNavigation.right: showPlaylistButton ? playlistBtn : menuBtn
+ }
+
+ Utils.IconToolButton {
+ id: playlistBtn
+ visible: showPlaylistButton
+ size: VLCStyle.icon_large
+ text: VLCIcons.playlist
+ onClicked: root.showPlaylist()
+ KeyNavigation.right: menuBtn
+ }
+
+ Utils.IconToolButton {
+ id: menuBtn
+ size: VLCStyle.icon_large
+ text: VLCIcons.menu
+ onClicked: mainMenu.openAbove(this)
+ KeyNavigation.right: fullscreenBtn
+ Menus.MainMenu {
+ id: mainMenu
+ onClosed: menuBtn.forceActiveFocus()
+ }
+ }
+
+ Utils.IconToolButton {
+ id: fullscreenBtn
+ size: VLCStyle.icon_large
+ text: VLCIcons.exit
+ onClicked: playlistCtrl.stop()
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/modules/gui/qt/qml/player/ModalControlBar.qml b/modules/gui/qt/qml/player/ModalControlBar.qml
new file mode 100644
index 0000000000..7beae1df89
--- /dev/null
+++ b/modules/gui/qt/qml/player/ModalControlBar.qml
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+import QtQuick 2.11
+import QtQuick.Controls 2.4
+import QtQuick.Layouts 1.3
+
+import org.videolan.vlc 0.1
+
+import "qrc:///style/"
+import "qrc:///utils/" as Utils
+
+Utils.NavigableFocusScope {
+ id: root
+ signal showPlaylist();
+
+ property bool showPlaylistButton: false
+
+ property bool forceNoAutoHide: false
+ property bool noAutoHide: state !== "control" || forceNoAutoHide
+
+ Component {
+ id: controlbarComp_id
+ ControlBar {
+ focus: true
+
+ showPlaylistButton: root.showPlaylistButton
+
+ onShowTrackBar: root.state = "tracks"
+ onShowPlaylist: root.showPlaylist()
+
+ onActionUp: root.actionUp(index)
+ onActionDown: root.actionDown(index)
+ onActionLeft: root.actionLeft(index)
+ onActionRight: root.actionRight(index)
+ onActionCancel: root.actionCancel(index)
+ }
+ }
+
+ Component {
+ id: trackbarComp_id
+ TrackSelector {
+ focus: true
+ onActionCancel: root.state = "control"
+
+ onActionUp: root.actionUp(index)
+ onActionDown: root.actionDown(index)
+ onActionLeft: root.actionLeft(index)
+ onActionRight: root.actionRight(index)
+ }
+ }
+
+ Utils.StackViewExt {
+ id: stack_id
+ initialItem: controlbarComp_id
+ anchors.fill: parent
+ focus: true
+ }
+
+ state: "control"
+ onStateChanged: {
+ if (state === "tracks")
+ stack_id.replace(trackbarComp_id)
+ else if (state === "control")
+ stack_id.replace(controlbarComp_id)
+ }
+}
diff --git a/modules/gui/qt/qml/player/Player.qml b/modules/gui/qt/qml/player/Player.qml
new file mode 100644
index 0000000000..65487fec63
--- /dev/null
+++ b/modules/gui/qt/qml/player/Player.qml
@@ -0,0 +1,194 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+import QtQuick 2.11
+import QtQuick.Controls 2.4
+import QtQuick.Layouts 1.3
+import QtGraphicalEffects 1.0
+
+import org.videolan.vlc 0.1
+
+import "qrc:///style/"
+import "qrc:///utils/" as Utils
+import "qrc:///playlist/" as PL
+
+Utils.NavigableFocusScope {
+ id: root
+
+ PlaylistControlerModel {
+ id: playlistCtrl
+ playlistPtr: mainctx.playlist
+ }
+
+ //center image
+ Rectangle {
+ visible: !rootWindow.hasEmbededVideo
+ focus: false
+ color: VLCStyle.colors.bg
+ anchors.fill: parent
+
+ Image {
+ id: cover
+ source: (playlistCtrl.currentItem.artwork && playlistCtrl.currentItem.artwork.toString())
+ ? playlistCtrl.currentItem.artwork
+ : VLCStyle.noArtCover
+ fillMode: Image.PreserveAspectFit
+ width: parent.width / 2
+ height: parent.height / 2
+ anchors.centerIn: parent
+ }
+
+ DropShadow {
+ anchors.fill: cover
+ source: cover
+ horizontalOffset: 3
+ verticalOffset: 10
+ radius: 12
+ samples: 17
+ color: "black"
+ }
+ }
+
+ VideoSurface {
+ id: videoSurface
+ ctx: mainctx
+ visible: rootWindow.hasEmbededVideo
+ anchors.fill: parent
+ onMouseMoved: toolbarAutoHide.setVisible()
+ }
+
+ Utils.Drawer {
+ id: playlistpopup
+ anchors {
+ top: parent.top
+ right: parent.right
+ bottom: controlBarView.top
+ }
+ focus: false
+ expandHorizontally: true
+
+ component: Rectangle {
+ color: VLCStyle.colors.setColorAlpha(VLCStyle.colors.banner, 0.8)
+ width: root.width/4
+ height: playlistpopup.height
+
+ PL.PlaylistListView {
+ id: playlistView
+ focus: true
+ anchors.fill: parent
+ onActionLeft: playlistpopup.quit()
+ onActionCancel: playlistpopup.quit()
+ }
+ }
+
+ function quit() {
+ state = "hidden"
+ controlBarView.focus = true
+ }
+ onStateChanged: {
+ if (state === "hidden")
+ toolbarAutoHide.restart()
+ }
+ }
+
+
+ Utils.Drawer {
+ id: controlBarView
+ focus: true
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ }
+ property var noAutoHide: controlBarView.contentItem.noAutoHide
+
+ state: "visible"
+ expandHorizontally: false
+
+ component: Rectangle {
+ id: controllerBarId
+ color: VLCStyle.colors.setColorAlpha(VLCStyle.colors.banner, 0.8)
+ width: controlBarView.width
+ height: 90 * VLCStyle.scale
+ property alias noAutoHide: controllerId.noAutoHide
+
+ ModalControlBar {
+ id: controllerId
+ focus: true
+ anchors.fill: parent
+
+ forceNoAutoHide: playlistpopup.state === "visible" || !player.hasVideoOutput
+ onNoAutoHideChanged: {
+ if (!noAutoHide)
+ toolbarAutoHide.restart()
+ }
+ showPlaylistButton: true
+
+ onActionUp: root.actionUp(index)
+ onActionDown: root.actionDown(index)
+ onActionLeft: root.actionLeft(index)
+ onActionRight: root.actionRight(index)
+ onActionCancel: root.actionCancel(index)
+ onShowPlaylist: {
+ if (playlistpopup.state === "visible") {
+ playlistpopup.state = "hidden"
+ } else {
+ playlistpopup.state = "visible"
+ playlistpopup.focus = true
+ }
+ }
+ }
+ }
+ }
+
+ Timer {
+ id: toolbarAutoHide
+ running: true
+ repeat: false
+ interval: 5000
+ onTriggered: {
+ if (controlBarView.noAutoHide)
+ return;
+ controlBarView.state = "hidden"
+ videoSurface.cursorShape = Qt.BlankCursor
+ }
+
+ function setVisible() {
+ controlBarView.state = "visible"
+ toolbarAutoHide.restart()
+ videoSurface.cursorShape = Qt.ArrowCursor
+ }
+ }
+
+ Component.onCompleted: {
+ filter.source = rootWindow
+ }
+
+ EventFilter {
+ id: filter
+ filterEnabled: true
+
+ //only handle key release to avoid underneath button to be
+ //triggered as it gains focus between events
+ Keys.onReleased: {
+ if (controlBarView.state === "hidden")
+ event.accepted = true
+ toolbarAutoHide.setVisible()
+ }
+ }
+
+}
diff --git a/modules/gui/qt/qml/player/SliderBar.qml b/modules/gui/qt/qml/player/SliderBar.qml
new file mode 100644
index 0000000000..d790e18683
--- /dev/null
+++ b/modules/gui/qt/qml/player/SliderBar.qml
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+import QtQuick 2.11
+import QtQuick.Controls 2.4
+
+import "qrc:///style/"
+
+Slider {
+ id: control
+ anchors.margins: VLCStyle.margin_xxsmall
+
+ value: player.position
+ onMoved: player.position = control.position
+
+ height: control.barHeight + VLCStyle.fontHeight_normal + VLCStyle.margin_xxsmall * 2
+ implicitHeight: control.barHeight + VLCStyle.fontHeight_normal + VLCStyle.margin_xxsmall * 2
+
+ topPadding: 0
+ leftPadding: 0
+ bottomPadding: 0
+ rightPadding: 0
+
+ stepSize: 0.01
+
+ property int barHeight: 5
+
+ background: Rectangle {
+ width: control.availableWidth
+ implicitHeight: control.implicitHeight
+ height: implicitHeight
+ color: "transparent"
+
+ Rectangle {
+ width: control.visualPosition * parent.width
+ height: control.barHeight
+ color: control.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.bgHover
+ radius: control.barHeight
+ }
+
+ Text {
+ text: player.time.toString()
+ color: VLCStyle.colors.text
+ font.pixelSize: VLCStyle.fontSize_normal
+ anchors {
+ bottom: parent.bottom
+ bottomMargin: VLCStyle.margin_xxsmall
+ left: parent.left
+ leftMargin: VLCStyle.margin_xxsmall
+ }
+ }
+
+ Text {
+ text: player.length.toString()
+ color: VLCStyle.colors.text
+ font.pixelSize: VLCStyle.fontSize_normal
+ anchors {
+ bottom: parent.bottom
+ bottomMargin: VLCStyle.margin_xxsmall
+ right: parent.right
+ rightMargin: VLCStyle.margin_xxsmall
+ }
+ }
+ }
+
+ handle: Rectangle {
+ visible: control.activeFocus
+ x: (control.visualPosition * control.availableWidth) - width / 2
+ y: (control.barHeight - width) / 2
+ implicitWidth: VLCStyle.margin_small
+ implicitHeight: VLCStyle.margin_small
+ radius: VLCStyle.margin_small
+ color: VLCStyle.colors.accent
+ }
+}
diff --git a/modules/gui/qt/qml/player/TrackInfo.qml b/modules/gui/qt/qml/player/TrackInfo.qml
new file mode 100644
index 0000000000..b745dd8429
--- /dev/null
+++ b/modules/gui/qt/qml/player/TrackInfo.qml
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+import QtQuick 2.11
+import QtQuick.Controls 2.4
+import QtQuick.Layouts 1.3
+import org.videolan.vlc 0.1
+
+import "qrc:///style/"
+import "qrc:///utils/" as Utils
+
+Item {
+ id: root
+
+ PlaylistControlerModel {
+ id: playlist
+ playlistPtr: mainctx.playlist
+ }
+
+ RowLayout {
+ id: rowLayout
+ anchors.fill: parent
+
+ Image {
+ //color:"red"
+ Layout.preferredWidth: VLCStyle.heightAlbumCover_small
+ Layout.preferredHeight: VLCStyle.heightAlbumCover_small
+ Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
+ fillMode : Image.PreserveAspectFit
+ source: (playlist.currentItem.artwork && playlist.currentItem.artwork.toString()) ? playlist.currentItem.artwork : VLCStyle.noArtCover
+ }
+
+ ColumnLayout {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ Text {
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
+
+ font.pixelSize: VLCStyle.fontSize_normal
+ color: VLCStyle.colors.text
+ font.bold: true
+
+ text: playlist.currentItem.title
+ }
+
+ Text {
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
+
+ font.pixelSize: VLCStyle.fontSize_small
+
+ color: VLCStyle.colors.text
+ text: playlist.currentItem.artist
+ }
+
+ }
+
+ }
+
+}
diff --git a/modules/gui/qt/qml/player/TrackSelector.qml b/modules/gui/qt/qml/player/TrackSelector.qml
new file mode 100644
index 0000000000..fceefb9f44
--- /dev/null
+++ b/modules/gui/qt/qml/player/TrackSelector.qml
@@ -0,0 +1,122 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+import QtQuick 2.11
+import QtQuick.Controls 2.4
+import QtQuick.Layouts 1.3
+import org.videolan.vlc 0.1
+
+import "qrc:///style/"
+import "qrc:///utils/" as Utils
+
+Utils.NavigableFocusScope {
+ id: root
+
+ Component {
+ id: delegateComponent
+
+ Row {
+ focus: true
+ spacing: VLCStyle.margin_small
+ opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2)
+ height: VLCStyle.fontHeight_large + VLCStyle.margin_small
+
+ Label {
+ id: checbock_id
+ font.pixelSize: VLCStyle.fontSize_large
+ anchors.verticalCenter: parent.verticalCenter
+ visible: model.checked
+ color: (Tumbler.tumbler.activeFocus && model.index === Tumbler.tumbler.currentIndex ) ? VLCStyle.colors.accent : VLCStyle.colors.text
+ font.bold: true
+ text: "☑"
+ }
+ Label {
+ id: label_id
+ text: model.display
+ anchors.verticalCenter: parent.verticalCenter
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ font.pixelSize: (model.index === Tumbler.tumbler.currentIndex) ? VLCStyle.fontSize_large * 1.3 : VLCStyle.fontSize_large
+ color: (Tumbler.tumbler.activeFocus && model.index === Tumbler.tumbler.currentIndex ) ? VLCStyle.colors.accent : VLCStyle.colors.text
+ font.bold: true
+ }
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Space || event.matches(StandardKey.InsertParagraphSeparator)) { //enter/return/space
+ model.checked = !model.checked
+ }
+ }
+ }
+ }
+
+ Utils.IconToolButton {
+ id: back
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ size: VLCStyle.icon_large
+ text: VLCIcons.exit
+ onClicked: root.actionCancel(0)
+ KeyNavigation.right: trackTypeTumbler
+ }
+
+ Tumbler {
+ id: trackTypeTumbler
+ anchors.right: trackTumble.left
+ anchors.verticalCenter: parent.verticalCenter
+ //fixme hardcoded
+ width: 100 * VLCStyle.scale
+ height: parent.height
+
+ //Layout.fillHeight: true
+ //Layout.preferredWidth: root.width/4
+ //Layout.alignment: Qt.AlignCenter
+ focus: true
+ model: ListModel {
+ ListElement { display: qsTr("subtitle") ; checked: false }
+ ListElement { display: qsTr("audio") ; checked: false }
+ ListElement { display: qsTr("video") ; checked: false }
+ }
+ delegate: delegateComponent
+ currentIndex: 0
+
+ //Keys.forwardTo: [trackTypeTumbler.currentItem]
+ KeyNavigation.right: trackTumble
+ }
+ //
+ Tumbler {
+ id: trackTumble
+
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: parent.height
+ width: parent.width / 2
+
+ //Layout.fillHeight: true
+ //Layout.preferredWidth: root.width/4
+ //Layout.alignment: Qt.AlignCenter
+ model: (trackTypeTumbler.currentIndex === 0)
+ ? player.subtitleTracks
+ : ((trackTypeTumbler.currentIndex === 1)
+ ? player.audioTracks
+ : player.videoTracks
+ )
+ delegate: delegateComponent
+ Keys.forwardTo: [trackTumble.currentItem]
+ }
+
+ Keys.onPressed: defaultKeyAction(event, 0)
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 80dff0122f..0255e1ee79 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -203,6 +203,14 @@
<file alias="CheckableModelSubMenu.qml">qml/menus/CheckableModelSubMenu.qml</file>
<file alias="ViewMenu.qml">qml/menus/ViewMenu.qml</file>
</qresource>
+ <qresource prefix="/player">
+ <file alias="Player.qml">qml/player/Player.qml</file>
+ <file alias="ControlBar.qml">qml/player/ControlBar.qml</file>
+ <file alias="SliderBar.qml">qml/player/SliderBar.qml</file>
+ <file alias="TrackInfo.qml">qml/player/TrackInfo.qml</file>
+ <file alias="TrackSelector.qml">qml/player/TrackSelector.qml</file>
+ <file alias="ModalControlBar.qml">qml/player/ModalControlBar.qml</file>
+ </qresource>
<qresource prefix="/about">
<file alias="About.qml">qml/about/About.qml</file>
</qresource>
--
2.19.1
More information about the vlc-devel
mailing list