Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
287171a8 by Fatih Uzunoglu at 2026-01-29T11:37:34+00:00
qml: use `MediaCover` instead of `NetworkCustomCover` in `NetworkThumbnailItem`
`MediaCover` has been supporting various fill modes for a while, including
preserve aspect fit that is wanted here, and as the comment says we can now
use it instead of using a custom item.
If is rhi used, we are not doing background coloring through the image
provider, since it can be done must more efficiently through `ImageExt`
thanks to its fragment shader that has the capability.
- - - - -
30e3b95f by Fatih Uzunoglu at 2026-01-29T11:37:34+00:00
qml: get rid of obsolete `NetworkCustomCover.qml`
- - - - -
4 changed files:
- modules/gui/qt/Makefile.am
- modules/gui/qt/meson.build
- − modules/gui/qt/network/qml/NetworkCustomCover.qml
- modules/gui/qt/network/qml/NetworkThumbnailItem.qml
Changes:
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -1071,7 +1071,6 @@ libqml_module_network_a_QML = \
network/qml/DiscoverDisplay.qml \
network/qml/DiscoverUrlDisplay.qml \
network/qml/NetworkAddressbar.qml \
- network/qml/NetworkCustomCover.qml \
network/qml/NetworkGridItem.qml \
network/qml/NetworkThumbnailItem.qml \
network/qml/ServicesHomeDisplay.qml \
=====================================
modules/gui/qt/meson.build
=====================================
@@ -668,7 +668,6 @@ qml_modules += {
'network/qml/DiscoverDisplay.qml',
'network/qml/DiscoverUrlDisplay.qml',
'network/qml/NetworkAddressbar.qml',
- 'network/qml/NetworkCustomCover.qml',
'network/qml/NetworkGridItem.qml',
'network/qml/NetworkThumbnailItem.qml',
'network/qml/ServicesHomeDisplay.qml',
=====================================
modules/gui/qt/network/qml/NetworkCustomCover.qml deleted
=====================================
@@ -1,97 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2020 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
-import QtQuick.Controls
-
-
-import VLC.Widgets as Widgets
-import VLC.Style
-import VLC.Network
-import VLC.Util
-
-Item {
- id: root
-
- property var networkModel
- property color bgColor
- property color color1
- property color accent
-
-
- // Image properties
- property int fillMode: Image.Stretch
- property int horizontalAlignment: Image.AlignHCenter
- property int verticalAlignment: Image.AlignVCenter
-
- readonly property var paintedWidth: _image.paintedWidth
- readonly property var paintedHeight: _image.paintedHeight
-
- // currently shown image
- property var _image: typeImage.visible ? typeImage : artwork
-
- Widgets.ScaledImage {
- // failsafe cover, we show this while loading artwork or if loading
fails
-
- id: typeImage
-
- anchors.fill: parent
-
- visible: !artwork.visible
-
- sourceSize: Qt.size(0, height) // preserve aspect ratio
-
- fillMode: root.fillMode
- horizontalAlignment: root.horizontalAlignment
- verticalAlignment: root.verticalAlignment
-
- source: {
- if (!networkModel || !visible)
- return ""
-
- const img = SVGColorImage.colorize(networkModel.artworkFallback)
- .color1(root.color1)
- .accent(root.accent)
-
- if (bgColor !== undefined)
- img.background(root.bgColor)
-
- return img.uri()
- }
- }
-
- Widgets.ScaledImage {
- id: artwork
-
- anchors.fill: parent
-
- visible: status === Image.Ready
-
- sourceSize: Qt.size(width, height)
-
- fillMode: root.fillMode
- horizontalAlignment: root.horizontalAlignment
- verticalAlignment: root.verticalAlignment
-
- source: {
- if (networkModel?.artwork && networkModel.artwork.length > 0)
- return VLCAccessImage.uri(networkModel.artwork)
-
- return ""
- }
- }
-}
=====================================
modules/gui/qt/network/qml/NetworkThumbnailItem.qml
=====================================
@@ -35,8 +35,6 @@ Widgets.TableRowDelegate {
&& (rowModel.type !==
NetworkMediaModel.TYPE_NODE)
&& (rowModel.type !==
NetworkMediaModel.TYPE_DIRECTORY)
- readonly property bool _showCustomCover: (!artworkSource) ||
(artwork.status !== Image.Ready)
-
signal playClicked(int index)
// Functions
@@ -72,48 +70,51 @@ Widgets.TableRowDelegate {
anchors.fill: parent
spacing: VLCStyle.margin_normal
- Item {
- id: itemCover
+ Widgets.MediaCover {
+ id: cover
anchors.verticalCenter: parent.verticalCenter
- width: artwork.width
- height: artwork.height
+ width: VLCStyle.listAlbumCover_width
+ height: VLCStyle.listAlbumCover_height
+
+ pictureWidth: 0 // preserve aspect ratio
+ pictureHeight: height
- //FIXME: implement fillMode in RoundImage and use MediaCover here
instead
- //or directly TableCollumns.titleHeaderDelegate in place of
NetworkThumbnailItem
- NetworkCustomCover {
- id: artwork
+ fillMode: Image.PreserveAspectFit
- width: VLCStyle.listAlbumCover_width
- height: VLCStyle.listAlbumCover_height
+ source: {
+ if (root.rowModel?.artwork && root.rowModel.artwork.length > 0)
+ return VLCAccessImage.uri(root.rowModel.artwork)
- // artworks can have anysize, we try to fit it using
PreserveAspectFit
- // in the provided size and place it in the center of itemCover
- fillMode: Image.PreserveAspectFit
- horizontalAlignment: Image.AlignHCenter
- verticalAlignment: Image.AlignVCenter
+ return ""
+ }
- networkModel: root.rowModel
+ fallbackImageSource: {
+ if (!root.rowModel)
+ return ""
- bgColor: root.colorContext.bg.secondary
- color1: root.colorContext.fg.primary
- accent: root.colorContext.accent
+ let img = SVGColorImage.colorize(root.rowModel.artworkFallback)
+ .color1(root.colorContext.fg.primary)
+ .accent(root.colorContext.accent)
- Widgets.DefaultShadow {
+ if (GraphicsInfo.shaderType !== GraphicsInfo.RhiShader)
+ img = img.background(cover.color)
- }
+ return img.uri()
+ }
+
+ color: root.colorContext.bg.secondary
- Widgets.PlayCover {
- x: Math.round((artwork.width - width) / 2)
- y: Math.round((artwork.height - height) / 2)
+ playCoverVisible: root._showPlayCover
+ playIconSize: VLCStyle.play_cover_small
- width: VLCStyle.play_cover_small
+ onPlayIconClicked: () => {
+ root.playClicked(root.index)
+ }
- visible: root._showPlayCover
+ Widgets.DefaultShadow {
- onTapped: playClicked(root.index)
- }
}
}
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/d608dd33120815d0b66ec03c20362ab82a238fc0...30e3b95f487f6e348e7aaee18fc502e9f217a0c7
--
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/d608dd33120815d0b66ec03c20362ab82a238fc0...30e3b95f487f6e348e7aaee18fc502e9f217a0c7
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits