[vlc-commits] qml: use cached shadows in GridItem
Prince Gupta
git at videolan.org
Fri Apr 16 11:22:40 UTC 2021
vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Mon Apr 12 17:38:20 2021 +0530| [4d6c4a7f60cf77434bef45ddcc358b124683ef1f] | committer: Pierre Lamot
qml: use cached shadows in GridItem
improves creation time of GridItem
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4d6c4a7f60cf77434bef45ddcc358b124683ef1f
---
modules/gui/qt/medialibrary/qml/MusicAlbums.qml | 9 +++++++++
modules/gui/qt/medialibrary/qml/MusicArtist.qml | 18 ++++++++++++++++++
.../gui/qt/medialibrary/qml/MusicArtistsDisplay.qml | 12 ++++++++++++
modules/gui/qt/medialibrary/qml/MusicGenres.qml | 12 +++++++++++-
modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml | 10 ++++++++++
modules/gui/qt/medialibrary/qml/VideoAll.qml | 12 ++++++++++++
.../qt/medialibrary/qml/VideoDisplayRecentVideos.qml | 10 ++++++++++
modules/gui/qt/network/qml/NetworkBrowseDisplay.qml | 9 +++++++++
.../gui/qt/network/qml/NetworkHomeDeviceListView.qml | 9 +++++++++
modules/gui/qt/network/qml/ServicesHomeDisplay.qml | 9 +++++++++
10 files changed, 109 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/medialibrary/qml/MusicAlbums.qml b/modules/gui/qt/medialibrary/qml/MusicAlbums.qml
index 8deb707e65..e20095ece5 100644
--- a/modules/gui/qt/medialibrary/qml/MusicAlbums.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicAlbums.qml
@@ -139,11 +139,20 @@ Widgets.NavigableFocusScope {
delegateModel: selectionModel
model: albumModelId
+ Widgets.GridShadows {
+ id: shadows
+
+ coverWidth: VLCStyle.gridCover_music_width
+ coverHeight: VLCStyle.gridCover_music_height
+ }
+
delegate: AudioGridItem {
id: audioGridItem
opacity: gridView_id.expandIndex !== -1 && gridView_id.expandIndex !== audioGridItem.index ? .7 : 1
dragItem: albumDragItem
+ unselectedUnderlay: shadows.unselected
+ selectedUnderlay: shadows.selected
onItemClicked : gridView_id.leftClickOnItem(modifier, index)
diff --git a/modules/gui/qt/medialibrary/qml/MusicArtist.qml b/modules/gui/qt/medialibrary/qml/MusicArtist.qml
index bd40ed6ec6..e168c4f59c 100644
--- a/modules/gui/qt/medialibrary/qml/MusicArtist.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicArtist.qml
@@ -118,6 +118,8 @@ Widgets.NavigableFocusScope {
pictureHeight: VLCStyle.gridCover_music_height
playCoverBorder.width: VLCStyle.gridCover_music_border
dragItem: albumDragItem
+ unselectedUnderlay: shadows.unselected
+ selectedUnderlay: shadows.selected
onPlayClicked: play()
onItemDoubleClicked: play()
@@ -144,6 +146,13 @@ Widgets.NavigableFocusScope {
onSelectAll: albumSelectionModel.selectAll()
onSelectionUpdated: albumSelectionModel.updateSelection( keyModifiers, oldIndex, newIndex )
onActionAtIndex: medialib.addAndPlay( albumModel.getIdForIndex( index ) )
+
+ Widgets.GridShadows {
+ id: shadows
+
+ coverWidth: VLCStyle.gridCover_music_width
+ coverHeight: VLCStyle.gridCover_music_height
+ }
}
Widgets.SubtitleLabel {
@@ -283,6 +292,8 @@ Widgets.NavigableFocusScope {
opacity: gridView_id.expandIndex !== -1 && gridView_id.expandIndex !== audioGridItem.index ? .7 : 1
dragItem: albumDragItem
+ unselectedUnderlay: shadows.unselected
+ selectedUnderlay: shadows.selected
onItemClicked : gridView_id.leftClickOnItem(modifier, index)
@@ -330,6 +341,13 @@ Widgets.NavigableFocusScope {
target: contextMenu
onShowMediaInformation: gridView_id.switchExpandItem( index )
}
+
+ Widgets.GridShadows {
+ id: shadows
+
+ coverWidth: VLCStyle.gridCover_music_width
+ coverHeight: VLCStyle.gridCover_music_height
+ }
}
}
diff --git a/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml b/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
index 7a1b7c9516..861073172c 100644
--- a/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
@@ -160,6 +160,15 @@ Widgets.PageLoader {
}
}
+ Widgets.GridShadows {
+ id: shadows
+
+ leftPadding: (VLCStyle.colWidth(1) - shadows.coverWidth) / 2 // GridItem's rect is horizontally centered
+ coverWidth: VLCStyle.artistGridCover_radius
+ coverHeight: VLCStyle.artistGridCover_radius
+ coverRadius: VLCStyle.artistGridCover_radius
+ }
+
delegate: AudioGridItem {
id: gridItem
@@ -174,6 +183,9 @@ Widgets.PageLoader {
textHorizontalAlignment: Text.AlignHCenter
width: VLCStyle.colWidth(1)
dragItem: artistsDragItem
+ unselectedUnderlay: shadows.unselected
+ selectedUnderlay: shadows.selected
+
onItemClicked: artistGrid.leftClickOnItem(modifier, index)
diff --git a/modules/gui/qt/medialibrary/qml/MusicGenres.qml b/modules/gui/qt/medialibrary/qml/MusicGenres.qml
index d12230a5c2..feea9d369d 100644
--- a/modules/gui/qt/medialibrary/qml/MusicGenres.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicGenres.qml
@@ -149,7 +149,15 @@ Widgets.NavigableFocusScope {
model: genreModel
topMargin: VLCStyle.margin_large
- delegate: Widgets.GridItem {
+ Widgets.GridShadows {
+ id: shadows
+
+ leftPadding: 0
+ coverWidth: VLCStyle.colWidth(2)
+ coverHeight: shadows.coverWidth / 2
+ }
+
+ delegate: Widgets.GridItem {
id: item
property var model: ({})
@@ -162,6 +170,8 @@ Widgets.NavigableFocusScope {
image: model.cover || VLCStyle.noArtAlbum
playCoverBorder.width: VLCStyle.dp(3, VLCStyle.scale)
dragItem: genreDragItem
+ unselectedUnderlay: shadows.unselected
+ selectedUnderlay: shadows.selected
onItemDoubleClicked: root.showAlbumView(model)
onItemClicked: gridView_id.leftClickOnItem(modifier, item.index)
diff --git a/modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml b/modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
index 089e264f1d..2862818e92 100644
--- a/modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
+++ b/modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
@@ -272,6 +272,9 @@ Widgets.NavigableFocusScope {
dragItem: dragItemPlaylist
+ unselectedUnderlay: shadows.unselected
+ selectedUnderlay: shadows.selected
+
pictureOverlay: Item {
Column {
anchors.centerIn: parent
@@ -323,6 +326,13 @@ Widgets.NavigableFocusScope {
contextMenu.popup(modelSelect.selectedIndexes, globalMousePos);
}
}
+
+ Widgets.GridShadows {
+ id: shadows
+
+ coverWidth: root._width
+ coverHeight: root._height
+ }
}
}
diff --git a/modules/gui/qt/medialibrary/qml/VideoAll.qml b/modules/gui/qt/medialibrary/qml/VideoAll.qml
index 56e7ff9334..4427c0d742 100644
--- a/modules/gui/qt/medialibrary/qml/VideoAll.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoAll.qml
@@ -238,6 +238,16 @@ Widgets.NavigableFocusScope {
onRetract: gridView.retract()
}
+ //---------------------------------------------------------------------------------
+ // Shadows
+
+ Widgets.GridShadows {
+ id: shadows
+
+ coverWidth: VLCStyle.gridCover_video_width
+ coverHeight: VLCStyle.gridCover_video_height
+ }
+
delegate: VideoGridItem {
id: gridItem
@@ -249,6 +259,8 @@ Widgets.NavigableFocusScope {
gridView.expandIndex !== gridItem.index) ? 0.7 : 1
dragItem: root.dragItem
+ unselectedUnderlay: shadows.unselected
+ selectedUnderlay: shadows.selected
//---------------------------------------------------------------------------------
// Events
diff --git a/modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml b/modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
index 4223796189..41d62e4787 100644
--- a/modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
@@ -113,6 +113,9 @@ Widgets.NavigableFocusScope {
playCoverBorder.width: VLCStyle.gridCover_video_border
titleMargin: VLCStyle.margin_xxsmall
showNewIndicator: true
+ unselectedUnderlay: shadows.unselected
+ selectedUnderlay: shadows.selected
+
onItemDoubleClicked: {
if ( model.id !== undefined ) {
g_mainDisplay.showPlayer()
@@ -155,6 +158,13 @@ Widgets.NavigableFocusScope {
g_mainDisplay.showPlayer()
medialib.addAndPlay( model.getIdsForIndexes( recentVideoSelection.selectedIndexes ) )
}
+
+ Widgets.GridShadows {
+ id: shadows
+
+ coverWidth: VLCStyle.gridCover_video_width_large
+ coverHeight: VLCStyle.gridCover_video_height_large
+ }
}
}
}
diff --git a/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml b/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
index db9d413946..bf053b6682 100644
--- a/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
+++ b/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
@@ -190,6 +190,8 @@ Widgets.NavigableFocusScope {
subtitle: ""
height: VLCStyle.gridCover_network_height + VLCStyle.margin_xsmall + VLCStyle.fontHeight_normal
dragItem: networkDragItem
+ unselectedUnderlay: shadows.unselected
+ selectedUnderlay: shadows.selected
onPlayClicked: playAt(index)
onItemClicked : gridView.leftClickOnItem(modifier, index)
@@ -216,6 +218,13 @@ Widgets.NavigableFocusScope {
navigationCancel: function() {
history.previous()
}
+
+ Widgets.GridShadows {
+ id: shadows
+
+ coverWidth: VLCStyle.gridCover_network_width
+ coverHeight: VLCStyle.gridCover_network_height
+ }
}
}
diff --git a/modules/gui/qt/network/qml/NetworkHomeDeviceListView.qml b/modules/gui/qt/network/qml/NetworkHomeDeviceListView.qml
index 5063963975..f0782c4d99 100644
--- a/modules/gui/qt/network/qml/NetworkHomeDeviceListView.qml
+++ b/modules/gui/qt/network/qml/NetworkHomeDeviceListView.qml
@@ -66,6 +66,13 @@ Widgets.NavigableFocusScope {
model: deviceModel
}
+ Widgets.GridShadows {
+ id: shadows
+
+ coverWidth: VLCStyle.gridCover_network_width
+ coverHeight: VLCStyle.gridCover_network_height
+ }
+
Widgets.KeyNavigableListView {
id: deviceListView
@@ -87,6 +94,8 @@ Widgets.NavigableFocusScope {
focus: true
x: selectedBorderWidth
y: selectedBorderWidth
+ unselectedUnderlay: shadows.unselected
+ selectedUnderlay: shadows.selected
onItemClicked : {
deviceSelection.updateSelection( modifier , deviceSelection.currentIndex, index)
diff --git a/modules/gui/qt/network/qml/ServicesHomeDisplay.qml b/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
index 461c50c519..638a9c3b14 100644
--- a/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
+++ b/modules/gui/qt/network/qml/ServicesHomeDisplay.qml
@@ -305,6 +305,8 @@ Widgets.PageLoader {
playCoverBorder.width: VLCStyle.gridCover_network_border
playCoverOnlyBorders: true
pictureOverlay: overlay
+ unselectedUnderlay: shadows.unselected
+ selectedUnderlay: shadows.selected
onItemDoubleClicked: {
if (is_dummy)
@@ -408,6 +410,13 @@ Widgets.PageLoader {
sourceModel: sourcesModel
searchRole: "name"
}
+
+ Widgets.GridShadows {
+ id: shadows
+
+ coverWidth: VLCStyle.gridCover_network_width
+ coverHeight: VLCStyle.gridCover_network_height
+ }
}
}
}
More information about the vlc-commits
mailing list