[vlc-commits] qml: show the media title on top of the player view

Pierre Lamot git at videolan.org
Thu Feb 20 13:56:47 CET 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Mon Feb 17 17:23:10 2020 +0100| [bc779196bd8b91a258245880ce643a4e0b45079f] | committer: Jean-Baptiste Kempf

qml: show the media title on top of the player view

  For both video and audio

  The title take the previous place of the resume panel

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bc779196bd8b91a258245880ce643a4e0b45079f
---

 modules/gui/qt/player/qml/Player.qml       |  2 -
 modules/gui/qt/player/qml/ResumeDialog.qml | 82 +++++++++++++++++++-----------
 modules/gui/qt/player/qml/TopBar.qml       | 43 +++++++++-------
 3 files changed, 77 insertions(+), 50 deletions(-)

diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index b23359029c..b83fb052d7 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -195,8 +195,6 @@ Widgets.NavigableFocusScope {
                     rootWindow.playlistVisible = !rootWindow.playlistVisible
             }
 
-            onResumeDialogHidden: controlBarView.forceActiveFocus()
-
             navigationParent: rootPlayer
             navigationDownItem: playlistpopup.showPlaylist ? playlistpopup : controlBarView
         }
diff --git a/modules/gui/qt/player/qml/ResumeDialog.qml b/modules/gui/qt/player/qml/ResumeDialog.qml
index 3ab05af1f3..52ee217d82 100644
--- a/modules/gui/qt/player/qml/ResumeDialog.qml
+++ b/modules/gui/qt/player/qml/ResumeDialog.qml
@@ -73,45 +73,67 @@ Widgets.NavigableFocusScope {
         }
     }
 
-    RowLayout {
-        id: layout
+    Keys.priority: Keys.AfterItem
+    Keys.onPressed: defaultKeyAction(event)
+    Keys.onReleased: defaultKeyReleaseAction(event)
+
+    navigationCancel: function() {
+        hideResumePanel()
+    }
+
+    Rectangle {
         anchors.fill: parent
+        color: VLCStyle.colors.setColorAlpha(VLCStyle.colors.playerBg, 0.8)
 
-        Text {
-            Layout.preferredHeight: implicitHeight
-            Layout.fillWidth: true
+        RowLayout {
+            id: layout
+            anchors.fill: parent
+            anchors.topMargin: VLCStyle.applicationVerticalMargin
+            anchors.leftMargin: VLCStyle.applicationHorizontalMargin + VLCStyle.margin_small
+            anchors.rightMargin: VLCStyle.applicationHorizontalMargin + VLCStyle.margin_small
 
-            color: VLCStyle.colors.playerFg
-            font.pixelSize: VLCStyle.fontSize_normal
-            font.bold: true
+            spacing: VLCStyle.margin_small
 
-            text: i18n.qtr("Do you want to restart the playback where you left off?")
-        }
+            Text {
+                Layout.preferredHeight: implicitHeight
+                Layout.preferredWidth: implicitWidth
 
-        Widgets.TabButtonExt {
-            id: continueBtn
-            Layout.preferredHeight: implicitHeight
-            Layout.preferredWidth: implicitWidth
-            text: i18n.qtr("Continue")
-            font.bold: true
-            focus: true
-            onClicked: {
-                player.restorePlaybackPos()
-                hideResumePanel()
+                color: VLCStyle.colors.playerFg
+                font.pixelSize: VLCStyle.fontSize_normal
+                font.bold: true
+
+                text: i18n.qtr("Do you want to restart the playback where you left off?")
             }
 
-            KeyNavigation.right: closeBtn
-        }
+            Widgets.TabButtonExt {
+                id: continueBtn
+                Layout.preferredHeight: implicitHeight
+                Layout.preferredWidth: implicitWidth
+                text: i18n.qtr("Continue")
+                font.bold: true
+                focus: true
+                onClicked: {
+                    player.restorePlaybackPos()
+                    hideResumePanel()
+                }
+
+                KeyNavigation.right: closeBtn
+            }
 
-        Widgets.TabButtonExt {
-            id: closeBtn
-            Layout.preferredHeight: implicitHeight
-            Layout.preferredWidth: implicitWidth
-            text: "X"
-            font.bold: true
-            onClicked: hideResumePanel()
+            Widgets.TabButtonExt {
+                id: closeBtn
+                Layout.preferredHeight: implicitHeight
+                Layout.preferredWidth: implicitWidth
+                text: i18n.qtr("Dismiss")
+                font.bold: true
+                onClicked: hideResumePanel()
 
-            KeyNavigation.left: continueBtn
+                KeyNavigation.left: continueBtn
+            }
+
+            Item {
+                Layout.fillWidth: true
+            }
         }
     }
 }
diff --git a/modules/gui/qt/player/qml/TopBar.qml b/modules/gui/qt/player/qml/TopBar.qml
index 6d6c9d7007..a041aff58d 100644
--- a/modules/gui/qt/player/qml/TopBar.qml
+++ b/modules/gui/qt/player/qml/TopBar.qml
@@ -17,6 +17,7 @@
  *****************************************************************************/
 
 import QtQuick 2.11
+import QtQuick.Controls 2.4
 import QtQuick.Layouts 1.3
 
 import org.videolan.vlc 0.1
@@ -27,7 +28,7 @@ import "qrc:///widgets/" as Widgets
 Widgets.NavigableFocusScope{
     id: topFocusScope
 
-    height: topcontrolContent.implicitHeight
+    implicitHeight: topcontrolContent.implicitHeight
 
     property bool autoHide: player.hasVideoOutput
                             && rootWindow.hasEmbededVideo
@@ -36,8 +37,9 @@ Widgets.NavigableFocusScope{
 
     property bool lockAutoHide: false
 
+    property alias title: titleText.text
+
     signal togglePlaylistVisiblity();
-    signal resumeDialogHidden()
 
     Keys.priority: Keys.AfterItem
     Keys.onPressed: defaultKeyAction(event, 0)
@@ -69,6 +71,9 @@ Widgets.NavigableFocusScope{
 
                 Widgets.IconToolButton {
                     id: backBtn
+
+                    Layout.alignment: Qt.AlignTop
+
                     objectName: "IconToolButton"
                     size: VLCStyle.icon_normal
                     iconText: VLCIcons.exit
@@ -80,29 +85,31 @@ Widgets.NavigableFocusScope{
                         }
                         history.previous()
                     }
-                    KeyNavigation.right: resumeDialog.visible ? resumeDialog : playlistBtn
+                    KeyNavigation.right: playlistBtn
                     focus: true
                 }
 
-                Item{
+                Label {
+                    id: titleText
+
                     Layout.fillWidth: true
-                    Layout.preferredHeight: resumeDialog.implicitHeight
-
-                    ResumeDialog {
-                        id: resumeDialog
-                        anchors.fill: parent
-                        onHidden: {
-                            if (activeFocus) {
-                                focus = false
-                                playlistBtn.focus = true
-                                resumeDialogHidden()
-                            }
-                        }
-                    }
+                    Layout.preferredHeight: implicitHeight
+                    Layout.leftMargin:  VLCStyle.margin_large
+                    Layout.rightMargin: VLCStyle.margin_large
+                    Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
+
+                    horizontalAlignment: Text.AlignHCenter
+                    color: VLCStyle.colors.playerFg
+                    font.pixelSize: VLCStyle.fontSize_xxxlarge
+                    textFormat: Text.PlainText
+                    elide: Text.ElideRight
                 }
 
                 Widgets.IconToolButton {
                     id: playlistBtn
+
+                    Layout.alignment: Qt.AlignTop
+
                     objectName: PlayerControlBarModel.PLAYLIST_BUTTON
                     size: VLCStyle.icon_normal
                     iconText: VLCIcons.playlist
@@ -111,7 +118,7 @@ Widgets.NavigableFocusScope{
                     onClicked: togglePlaylistVisiblity()
                     property bool acceptFocus: true
 
-                    KeyNavigation.left: resumeDialog.visible ? resumeDialog : backBtn
+                    KeyNavigation.left: backBtn
                 }
             }
         }



More information about the vlc-commits mailing list