[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: narrow where the effect is applied in MainDisplay for rendering optimization
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Nov 14 06:31:50 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
afc45145 by Fatih Uzunoglu at 2023-11-14T06:19:04+00:00
qml: narrow where the effect is applied in MainDisplay for rendering optimization
- - - - -
d42ac8ae by Fatih Uzunoglu at 2023-11-14T06:19:04+00:00
qml: remove unnecessary FocusScope in MainDisplay
- - - - -
1 changed file:
- modules/gui/qt/maininterface/qml/MainDisplay.qml
Changes:
=====================================
modules/gui/qt/maininterface/qml/MainDisplay.qml
=====================================
@@ -166,363 +166,366 @@ FocusScope {
colorSet: ColorContext.View
}
- FocusScope {
- focus: true
- id: medialibId
+ ColumnLayout {
+ id: mainColumn
anchors.fill: parent
+ Layout.minimumWidth: VLCStyle.minWindowWidth
+ spacing: 0
+
Navigation.parentItem: g_mainDisplay
- Rectangle {
- id: parentRectangle
- anchors.fill: parent
+ /* Source selection*/
+ Main.BannerSources {
+ id: sourcesBanner
+ z: 2
+ Layout.preferredHeight: height
+ Layout.minimumHeight: height
+ Layout.maximumHeight: height
+ Layout.fillWidth: true
- color: theme.bg.primary
+ model: g_mainDisplay.tabModel
- layer.enabled: (((GraphicsInfo.shaderType === GraphicsInfo.GLSL)) &&
- ((GraphicsInfo.shaderSourceType & GraphicsInfo.ShaderSourceString))) &&
- (miniPlayer.visible || (loaderProgress.active && loaderProgress.item.visible))
+ plListView: playlist
- layer.effect: Widgets.FrostedGlassEffect {
- ColorContext {
- id: frostedTheme
- palette: VLCStyle.palette
- colorSet: ColorContext.Window
- }
-
- tint: frostedTheme.bg.secondary
+ onItemClicked: {
+ if (selectedIndex === index)
+ return
- effectRect: {
- return Qt.rect(0, loaderProgress.y, width, height - loaderProgress.y)
- }
+ const name = g_mainDisplay.tabModel.get(index).name
+ selectedIndex = index
+ if (_oldViewProperties[name] === undefined)
+ History.push(["mc", name])
+ else
+ History.push(["mc", name], _oldViewProperties[name])
}
- ColumnLayout {
- id: mainColumn
- anchors.fill: parent
+ Navigation.parentItem: mainColumn
+ Navigation.downItem: stackView
+ }
- Layout.minimumWidth: VLCStyle.minWindowWidth
- spacing: 0
+ Item {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ z: 0
- /* Source selection*/
- Main.BannerSources {
- id: sourcesBanner
- z: 2
- Layout.preferredHeight: height
- Layout.minimumHeight: height
- Layout.maximumHeight: height
- Layout.fillWidth: true
+ Rectangle {
+ id: stackViewParent
- model: g_mainDisplay.tabModel
+ // This rectangle is used to display the effect in
+ // the area of miniplayer background.
+ // We can not directly apply the effect on the
+ // view because its size is limited and the effect
+ // should exceed the size. Also, it is beneficial
+ // to have a rectangle here because if the background
+ // is transparent we would lose subpixel font rendering
+ // support.
- plListView: playlist
+ anchors.fill: parent
- onItemClicked: {
- if (selectedIndex === index)
- return
+ implicitWidth: stackView.implicitWidth
+ implicitHeight: stackView.implicitHeight
- const name = g_mainDisplay.tabModel.get(index).name
- selectedIndex = index
- if (_oldViewProperties[name] === undefined)
- History.push(["mc", name])
- else
- History.push(["mc", name], _oldViewProperties[name])
- }
+ color: theme.bg.primary
- Navigation.parentItem: medialibId
- Navigation.downItem: stackView
- }
+ layer.enabled: (((GraphicsInfo.shaderType === GraphicsInfo.GLSL)) &&
+ ((GraphicsInfo.shaderSourceType & GraphicsInfo.ShaderSourceString))) &&
+ (miniPlayer.visible || (loaderProgress.active && loaderProgress.item.visible))
- Item {
- Layout.fillWidth: true
- Layout.fillHeight: true
- z: 0
+ layer.effect: Widgets.FrostedGlassEffect {
+ ColorContext {
+ id: frostedTheme
+ palette: VLCStyle.palette
+ colorSet: ColorContext.Window
+ }
- Widgets.PageLoader {
- id: stackView
+ tint: frostedTheme.bg.secondary
- focus: true
+ effectRect: Qt.rect(0,
+ stackView.height,
+ width,
+ height - stackView.height)
+ }
- anchors {
- top: parent.top
- left: parent.left
- bottom: parent.bottom
+ Widgets.PageLoader {
+ id: stackView
- bottomMargin: g_mainDisplay.displayMargin
+ focus: true
- right: (playlistColumn.visible && !VLCStyle.isScreenSmall)
- ? playlistColumn.left
- : parent.right
- }
+ anchors.fill: parent
+ anchors.rightMargin: (playlistColumn.visible && !VLCStyle.isScreenSmall)
+ ? playlistColumn.width
+ : 0
+ anchors.bottomMargin: g_mainDisplay.displayMargin
- pageModel: g_mainDisplay.pageModel
+ pageModel: g_mainDisplay.pageModel
- leftPadding: VLCStyle.applicationHorizontalMargin
+ leftPadding: VLCStyle.applicationHorizontalMargin
- rightPadding: (MainCtx.playlistDocked && MainCtx.playlistVisible)
- ? 0
- : VLCStyle.applicationHorizontalMargin
+ rightPadding: (MainCtx.playlistDocked && MainCtx.playlistVisible)
+ ? 0
+ : VLCStyle.applicationHorizontalMargin
- Navigation.parentItem: medialibId
- Navigation.upItem: sourcesBanner
- Navigation.rightItem: playlistColumn
- Navigation.downItem: miniPlayer.visible ? miniPlayer : null
- }
+ Navigation.parentItem: mainColumn
+ Navigation.upItem: sourcesBanner
+ Navigation.rightItem: playlistColumn
+ Navigation.downItem: miniPlayer.visible ? miniPlayer : null
+ }
+
+ Rectangle {
+ // overlay for smallscreens
- Rectangle {
- // overlay for smallscreens
+ anchors.fill: parent
+ visible: VLCStyle.isScreenSmall && MainCtx.playlistVisible && MainCtx.playlistDocked
+ color: "black"
+ opacity: 0.4
+ MouseArea {
anchors.fill: parent
- visible: VLCStyle.isScreenSmall && MainCtx.playlistVisible && MainCtx.playlistDocked
- color: "black"
- opacity: 0.4
-
- MouseArea {
- anchors.fill: parent
- hoverEnabled: true
- onClicked: {
- MainCtx.playlistVisible = false
- }
+ hoverEnabled: true
+ onClicked: {
+ MainCtx.playlistVisible = false
+ }
- // Capture WheelEvents before they reach stackView
- onWheel: {
- wheel.accepted = true
- }
+ // Capture WheelEvents before they reach stackView
+ onWheel: {
+ wheel.accepted = true
}
}
+ }
+ }
- FocusScope {
- id: playlistColumn
- anchors {
- top: parent.top
- right: parent.right
- }
- focus: false
-
- implicitWidth: VLCStyle.isScreenSmall
- ? g_mainDisplay.width * 0.8
- : Helpers.clamp(g_mainDisplay.width / resizeHandle.widthFactor,
- playlist.minimumWidth,
- g_mainDisplay.width / 2)
- width: 0
- height: parent.height - g_mainDisplay.displayMargin
-
- visible: false
-
- state: (MainCtx.playlistDocked && MainCtx.playlistVisible) ? "expanded" : ""
-
- states: State {
- name: "expanded"
- PropertyChanges {
- target: playlistColumn
- width: Math.round(playlistColumn.implicitWidth)
- visible: true
- }
- }
+ FocusScope {
+ id: playlistColumn
+ anchors {
+ top: parent.top
+ right: parent.right
+ }
+ focus: false
+
+ implicitWidth: VLCStyle.isScreenSmall
+ ? g_mainDisplay.width * 0.8
+ : Helpers.clamp(g_mainDisplay.width / resizeHandle.widthFactor,
+ playlist.minimumWidth,
+ g_mainDisplay.width / 2)
+ width: 0
+ height: parent.height - g_mainDisplay.displayMargin
+
+ visible: false
+
+ state: (MainCtx.playlistDocked && MainCtx.playlistVisible) ? "expanded" : ""
+
+ states: State {
+ name: "expanded"
+ PropertyChanges {
+ target: playlistColumn
+ width: Math.round(playlistColumn.implicitWidth)
+ visible: true
+ }
+ }
- transitions: Transition {
- from: ""; to: "expanded";
- reversible: true
+ transitions: Transition {
+ from: ""; to: "expanded";
+ reversible: true
- SequentialAnimation {
- PropertyAction { property: "visible" }
+ SequentialAnimation {
+ PropertyAction { property: "visible" }
- NumberAnimation {
- property: "width"
- duration: VLCStyle.duration_short
- easing.type: Easing.InOutSine
- }
- }
+ NumberAnimation {
+ property: "width"
+ duration: VLCStyle.duration_short
+ easing.type: Easing.InOutSine
}
+ }
+ }
- Rectangle {
- id: playlistLeftBorder
+ Rectangle {
+ id: playlistLeftBorder
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
- width: VLCStyle.border
- color: theme.separator
- }
+ width: VLCStyle.border
+ color: theme.separator
+ }
- PL.PlaylistListView {
- id: playlist
+ PL.PlaylistListView {
+ id: playlist
- anchors {
- top: parent.top
- bottom: parent.bottom
- left: playlistLeftBorder.right
- right: parent.right
- }
+ anchors {
+ top: parent.top
+ bottom: parent.bottom
+ left: playlistLeftBorder.right
+ right: parent.right
+ }
- focus: true
+ focus: true
- rightPadding: VLCStyle.applicationHorizontalMargin
+ rightPadding: VLCStyle.applicationHorizontalMargin
- bottomPadding: topPadding + Math.max(VLCStyle.applicationVerticalMargin
- - g_mainDisplay.displayMargin, 0)
+ bottomPadding: topPadding + Math.max(VLCStyle.applicationVerticalMargin
+ - g_mainDisplay.displayMargin, 0)
- Navigation.parentItem: medialibId
- Navigation.upItem: sourcesBanner
- Navigation.downItem: miniPlayer.visible ? miniPlayer : null
+ Navigation.parentItem: mainColumn
+ Navigation.upItem: sourcesBanner
+ Navigation.downItem: miniPlayer.visible ? miniPlayer : null
- Navigation.leftAction: function() {
- stackView.currentItem.setCurrentItemFocus(Qt.TabFocusReason);
- }
+ Navigation.leftAction: function() {
+ stackView.currentItem.setCurrentItemFocus(Qt.TabFocusReason);
+ }
- Navigation.cancelAction: function() {
- MainCtx.playlistVisible = false
- stackView.forceActiveFocus()
- }
+ Navigation.cancelAction: function() {
+ MainCtx.playlistVisible = false
+ stackView.forceActiveFocus()
+ }
- Widgets.HorizontalResizeHandle {
- id: resizeHandle
+ Widgets.HorizontalResizeHandle {
+ id: resizeHandle
- property bool _inhibitMainInterfaceUpdate: false
+ property bool _inhibitMainInterfaceUpdate: false
- parent: playlist
+ parent: playlist
- anchors {
- top: parent.top
- bottom: parent.bottom
- left: parent.left
- }
+ anchors {
+ top: parent.top
+ bottom: parent.bottom
+ left: parent.left
+ }
- atRight: false
- targetWidth: playlistColumn.width
- sourceWidth: g_mainDisplay.width
+ atRight: false
+ targetWidth: playlistColumn.width
+ sourceWidth: g_mainDisplay.width
- onWidthFactorChanged: {
- if (!_inhibitMainInterfaceUpdate)
- MainCtx.setPlaylistWidthFactor(widthFactor)
- }
+ onWidthFactorChanged: {
+ if (!_inhibitMainInterfaceUpdate)
+ MainCtx.setPlaylistWidthFactor(widthFactor)
+ }
- Component.onCompleted: _updateFromMainInterface()
+ Component.onCompleted: _updateFromMainInterface()
- function _updateFromMainInterface() {
- if (widthFactor == MainCtx.playlistWidthFactor)
- return
+ function _updateFromMainInterface() {
+ if (widthFactor == MainCtx.playlistWidthFactor)
+ return
- _inhibitMainInterfaceUpdate = true
- widthFactor = MainCtx.playlistWidthFactor
- _inhibitMainInterfaceUpdate = false
- }
+ _inhibitMainInterfaceUpdate = true
+ widthFactor = MainCtx.playlistWidthFactor
+ _inhibitMainInterfaceUpdate = false
+ }
- Connections {
- target: MainCtx
+ Connections {
+ target: MainCtx
- onPlaylistWidthFactorChanged: {
- resizeHandle._updateFromMainInterface()
- }
- }
+ onPlaylistWidthFactorChanged: {
+ resizeHandle._updateFromMainInterface()
}
}
}
}
}
}
+ }
- Loader {
- id: loaderProgress
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: miniPlayer.top
+ Loader {
+ id: loaderProgress
- active: (MainCtx.mediaLibraryAvailable && MainCtx.mediaLibrary.idle === false)
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: miniPlayer.top
- height: active ? implicitHeight : 0
+ active: (MainCtx.mediaLibraryAvailable && MainCtx.mediaLibrary.idle === false)
- source: "qrc:///widgets/ScanProgressBar.qml"
+ height: active ? implicitHeight : 0
- onLoaded: {
- item.background.visible = Qt.binding(function() { return !parentRectangle.layer.enabled })
+ source: "qrc:///widgets/ScanProgressBar.qml"
- item.leftPadding = Qt.binding(function() { return VLCStyle.margin_large + VLCStyle.applicationHorizontalMargin })
- item.rightPadding = Qt.binding(function() { return VLCStyle.margin_large + VLCStyle.applicationHorizontalMargin })
- item.bottomPadding = Qt.binding(function() { return VLCStyle.margin_small + (miniPlayer.visible ? 0 : VLCStyle.applicationVerticalMargin) })
- }
+ onLoaded: {
+ item.background.visible = Qt.binding(function() { return !stackViewParent.layer.enabled })
+
+ item.leftPadding = Qt.binding(function() { return VLCStyle.margin_large + VLCStyle.applicationHorizontalMargin })
+ item.rightPadding = Qt.binding(function() { return VLCStyle.margin_large + VLCStyle.applicationHorizontalMargin })
+ item.bottomPadding = Qt.binding(function() { return VLCStyle.margin_small + (miniPlayer.visible ? 0 : VLCStyle.applicationVerticalMargin) })
}
+ }
- P.PIPPlayer {
- id: playerPip
- anchors {
- bottom: miniPlayer.top
- left: parent.left
- bottomMargin: VLCStyle.margin_normal
- leftMargin: VLCStyle.margin_normal + VLCStyle.applicationHorizontalMargin
- }
+ P.PIPPlayer {
+ id: playerPip
+ anchors {
+ bottom: miniPlayer.top
+ left: parent.left
+ bottomMargin: VLCStyle.margin_normal
+ leftMargin: VLCStyle.margin_normal + VLCStyle.applicationHorizontalMargin
+ }
- width: VLCStyle.dp(320, VLCStyle.scale)
- height: VLCStyle.dp(180, VLCStyle.scale)
- z: 2
- visible: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo
- enabled: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo
-
- dragXMin: 0
- dragXMax: g_mainDisplay.width - playerPip.width
- dragYMin: sourcesBanner.y + sourcesBanner.height
- dragYMax: miniPlayer.y - playerPip.height
-
- //keep the player visible on resize
- Connections {
- target: g_mainDisplay
- onWidthChanged: {
- if (playerPip.x > playerPip.dragXMax)
- playerPip.x = playerPip.dragXMax
- }
- onHeightChanged: {
- if (playerPip.y > playerPip.dragYMax)
- playerPip.y = playerPip.dragYMax
- }
+ width: VLCStyle.dp(320, VLCStyle.scale)
+ height: VLCStyle.dp(180, VLCStyle.scale)
+ z: 2
+ visible: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo
+ enabled: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo
+
+ dragXMin: 0
+ dragXMax: g_mainDisplay.width - playerPip.width
+ dragYMin: sourcesBanner.y + sourcesBanner.height
+ dragYMax: miniPlayer.y - playerPip.height
+
+ //keep the player visible on resize
+ Connections {
+ target: g_mainDisplay
+ onWidthChanged: {
+ if (playerPip.x > playerPip.dragXMax)
+ playerPip.x = playerPip.dragXMax
+ }
+ onHeightChanged: {
+ if (playerPip.y > playerPip.dragYMax)
+ playerPip.y = playerPip.dragYMax
}
}
+ }
- DG.Dialogs {
- z: 10
- bgContent: g_mainDisplay
+ DG.Dialogs {
+ z: 10
+ bgContent: g_mainDisplay
- anchors {
- bottom: miniPlayer.visible ? miniPlayer.top : parent.bottom
- left: parent.left
- right: parent.right
- }
+ anchors {
+ bottom: miniPlayer.visible ? miniPlayer.top : parent.bottom
+ left: parent.left
+ right: parent.right
}
+ }
- P.MiniPlayer {
- id: miniPlayer
+ P.MiniPlayer {
+ id: miniPlayer
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
- z: 3
+ z: 3
- horizontalPadding: VLCStyle.applicationHorizontalMargin
- bottomPadding: VLCStyle.applicationVerticalMargin + VLCStyle.margin_xsmall
+ horizontalPadding: VLCStyle.applicationHorizontalMargin
+ bottomPadding: VLCStyle.applicationVerticalMargin + VLCStyle.margin_xsmall
- background.visible: !parentRectangle.layer.enabled
+ background.visible: !stackViewParent.layer.enabled
- Navigation.parentItem: medialibId
- Navigation.upItem: stackView
- Navigation.cancelItem:sourcesBanner
- onVisibleChanged: {
- if (!visible && miniPlayer.activeFocus)
- stackView.forceActiveFocus()
- }
+ Navigation.parentItem: mainColumn
+ Navigation.upItem: stackView
+ Navigation.cancelItem:sourcesBanner
+ onVisibleChanged: {
+ if (!visible && miniPlayer.activeFocus)
+ stackView.forceActiveFocus()
}
+ }
- Connections {
- target: Player
- onHasVideoOutputChanged: {
- if (Player.hasVideoOutput && MainCtx.hasEmbededVideo) {
- if (!History.match(History.viewPath, ["player"]))
- History.push(["player"])
- } else {
- _showMiniPlayer = false;
- }
+ Connections {
+ target: Player
+ onHasVideoOutputChanged: {
+ if (Player.hasVideoOutput && MainCtx.hasEmbededVideo) {
+ if (!History.match(History.viewPath, ["player"]))
+ History.push(["player"])
+ } else {
+ _showMiniPlayer = false;
}
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a92d924e42648adb787bf6c75d3323a83d113472...d42ac8aee69b9fa0acd4645fdadd267fe5f4b192
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a92d924e42648adb787bf6c75d3323a83d113472...d42ac8aee69b9fa0acd4645fdadd267fe5f4b192
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list