[vlc-commits] qml: draw background from Player for resume dialog

Prince Gupta git at videolan.org
Mon Apr 12 08:07:54 UTC 2021


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Mon Apr  5 16:38:39 2021 +0530| [e3c35317f7075d47778a948b9f3bfe0c7d861768] | committer: Pierre Lamot

qml: draw background from Player for resume dialog

This makes all possible backgrounds for TopBar of Player at one place,
this is also necessary since application margin is applied in content
of TopBar but background don't need to follow the application margins
also controls like PlaylistView needs to overlap with TopBar's
background but not content.

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/player/qml/Player.qml       |  26 ++++++-
 modules/gui/qt/player/qml/ResumeDialog.qml | 121 ++++++++++++++---------------
 2 files changed, 82 insertions(+), 65 deletions(-)

diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index bcfc331911..6093aac4f7 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -204,9 +204,18 @@ Widgets.NavigableFocusScope {
         edge: Widgets.DrawerExt.Edges.Top
         state: topcontrolView.state
         width: parent.width
-        visible: rootPlayer.hasEmbededVideo || rootPlayer.pinVideoControls
+        visible: rootPlayer.hasEmbededVideo || rootPlayer.pinVideoControls || topcontrolView.contentItem.isResumeDialogVisible
         height: contentItem.height
-        component: rootPlayer.pinVideoControls ? backgroundForPinnedControls : topcontrolViewBackground
+
+        component: {
+            if (rootPlayer.pinVideoControls)
+                return backgroundForPinnedControls
+            else if (topcontrolView.contentItem.isResumeDialogVisible)
+                return topcontrolViewResumeBg
+            else
+                return topcontrolViewBackground
+        }
+
         onContentItemChanged: {
             if (rootPlayer.pinVideoControls)
                 contentItem.height = Qt.binding(function () { return topcontrolView.height + topcontrolView.anchors.topMargin; })
@@ -224,6 +233,17 @@ Widgets.NavigableFocusScope {
                 }
             }
         }
+
+        Component {
+            id: topcontrolViewResumeBg
+
+            Rectangle {
+                width: rootPlayer.width
+                height: topcontrolView.height + topcontrolView.anchors.topMargin * 2
+                color: rootPlayer.colors.playerBg
+                opacity: .8
+            }
+        }
     }
 
     /* bottom control bar background */
@@ -301,6 +321,8 @@ Widgets.NavigableFocusScope {
         state: "visible"
 
         component: FocusScope {
+            readonly property bool isResumeDialogVisible: resumeDialog.visible
+
             width: topcontrolView.width
             height: topbar.implicitHeight
             focus: true
diff --git a/modules/gui/qt/player/qml/ResumeDialog.qml b/modules/gui/qt/player/qml/ResumeDialog.qml
index be9be59861..72676679f8 100644
--- a/modules/gui/qt/player/qml/ResumeDialog.qml
+++ b/modules/gui/qt/player/qml/ResumeDialog.qml
@@ -85,82 +85,77 @@ Widgets.NavigableFocusScope {
         hideResumePanel()
     }
 
-    Rectangle {
+    //drag and dbl click the titlebar in CSD mode
+    Loader {
         anchors.fill: parent
-        color: resumePanel.colors.setColorAlpha(resumePanel.colors.playerBg, 0.8)
+        active: mainInterface.clientSideDecoration
+        source: "qrc:///widgets/CSDTitlebarTapNDrapHandler.qml"
+    }
 
-        //drag and dbl click the titlebar in CSD mode
-        Loader {
-            anchors.fill: parent
-            active: mainInterface.clientSideDecoration
-            source: "qrc:///widgets/CSDTitlebarTapNDrapHandler.qml"
-        }
+    RowLayout {
+        id: layout
 
-        RowLayout {
-            id: layout
+        anchors.fill: parent
+        anchors.leftMargin: VLCStyle.margin_small
+        spacing: VLCStyle.margin_small
 
-            anchors.fill: parent
-            anchors.leftMargin: VLCStyle.margin_small
-            spacing: VLCStyle.margin_small
+        Label {
+            Layout.preferredHeight: implicitHeight
+            Layout.preferredWidth: implicitWidth
 
-            Label {
-                Layout.preferredHeight: implicitHeight
-                Layout.preferredWidth: implicitWidth
+            color: resumePanel.colors.playerFg
+            font.pixelSize: VLCStyle.fontSize_normal
+            font.bold: true
 
-                color: resumePanel.colors.playerFg
-                font.pixelSize: VLCStyle.fontSize_normal
-                font.bold: true
+            text: i18n.qtr("Do you want to restart the playback where you left off?")
+        }
 
-                text: i18n.qtr("Do you want to restart the playback where you left off?")
+        Widgets.TabButtonExt {
+            id: continueBtn
+            Layout.preferredHeight: implicitHeight
+            Layout.preferredWidth: implicitWidth
+            text: i18n.qtr("Continue")
+            font.bold: true
+            color: resumePanel.colors.playerFg
+            focus: true
+            onClicked: {
+                player.restorePlaybackPos()
+                hideResumePanel()
             }
 
-            Widgets.TabButtonExt {
-                id: continueBtn
-                Layout.preferredHeight: implicitHeight
-                Layout.preferredWidth: implicitWidth
-                text: i18n.qtr("Continue")
-                font.bold: true
-                color: resumePanel.colors.playerFg
-                focus: true
-                onClicked: {
-                    player.restorePlaybackPos()
-                    hideResumePanel()
-                }
-
-                KeyNavigation.right: closeBtn
-            }
+            KeyNavigation.right: closeBtn
+        }
 
-            Widgets.TabButtonExt {
-                id: closeBtn
-                Layout.preferredHeight: implicitHeight
-                Layout.preferredWidth: implicitWidth
-                text: i18n.qtr("Dismiss")
-                font.bold: true
-                color: resumePanel.colors.playerFg
-                onClicked: hideResumePanel()
+        Widgets.TabButtonExt {
+            id: closeBtn
+            Layout.preferredHeight: implicitHeight
+            Layout.preferredWidth: implicitWidth
+            text: i18n.qtr("Dismiss")
+            font.bold: true
+            color: resumePanel.colors.playerFg
+            onClicked: hideResumePanel()
 
-                KeyNavigation.left: continueBtn
-            }
+            KeyNavigation.left: continueBtn
+        }
 
-            Item {
-                Layout.fillWidth: true
-            }
+        Item {
+            Layout.fillWidth: true
+        }
 
-            Loader {
-                id: csdDecorations
-
-                Layout.alignment: Qt.AlignTop | Qt.AlignRight
-
-                focus: false
-                height: VLCStyle.icon_normal
-                active: mainInterface.clientSideDecoration
-                enabled: mainInterface.clientSideDecoration
-                visible: mainInterface.clientSideDecoration
-                source: "qrc:///widgets/CSDWindowButtonSet.qml"
-                onLoaded: {
-                    item.color = Qt.binding(function() { return resumePanel.colors.playerFg })
-                    item.hoverColor = Qt.binding(function() { return resumePanel.colors.windowCSDButtonDarkBg })
-                }
+        Loader {
+            id: csdDecorations
+
+            Layout.alignment: Qt.AlignTop | Qt.AlignRight
+
+            focus: false
+            height: VLCStyle.icon_normal
+            active: mainInterface.clientSideDecoration
+            enabled: mainInterface.clientSideDecoration
+            visible: mainInterface.clientSideDecoration
+            source: "qrc:///widgets/CSDWindowButtonSet.qml"
+            onLoaded: {
+                item.color = Qt.binding(function() { return resumePanel.colors.playerFg })
+                item.hoverColor = Qt.binding(function() { return resumePanel.colors.windowCSDButtonDarkBg })
             }
         }
     }



More information about the vlc-commits mailing list