[vlc-devel] [PATCH 7/8] qml: defer loading play cover of Media cover until required
Prince Gupta
guptaprince8832 at gmail.com
Wed Apr 21 10:12:03 UTC 2021
---
.../gui/qt/medialibrary/qml/AudioGridItem.qml | 2 +-
.../gui/qt/medialibrary/qml/MusicArtist.qml | 2 +-
.../medialibrary/qml/MusicArtistsDisplay.qml | 2 +-
.../gui/qt/medialibrary/qml/MusicGenres.qml | 2 +-
.../qt/medialibrary/qml/PlaylistMediaList.qml | 2 +-
.../gui/qt/medialibrary/qml/VideoGridItem.qml | 2 +-
.../gui/qt/network/qml/NetworkGridItem.qml | 2 +-
.../qt/network/qml/ServicesHomeDisplay.qml | 2 +-
modules/gui/qt/style/VLCStyle.qml | 1 +
modules/gui/qt/widgets/qml/GridItem.qml | 2 +-
modules/gui/qt/widgets/qml/MediaCover.qml | 31 +++++++++++++------
11 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/modules/gui/qt/medialibrary/qml/AudioGridItem.qml b/modules/gui/qt/medialibrary/qml/AudioGridItem.qml
index 7d6c88727e..2349acf293 100644
--- a/modules/gui/qt/medialibrary/qml/AudioGridItem.qml
+++ b/modules/gui/qt/medialibrary/qml/AudioGridItem.qml
@@ -31,7 +31,7 @@ Widgets.GridItem {
subtitle: model.main_artist || i18n.qtr("Unknown artist")
pictureWidth: VLCStyle.gridCover_music_width
pictureHeight: VLCStyle.gridCover_music_height
- playCoverBorder.width: VLCStyle.gridCover_music_border
+ playCoverBorderWidth: VLCStyle.gridCover_music_border
onPlayClicked: {
if ( model.id !== undefined ) {
medialib.addAndPlay( model.id )
diff --git a/modules/gui/qt/medialibrary/qml/MusicArtist.qml b/modules/gui/qt/medialibrary/qml/MusicArtist.qml
index e168c4f59c..5585ca0bee 100644
--- a/modules/gui/qt/medialibrary/qml/MusicArtist.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicArtist.qml
@@ -116,7 +116,7 @@ Widgets.NavigableFocusScope {
y: selectedBorderWidth
pictureWidth: VLCStyle.gridCover_music_width
pictureHeight: VLCStyle.gridCover_music_height
- playCoverBorder.width: VLCStyle.gridCover_music_border
+ playCoverBorderWidth: VLCStyle.gridCover_music_border
dragItem: albumDragItem
unselectedUnderlay: shadows.unselected
selectedUnderlay: shadows.selected
diff --git a/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml b/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
index 861073172c..51aff7d49b 100644
--- a/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
@@ -177,7 +177,7 @@ Widgets.PageLoader {
pictureRadius: VLCStyle.artistGridCover_radius
pictureHeight: VLCStyle.artistGridCover_radius
pictureWidth: VLCStyle.artistGridCover_radius
- playCoverBorder.width: VLCStyle.dp(3, VLCStyle.scale)
+ playCoverBorderWidth: VLCStyle.dp(3, VLCStyle.scale)
titleMargin: VLCStyle.margin_xlarge
playIconSize: VLCStyle.play_cover_small
textHorizontalAlignment: Text.AlignHCenter
diff --git a/modules/gui/qt/medialibrary/qml/MusicGenres.qml b/modules/gui/qt/medialibrary/qml/MusicGenres.qml
index feea9d369d..16072bcd82 100644
--- a/modules/gui/qt/medialibrary/qml/MusicGenres.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicGenres.qml
@@ -168,7 +168,7 @@ Widgets.NavigableFocusScope {
pictureWidth: width
pictureHeight: height
image: model.cover || VLCStyle.noArtAlbum
- playCoverBorder.width: VLCStyle.dp(3, VLCStyle.scale)
+ playCoverBorderWidth: VLCStyle.dp(3, VLCStyle.scale)
dragItem: genreDragItem
unselectedUnderlay: shadows.unselected
selectedUnderlay: shadows.selected
diff --git a/modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml b/modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
index 2862818e92..37df7c9103 100644
--- a/modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
+++ b/modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
@@ -309,7 +309,7 @@ Widgets.NavigableFocusScope {
}
}
- playCoverBorder.width: VLCStyle.dp(3, VLCStyle.scale)
+ playCoverBorderWidth: VLCStyle.dp(3, VLCStyle.scale)
//---------------------------------------------------------------------------------
// Events
diff --git a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
index 2bb8f5372b..2abbda8878 100644
--- a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
@@ -39,7 +39,7 @@ Widgets.GridItem {
subtitle: Helpers.msToString(model.duration) || ""
pictureWidth: VLCStyle.gridCover_video_width
pictureHeight: VLCStyle.gridCover_video_height
- playCoverBorder.width: VLCStyle.gridCover_video_border
+ playCoverBorderWidth: VLCStyle.gridCover_video_border
titleMargin: VLCStyle.margin_xxsmall
pictureOverlay: Item {
diff --git a/modules/gui/qt/network/qml/NetworkGridItem.qml b/modules/gui/qt/network/qml/NetworkGridItem.qml
index 398b9a0890..670768669b 100644
--- a/modules/gui/qt/network/qml/NetworkGridItem.qml
+++ b/modules/gui/qt/network/qml/NetworkGridItem.qml
@@ -33,7 +33,7 @@ Widgets.GridItem {
pictureWidth: VLCStyle.gridCover_network_width
pictureHeight: VLCStyle.gridCover_network_height
- playCoverBorder.width: VLCStyle.gridCover_network_border
+ playCoverBorderWidth: VLCStyle.gridCover_network_border
playCoverOnlyBorders: model.type === NetworkMediaModel.TYPE_NODE || model.type === NetworkMediaModel.TYPE_DIRECTORY
image: model.artwork && model.artwork.toString() !== "" ? model.artwork : ""
diff --git a/modules/gui/qt/network/qml/ServicesHomeDisplay.qml b/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
index 638a9c3b14..9c27fe4adc 100644
--- a/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
+++ b/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
@@ -302,7 +302,7 @@ Widgets.PageLoader {
pictureWidth: VLCStyle.colWidth(1)
pictureHeight: VLCStyle.gridCover_network_height
height: VLCStyle.gridCover_network_height + VLCStyle.margin_xsmall + VLCStyle.fontHeight_normal
- playCoverBorder.width: VLCStyle.gridCover_network_border
+ playCoverBorderWidth: VLCStyle.gridCover_network_border
playCoverOnlyBorders: true
pictureOverlay: overlay
unselectedUnderlay: shadows.unselected
diff --git a/modules/gui/qt/style/VLCStyle.qml b/modules/gui/qt/style/VLCStyle.qml
index 400772dfc4..504469b22a 100644
--- a/modules/gui/qt/style/VLCStyle.qml
+++ b/modules/gui/qt/style/VLCStyle.qml
@@ -95,6 +95,7 @@ Item {
property int icon_checkedDelegate: dp(40, scale)
property int play_cover_small: dp(24, scale)
+ property int play_cover_normal: dp(48, scale)
property int cover_xxsmall: dp(32, scale);
property int cover_xsmall: dp(64, scale);
diff --git a/modules/gui/qt/widgets/qml/GridItem.qml b/modules/gui/qt/widgets/qml/GridItem.qml
index d3cf0028d2..ec8d3972d8 100644
--- a/modules/gui/qt/widgets/qml/GridItem.qml
+++ b/modules/gui/qt/widgets/qml/GridItem.qml
@@ -32,7 +32,7 @@ FocusScope {
property alias title: titleLabel.text
property alias subtitle: subtitleTxt.text
property alias textHorizontalAlignment: subtitleTxt.horizontalAlignment
- property alias playCoverBorder: picture.playCoverBorder
+ property alias playCoverBorderWidth: picture.playCoverBorderWidth
property alias playCoverOnlyBorders: picture.playCoverOnlyBorders
property alias playIconSize: picture.playIconSize
property alias pictureRadius: picture.radius
diff --git a/modules/gui/qt/widgets/qml/MediaCover.qml b/modules/gui/qt/widgets/qml/MediaCover.qml
index 702eebe390..1a9d9517e3 100644
--- a/modules/gui/qt/widgets/qml/MediaCover.qml
+++ b/modules/gui/qt/widgets/qml/MediaCover.qml
@@ -25,11 +25,11 @@ import "qrc:///style/"
Widgets.RoundImage {
id: root
- property alias playCoverOpacity: playCover.opacity
- property alias playCoverVisible: playCover.visible
- property alias playCoverOnlyBorders: playCover.onlyBorders
- property alias playIconSize: playCover.iconSize
- property alias playCoverBorder: playCover.border
+ property alias playCoverOpacity: playCoverLoader.opacity
+ property alias playCoverVisible: playCoverLoader.visible
+ property bool playCoverOnlyBorders: false
+ property real playIconSize: VLCStyle.play_cover_normal
+ property real playCoverBorderWidth: VLCStyle.table_cover_border
property alias imageOverlay: overlay.sourceComponent
signal playIconClicked
@@ -42,13 +42,24 @@ Widgets.RoundImage {
anchors.fill: parent
}
- Widgets.PlayCover {
- id: playCover
+ Loader {
+ id: playCoverLoader
anchors.fill: parent
- iconSize: VLCStyle.play_root_small
- radius: root.radius
+ visible: false
+ active: false
+ sourceComponent: Widgets.PlayCover {
+ onlyBorders: root.playCoverOnlyBorders
+ iconSize: root.playIconSize
+ border.width: root.playCoverBorderWidth
+ radius: root.radius
+
+ onIconClicked: root.playIconClicked()
+ }
- onIconClicked: root.playIconClicked()
+ onVisibleChanged: {
+ if (visible && !active)
+ active = true
+ }
}
}
--
2.27.0
More information about the vlc-devel
mailing list