[vlc-devel] [PATCH 2/3] qml: draw background from Player for resume dialog
Prince Gupta
guptaprince8832 at gmail.com
Mon Apr 5 10:50:39 UTC 2021
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.
---
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 e7190fcd34..dc464b8f4e 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -200,9 +200,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; })
@@ -220,6 +229,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 */
@@ -297,6 +317,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 })
}
}
}
--
2.27.0
More information about the vlc-devel
mailing list