[vlc-commits] [Git][videolan/vlc][master] 15 commits: qt: add static effects image provider
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Fri Jul 1 14:01:16 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
ce9ad6a4 by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qt: add static effects image provider
- - - - -
14165ac2 by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qt: register static effects image provider
- - - - -
e612475d by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: add DropShadowImage.qml
- - - - -
8546e3eb by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: fix layout issue in MusicArtistDelegate
- - - - -
b6a84796 by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: add DoubleShadow.qml
- - - - -
1b105761 by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: don't use GridShadows
- - - - -
18f5174c by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: use DoubleShadow in GridItem and remove obsolete loaders
- - - - -
f146afa3 by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: use DoubleShadow in PlaylistDelegate and remove GLSL effect
- - - - -
60468577 by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: remove GridShadows.qml
- - - - -
b9506ae5 by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: remove ShadowCoverGenerator.qml
- - - - -
163527b4 by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: use DoubleShadow in ListCoverShadow
- - - - -
2815a77c by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: use DoubleShadow in ArtworkInfoWidget
- - - - -
fe684d2b by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: use ScaledImage and disable mipmap in ArtworkInfoWidget
- - - - -
b023a2de by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: disable clipping in ArtworkInfoWidget
clipping is not necessary and was used as workaround
- - - - -
167ea8e1 by Fatih Uzunoglu at 2022-07-01T13:46:11+00:00
qml: use static DropShadow in PlayButton
- - - - -
29 changed files:
- modules/gui/qt/Makefile.am
- modules/gui/qt/maininterface/mainui.cpp
- modules/gui/qt/medialibrary/qml/EmptyLabel.qml
- modules/gui/qt/medialibrary/qml/MusicAlbums.qml
- modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml
- modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
- modules/gui/qt/medialibrary/qml/MusicArtist.qml
- modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
- modules/gui/qt/medialibrary/qml/MusicGenres.qml
- modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
- modules/gui/qt/medialibrary/qml/VideoAll.qml
- modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
- modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
- modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
- modules/gui/qt/network/qml/NetworkHomeDeviceListView.qml
- modules/gui/qt/network/qml/NetworkThumbnailItem.qml
- modules/gui/qt/network/qml/ServicesHomeDisplay.qml
- modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml
- modules/gui/qt/player/qml/controlbarcontrols/PlayButton.qml
- modules/gui/qt/playlist/qml/PlaylistDelegate.qml
- + modules/gui/qt/util/effects_image_provider.cpp
- + modules/gui/qt/util/effects_image_provider.hpp
- modules/gui/qt/vlc.qrc
- modules/gui/qt/widgets/qml/GridShadows.qml → modules/gui/qt/widgets/qml/DoubleShadow.qml
- + modules/gui/qt/widgets/qml/DropShadowImage.qml
- modules/gui/qt/widgets/qml/GridItem.qml
- modules/gui/qt/widgets/qml/ListCoverShadow.qml
- − modules/gui/qt/widgets/qml/ShadowCoverGenerator.qml
- modules/gui/qt/widgets/qml/TableColumns.qml
Changes:
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -281,6 +281,8 @@ libqt_plugin_la_SOURCES = \
gui/qt/util/qmlinputitem.hpp \
gui/qt/util/mouse_event_filter.cpp \
gui/qt/util/mouse_event_filter.hpp \
+ gui/qt/util/effects_image_provider.cpp \
+ gui/qt/util/effects_image_provider.hpp \
gui/qt/widgets/native/animators.cpp \
gui/qt/widgets/native/animators.hpp \
gui/qt/widgets/native/customwidgets.cpp gui/qt/widgets/native/customwidgets.hpp \
@@ -444,6 +446,7 @@ nodist_libqt_plugin_la_SOURCES = \
gui/qt/util/navigation_history.moc.cpp \
gui/qt/util/item_key_event_filter.moc.cpp \
gui/qt/util/mouse_event_filter.moc.cpp \
+ gui/qt/util/effects_image_provider.moc.cpp \
gui/qt/util/flickable_scroll_handler.moc.cpp \
gui/qt/util/qvlcapp.moc.cpp \
gui/qt/util/renderer_manager.moc.cpp \
@@ -911,7 +914,6 @@ libqt_plugin_la_QML = \
gui/qt/widgets/qml/DrawerExt.qml \
gui/qt/widgets/qml/ExpandGridView.qml \
gui/qt/widgets/qml/GridItem.qml \
- gui/qt/widgets/qml/GridShadows.qml \
gui/qt/widgets/qml/HorizontalResizeHandle.qml \
gui/qt/widgets/qml/IconLabel.qml \
gui/qt/widgets/qml/IconButton.qml \
@@ -943,7 +945,6 @@ libqt_plugin_la_QML = \
gui/qt/widgets/qml/ScanProgressBar.qml \
gui/qt/widgets/qml/ScrollingText.qml \
gui/qt/widgets/qml/SearchBox.qml \
- gui/qt/widgets/qml/ShadowCoverGenerator.qml \
gui/qt/widgets/qml/SortControl.qml \
gui/qt/widgets/qml/SpinBoxExt.qml \
gui/qt/widgets/qml/StackViewExt.qml \
@@ -959,7 +960,9 @@ libqt_plugin_la_QML = \
gui/qt/widgets/qml/PointingTooltip.qml \
gui/qt/widgets/qml/FrostedGlassEffect.qml \
gui/qt/widgets/qml/OverlayMenu.qml \
- gui/qt/widgets/qml/ToolTipExt.qml
+ gui/qt/widgets/qml/ToolTipExt.qml \
+ gui/qt/widgets/qml/DropShadowImage.qml \
+ gui/qt/widgets/qml/DoubleShadow.qml
lib_qt_plugin_la_QRC = gui/qt/vlc.qrc
=====================================
modules/gui/qt/maininterface/mainui.cpp
=====================================
@@ -41,6 +41,7 @@
#include "util/qmlinputitem.hpp"
#include "util/mouse_event_filter.hpp"
#include "util/flickable_scroll_handler.hpp"
+#include "util/effects_image_provider.hpp"
#include "dialogs/help/aboutmodel.hpp"
#include "dialogs/dialogs_provider.hpp"
@@ -158,6 +159,8 @@ bool MainUI::setup(QQmlEngine* engine)
engine->addImageProvider(MLCUSTOMCOVER_PROVIDERID, customCover);
}
+
+ SingletonRegisterHelper<EffectsImageProvider>::setInstance(new EffectsImageProvider(engine));
m_component = new QQmlComponent(engine, QStringLiteral("qrc:/main/MainInterface.qml"), QQmlComponent::PreferSynchronous, engine);
if (m_component->isLoading())
@@ -220,6 +223,7 @@ void MainUI::registerQMLTypes()
qmlRegisterSingletonType<SystemPalette>(uri, versionMajor, versionMinor, "SystemPalette", SingletonRegisterHelper<SystemPalette>::callback);
qmlRegisterSingletonType<DialogErrorModel>(uri, versionMajor, versionMinor, "DialogErrorModel", SingletonRegisterHelper<DialogErrorModel>::callback);
qmlRegisterSingletonType<QmlKeyHelper>(uri, versionMajor, versionMinor, "KeyHelper", SingletonRegisterHelper<QmlKeyHelper>::callback);
+ qmlRegisterSingletonType<EffectsImageProvider>(uri, versionMajor, versionMinor, "Effects", SingletonRegisterHelper<EffectsImageProvider>::callback);
qmlRegisterUncreatableType<QAbstractItemModel>(uri, versionMajor, versionMinor, "QtAbstractItemModel", "");
qmlRegisterUncreatableType<QWindow>(uri, versionMajor, versionMinor, "QtWindow", "");
=====================================
modules/gui/qt/medialibrary/qml/EmptyLabel.qml
=====================================
@@ -76,8 +76,6 @@ FocusScope {
Widgets.ListCoverShadow {
anchors.fill: cover
-
- source: cover
}
}
=====================================
modules/gui/qt/medialibrary/qml/MusicAlbums.qml
=====================================
@@ -134,21 +134,11 @@ FocusScope {
selectionDelegateModel: 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)
onItemDoubleClicked: {
=====================================
modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml
=====================================
@@ -128,7 +128,6 @@ FocusScope {
}
Widgets.ListCoverShadow {
- source: expand_cover_id
anchors.fill: parent
}
}
=====================================
modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
=====================================
@@ -126,15 +126,6 @@ FocusScope {
}
}
- 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
@@ -150,9 +141,6 @@ FocusScope {
textAlignHCenter: true
width: VLCStyle.colWidth(1)
dragItem: artistsDragItem
- unselectedUnderlay: shadows.unselected
- selectedUnderlay: shadows.selected
-
onItemClicked: artistGrid.leftClickOnItem(modifier, index)
@@ -162,6 +150,9 @@ FocusScope {
artistGrid.rightClickOnItem(index)
contextMenu.popup(selectionModel.selectedIndexes, globalMousePos)
}
+
+ selectedShadow.anchors.margins: VLCStyle.dp(1) // outside border
+ unselectedShadow.anchors.margins: VLCStyle.dp(1) // outside border
}
}
}
=====================================
modules/gui/qt/medialibrary/qml/MusicArtist.qml
=====================================
@@ -144,8 +144,6 @@ FocusScope {
pictureHeight: VLCStyle.gridCover_music_height
playCoverBorderWidth: VLCStyle.gridCover_music_border
dragItem: albumDragItem
- unselectedUnderlay: shadows.unselected
- selectedUnderlay: shadows.selected
onPlayClicked: play()
onItemDoubleClicked: play()
@@ -172,13 +170,6 @@ FocusScope {
onSelectAll: albumSelectionModel.selectAll()
onActionAtIndex: MediaLib.addAndPlay( albumModel.getIdForIndex( index ) )
-
- Widgets.GridShadows {
- id: shadows
-
- coverWidth: VLCStyle.gridCover_music_width
- coverHeight: VLCStyle.gridCover_music_height
- }
}
Widgets.SubtitleLabel {
@@ -318,8 +309,6 @@ FocusScope {
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)
@@ -380,13 +369,6 @@ FocusScope {
target: contextMenu
onShowMediaInformation: gridView_id.switchExpandItem( index )
}
-
- Widgets.GridShadows {
- id: shadows
-
- coverWidth: VLCStyle.gridCover_music_width
- coverHeight: VLCStyle.gridCover_music_height
- }
}
}
=====================================
modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
=====================================
@@ -132,8 +132,8 @@ T.Control {
spacing: VLCStyle.margin_xsmall
RoundImage {
- width: VLCStyle.play_cover_small
- height: width
+ Layout.preferredWidth: VLCStyle.play_cover_small
+ Layout.preferredHeight: Layout.preferredWidth
radius: width
=====================================
modules/gui/qt/medialibrary/qml/MusicGenres.qml
=====================================
@@ -140,14 +140,6 @@ FocusScope {
model: genreModel
topMargin: VLCStyle.margin_large
- Widgets.GridShadows {
- id: shadows
-
- leftPadding: 0
- coverWidth: VLCStyle.colWidth(2)
- coverHeight: shadows.coverWidth / 2
- }
-
delegate: Widgets.GridItem {
id: item
@@ -161,8 +153,6 @@ FocusScope {
image: model.cover || VLCStyle.noArtAlbumCover
playCoverBorderWidth: VLCStyle.dp(3, VLCStyle.scale)
dragItem: genreDragItem
- unselectedUnderlay: shadows.unselected
- selectedUnderlay: shadows.selected
onItemDoubleClicked: root.showAlbumView(model.id, model.name, Qt.MouseFocusReason)
onItemClicked: gridView_id.leftClickOnItem(modifier, item.index)
=====================================
modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
=====================================
@@ -272,8 +272,6 @@ FocusScope {
dragItem: dragItemPlaylist
- selectedUnderlay : shadows.selected
- unselectedUnderlay: shadows.unselected
//---------------------------------------------------------------------------------
// Events
@@ -314,12 +312,6 @@ FocusScope {
//-------------------------------------------------------------------------------------
// Childs
- Widgets.GridShadows {
- id: shadows
-
- coverWidth : _widthCover
- coverHeight: _heightCover
- }
}
}
=====================================
modules/gui/qt/medialibrary/qml/VideoAll.qml
=====================================
@@ -246,13 +246,6 @@ FocusScope {
// Children
- Widgets.GridShadows {
- id: shadows
-
- coverWidth: VLCStyle.gridCover_video_width
- coverHeight: VLCStyle.gridCover_video_height
- }
-
delegate: VideoGridItem {
id: gridItem
@@ -274,9 +267,6 @@ FocusScope {
dragItem: root.dragItem
- unselectedUnderlay: shadows.unselected
- selectedUnderlay: shadows.selected
-
// Events
onItemClicked: gridView.leftClickOnItem(modifier, index)
=====================================
modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
=====================================
@@ -122,9 +122,6 @@ FocusScope {
focus: true
- unselectedUnderlay: shadows.unselected
- selectedUnderlay: shadows.selected
-
onItemDoubleClicked: gridItem.play()
onItemClicked: {
@@ -172,13 +169,6 @@ FocusScope {
}
onActionAtIndex: root._actionAtIndex(index)
-
- Widgets.GridShadows {
- id: shadows
-
- coverWidth: VLCStyle.gridCover_video_width
- coverHeight: VLCStyle.gridCover_video_height
- }
}
Widgets.SubtitleLabel {
=====================================
modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
=====================================
@@ -109,7 +109,6 @@ FocusScope {
Widgets.ListCoverShadow {
anchors.fill: expand_cover_id
- source: expand_cover_id
}
}
=====================================
modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
=====================================
@@ -203,8 +203,6 @@ FocusScope {
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)
@@ -229,13 +227,6 @@ FocusScope {
Navigation.cancelAction: function() {
History.previous()
}
-
- Widgets.GridShadows {
- id: shadows
-
- coverWidth: VLCStyle.gridCover_network_width
- coverHeight: VLCStyle.gridCover_network_height
- }
}
}
=====================================
modules/gui/qt/network/qml/NetworkHomeDeviceListView.qml
=====================================
@@ -74,13 +74,6 @@ FocusScope {
model: deviceModel
}
- Widgets.GridShadows {
- id: shadows
-
- coverWidth: VLCStyle.gridCover_network_width
- coverHeight: VLCStyle.gridCover_network_height
- }
-
Widgets.KeyNavigableListView {
id: deviceListView
@@ -102,8 +95,6 @@ FocusScope {
focus: true
x: selectedBorderWidth
y: selectedBorderWidth
- unselectedUnderlay: shadows.unselected
- selectedUnderlay: shadows.selected
onItemClicked : {
deviceSelection.updateSelection( modifier , deviceSelection.currentIndex, index)
=====================================
modules/gui/qt/network/qml/NetworkThumbnailItem.qml
=====================================
@@ -48,7 +48,6 @@ Item {
Widgets.ListCoverShadow {
anchors.fill: !item._showCustomCover ? artwork : background
- source: !item._showCustomCover ? artwork : background
}
Rectangle {
=====================================
modules/gui/qt/network/qml/ServicesHomeDisplay.qml
=====================================
@@ -324,8 +324,6 @@ Widgets.PageLoader {
playCoverBorderWidth: VLCStyle.gridCover_network_border
playCoverShowPlay: false
pictureOverlay: overlay
- unselectedUnderlay: shadows.unselected
- selectedUnderlay: shadows.selected
onItemDoubleClicked: {
if (is_dummy)
@@ -437,13 +435,6 @@ Widgets.PageLoader {
sourceModel: sourcesModel
searchRole: "name"
}
-
- Widgets.GridShadows {
- id: shadows
-
- coverWidth: VLCStyle.gridCover_network_width
- coverHeight: VLCStyle.gridCover_network_height
- }
}
}
}
=====================================
modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml
=====================================
@@ -34,7 +34,8 @@ AbstractButton {
property VLCColors colors: VLCStyle.colors
- readonly property real minimumWidth: cover.width + (leftPadding + rightPadding)
+ readonly property real minimumWidth: coverRect.implicitWidth +
+ + (leftPadding + rightPadding)
property bool _keyPressed: false
@@ -75,32 +76,31 @@ AbstractButton {
contentItem: RowLayout {
spacing: infoColumn.visible ? VLCStyle.margin_xsmall : 0
- Item {
- id: coverItem
+ Rectangle {
+ id: coverRect
- implicitHeight: cover.height
- implicitWidth: cover.width
+ implicitHeight: VLCStyle.dp(60, VLCStyle.scale)
+ implicitWidth: implicitHeight
- Rectangle {
- id: coverRect
- anchors.fill: parent
-
- color: colors.bg
- }
+ color: colors.bg
- DropShadow {
+ Widgets.DoubleShadow {
anchors.fill: parent
- source: coverRect
- radius: 8
- samples: 17
- color: VLCStyle.colors.glowColorBanner
- spread: 0.2
+ primaryBlurRadius: VLCStyle.dp(3, VLCStyle.scale)
+ primaryColor: Qt.rgba(0, 0, 0, 0.18)
+ primaryVerticalOffset: VLCStyle.dp(1, VLCStyle.scale)
+
+ secondaryBlurRadius: VLCStyle.dp(14, VLCStyle.scale)
+ secondaryColor: Qt.rgba(0, 0, 0, 0.22)
+ secondaryVerticalOffset: VLCStyle.dp(6, VLCStyle.scale)
}
- Image {
+ Widgets.ScaledImage {
id: cover
+ anchors.fill: parent
+
source: {
if (!paintOnly
&& mainPlaylistController.currentItem.artwork
@@ -112,11 +112,6 @@ AbstractButton {
fillMode: Image.PreserveAspectFit
- width: VLCStyle.dp(60)
- height: VLCStyle.dp(60)
-
- mipmap: true
-
asynchronous: true
ToolTip.visible: infoColumn.width < infoColumn.implicitWidth
@@ -133,10 +128,9 @@ AbstractButton {
ColumnLayout {
id: infoColumn
- Layout.preferredHeight: coverItem.implicitHeight
Layout.fillWidth: true
-
- clip: true
+ Layout.preferredHeight: coverRect.height
+ Layout.minimumWidth: 0.1 // FIXME: Qt layout bug
Widgets.MenuLabel {
id: titleLabel
=====================================
modules/gui/qt/player/qml/controlbarcontrols/PlayButton.qml
=====================================
@@ -134,9 +134,12 @@ T.Control {
PropertyChanges {
target: hoverShadow
+ opacity: 0.0
+ }
- radius: VLCStyle.dp(18, VLCStyle.scale)
- opacity: 1
+ PropertyChanges {
+ target: focusShadow
+ opacity: 1.0
}
},
State {
@@ -145,9 +148,12 @@ T.Control {
PropertyChanges {
target: hoverShadow
+ opacity: 1.0
+ }
- radius: VLCStyle.dp(14, VLCStyle.scale)
- opacity: 0.5
+ PropertyChanges {
+ target: focusShadow
+ opacity: 0.0
}
}
]
@@ -156,7 +162,7 @@ T.Control {
from: ""; to: "*"
reversible: true
NumberAnimation {
- properties: "radius, opacity"
+ properties: "opacity"
easing.type: Easing.InOutSine
duration: VLCStyle.duration_veryShort
}
@@ -176,8 +182,10 @@ T.Control {
return VLCIcons.play
}
- color: cursorInside ? hoverShadow.color :
- (paintOnly || enabled ? colors.buttonPlayIcon
+ color: cursorInside ? VLCStyle.colors.blendColors(VLCStyle.colors.buttonPlayA,
+ VLCStyle.colors.buttonPlayB,
+ 0.5)
+ : (paintOnly || enabled ? colors.buttonPlayIcon
: colors.textInactive)
font.pixelSize: VLCIcons.pixelSize(VLCStyle.icon_normal)
@@ -195,18 +203,45 @@ T.Control {
}
background: Item {
- DropShadow {
+ // TODO: Qt >= 5.15 use inline component for the drop shadows
+ Widgets.DropShadowImage {
id: hoverShadow
- anchors.fill: parent
- visible: radius > 4
+ anchors.centerIn: parent
+
+ z: -1
+ visible: opacity > 0
+ opacity: 0
+
+ blurRadius: VLCStyle.dp(9)
+ yOffset: VLCStyle.dp(4)
+
+ color: Qt.rgba(255 / 255, 97 / 255, 10 / 255, 0.29)
+
+ xRadius: sourceSize.width
+ yRadius: xRadius
+
+ sourceSize: Qt.size(parent.width, parent.height)
+ }
+
+ Widgets.DropShadowImage {
+ id: focusShadow
+
+ anchors.centerIn: parent
+
+ z: -1
+ visible: opacity > 0
+ opacity: 0
+
+ blurRadius: VLCStyle.dp(14)
+ yOffset: VLCStyle.dp(1)
+
+ color: Qt.rgba(255 / 255, 97 / 255, 10 / 255, 1.0)
- radius: 0
- samples: 49 // should be a fixed number
- source: opacityMask
- spread: colors.isThemeDark && playBtn.state === "focused" ? 0.4 : 0.2
+ xRadius: sourceSize.width
+ yRadius: xRadius
- color: "#FF610A"
+ sourceSize: Qt.size(parent.width, parent.height)
}
Rectangle {
=====================================
modules/gui/qt/playlist/qml/PlaylistDelegate.qml
=====================================
@@ -21,8 +21,6 @@ import QtQuick.Controls 2.4
import QtQuick.Templates 2.4 as T
import QtQuick.Layouts 1.11
-import QtGraphicalEffects 1.0
-
import org.videolan.vlc 0.1
import "qrc:///widgets/" as Widgets
@@ -108,18 +106,6 @@ T.Control {
Layout.preferredWidth: VLCStyle.icon_normal
Layout.alignment: Qt.AlignVCenter
- DropShadow {
- id: effect
-
- anchors.fill: artwork
- source: artwork
- radius: 8
- samples: 17
- color: colors.glowColorBanner
- visible: artwork.visible
- spread: 0.1
- }
-
Widgets.ScaledImage {
id: artwork
@@ -128,24 +114,37 @@ T.Control {
source: (model.artwork && model.artwork.toString()) ? model.artwork : VLCStyle.noArtAlbumCover
visible: !statusIcon.visible
asynchronous: true
+
+ Widgets.DoubleShadow {
+ anchors.centerIn: parent
+ width: parent.paintedWidth
+ height: parent.paintedHeight
+
+ z: -1
+
+ primaryBlurRadius: VLCStyle.dp(3)
+ primaryColor: Qt.rgba(0, 0, 0, 0.18)
+ primaryVerticalOffset: VLCStyle.dp(1)
+
+ secondaryBlurRadius: VLCStyle.dp(14)
+ secondaryColor: Qt.rgba(0, 0, 0, 0.22)
+ secondaryVerticalOffset: VLCStyle.dp(6)
+ }
}
Widgets.IconLabel {
id: statusIcon
- anchors.fill: parent
+ anchors.centerIn: parent
visible: (model.isCurrent && text !== "")
- width: height
- height: VLCStyle.icon_normal
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
color: colors.accent
text: {
if (Player.playingState === Player.PLAYING_STATE_PLAYING)
return VLCIcons.volume_high
- if (Player.playingState === Player.PLAYING_STATE_PAUSED)
+ else if (Player.playingState === Player.PLAYING_STATE_PAUSED)
return VLCIcons.pause
- return ""
+ else
+ return ""
}
}
}
=====================================
modules/gui/qt/util/effects_image_provider.cpp
=====================================
@@ -0,0 +1,233 @@
+/*****************************************************************************
+ * Copyright (C) 2022 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.
+ *****************************************************************************/
+
+#include "effects_image_provider.hpp"
+
+#include <QPainter>
+#include <QUrl>
+#include <QUrlQuery>
+#include <QPainterPath>
+
+#include <memory>
+
+#include "qt.hpp" // VLC_WEAK
+
+// Qt private exported function
+QT_BEGIN_NAMESPACE
+extern void VLC_WEAK qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0);
+QT_END_NAMESPACE
+
+
+namespace {
+
+class IEffect
+{
+public:
+ virtual QImage generate(const QSize& size) const = 0;
+ virtual ~IEffect() = default;
+};
+
+class RectDropShadowEffect : public IEffect
+{
+
+public:
+ explicit RectDropShadowEffect(const QVariantMap& settings)
+ : m_blurRadius(settings["blurRadius"].toReal())
+ , m_color(settings["color"].value<QColor>())
+ , m_xOffset(settings["xOffset"].toReal())
+ , m_yOffset(settings["yOffset"].toReal())
+ { }
+
+ QImage generate(const QSize& size) const override
+ {
+ QImage mask(size, QImage::Format_ARGB32_Premultiplied);
+ mask.fill(m_color);
+ return generate(mask);
+ }
+
+ QImage generate(const QImage& mask) const
+ {
+ if (Q_UNLIKELY(!&qt_blurImage))
+ {
+ qWarning("qt_blurImage() is not available! Drop shadow will not work!");
+ return {};
+ }
+
+ // Create a new image with boundaries containing the mask and effect.
+ QImage ret(boundingSize(mask.size()), QImage::Format_ARGB32_Premultiplied);
+ ret.fill(0);
+
+ assert(!ret.isNull());
+ {
+ // Copy the mask
+ QPainter painter(&ret);
+ painter.setCompositionMode(QPainter::CompositionMode_Source);
+ const auto radius = effectiveBlurRadius();
+ painter.drawImage(radius + m_xOffset, radius + m_yOffset, mask);
+ }
+
+ // Blur the mask
+ qt_blurImage(ret, effectiveBlurRadius(), false);
+
+ return ret;
+ }
+
+ constexpr QSize boundingSize(const QSize& size) const
+ {
+ // Size of bounding rectangle of the effect
+ const qreal radius = 2 * effectiveBlurRadius();
+ return size + QSize(qAbs(m_xOffset) + radius, qAbs(m_yOffset) + radius);
+ }
+
+protected:
+ qreal m_blurRadius = 1.0;
+ QColor m_color {63, 63, 63, 180};
+ qreal m_xOffset = 0.0;
+ qreal m_yOffset = 0.0;
+
+private:
+ constexpr qreal effectiveBlurRadius() const
+ {
+ // Translated blur radius for the Qt blur algorithm
+ return 2.5 * (m_blurRadius + 1);
+ }
+};
+
+class RoundedRectDropShadowEffect : public RectDropShadowEffect
+{
+public:
+ explicit RoundedRectDropShadowEffect(const QVariantMap& settings)
+ : RectDropShadowEffect(settings)
+ , m_xRadius(settings["xRadius"].toReal())
+ , m_yRadius(settings["yRadius"].toReal())
+ { }
+
+ QImage generate(const QSize& size) const override
+ {
+ assert(!(qFuzzyIsNull(m_xRadius) && qFuzzyIsNull(m_yRadius))); // use RectDropShadowEffect instead
+
+ QImage mask(size, QImage::Format_ARGB32_Premultiplied);
+ mask.fill(Qt::transparent);
+
+ assert(!mask.isNull());
+ {
+ QPainter painter(&mask);
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.setPen(m_color);
+
+ QPainterPath path;
+ path.addRoundedRect(mask.rect(), m_xRadius, m_yRadius);
+ painter.fillPath(path, m_color);
+ painter.drawPath(path);
+ }
+
+ return RectDropShadowEffect::generate(mask);
+ }
+
+protected:
+ qreal m_xRadius = 0.0;
+ qreal m_yRadius = 0.0;
+};
+
+}
+
+QImage EffectsImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
+{
+ assert(size);
+
+ const auto generate = [&]() -> QImage {
+ // Effect can not be generated if size is not provided.
+ // Qt Quick Image may complain about returning null image,
+ // but there is not much to do here about it.
+ if (requestedSize.isEmpty())
+ return {};
+
+ static const auto effectMetaEnum = QMetaEnum::fromType<EffectsImageProvider::Effect>();
+
+ static const auto queryToVariantMap = [](const QUrlQuery& query) {
+ QVariantMap map;
+ for (auto&& i : query.queryItems())
+ {
+ map.insert(i.first, QUrl::fromPercentEncoding(i.second.toLatin1()));
+ }
+ return map;
+ };
+
+ QUrl url(id, QUrl::ParsingMode::StrictMode);
+
+ const QUrlQuery query(url);
+
+ std::unique_ptr<IEffect> effect;
+ switch (static_cast<EffectsImageProvider::Effect>(effectMetaEnum.keyToValue(url.path().toLatin1())))
+ {
+ case EffectsImageProvider::RectDropShadow:
+ effect = std::make_unique<RectDropShadowEffect>(queryToVariantMap(query));
+ break;
+
+ case EffectsImageProvider::RoundedRectDropShadow:
+ effect = std::make_unique<RoundedRectDropShadowEffect>(queryToVariantMap(query));
+ break;
+
+ default:
+ return {};
+ }
+
+ return effect->generate(requestedSize);
+ };
+
+ const auto& effect = generate();
+ *size = effect.size();
+
+ return effect;
+}
+
+QUrl EffectsImageProvider::url(Effect effect, const QVariantMap &properties)
+{
+ static const auto effectMetaEnum = QMetaEnum::fromType<EffectsImageProvider::Effect>();
+
+ QUrl url;
+ // image://
+ url.setScheme(QStringLiteral("image"));
+ // image://{id} -> image://effects
+ url.setAuthority(QLatin1String(providerId), QUrl::ParsingMode::StrictMode);
+ // image://{id}/{effectType} -> image://effects/DropShadow
+ url.setPath(QString("/%1").arg(effectMetaEnum.valueToKey(effect)), QUrl::ParsingMode::StrictMode);
+
+ QUrlQuery query;
+
+ QMapIterator<QString, QVariant> i(properties);
+ while (i.hasNext())
+ {
+ i.next();
+
+ const QVariant& value = i.value();
+
+ if (!value.isValid() || value.isNull()) // if not valid, defaults are used
+ continue;
+
+ assert(value.canConvert<QString>());
+ assert(!i.key().startsWith('_'));
+
+ // image://{id}/{effectType}?{propertyName}={propertyValue}
+ query.addQueryItem(i.key(), QUrl::toPercentEncoding(value.toString()));
+ }
+ url.setQuery(query);
+
+ assert(url.isValid());
+ return url;
+}
=====================================
modules/gui/qt/util/effects_image_provider.hpp
=====================================
@@ -0,0 +1,56 @@
+/*****************************************************************************
+ * Copyright (C) 2022 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.
+ *****************************************************************************/
+
+#ifndef EFFECTS_IMAGE_PROVIDER_HPP
+#define EFFECTS_IMAGE_PROVIDER_HPP
+
+#include <QObject>
+#include <QUrl>
+#include <QSize>
+#include <QQuickImageProvider>
+
+class EffectsImageProvider : public QObject, public QQuickImageProvider
+{
+ Q_OBJECT
+
+ static constexpr const char * providerId = "effects";
+
+public:
+ enum Effect
+ {
+ RectDropShadow = 1,
+ RoundedRectDropShadow
+ };
+ Q_ENUM(Effect)
+
+ explicit EffectsImageProvider(QQmlEngine *engine)
+ : QQuickImageProvider(QQuickImageProvider::ImageType::Image,
+ QQmlImageProviderBase::ForceAsynchronousImageLoading)
+ {
+ assert(engine);
+
+ // Engine will take the ownership; no need to set parent in constructor
+ engine->addImageProvider(QLatin1String(providerId), this);
+ }
+
+ QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
+
+ Q_INVOKABLE static QUrl url(Effect effect, const QVariantMap& properties);
+};
+
+#endif // EFFECTS_IMAGE_PROVIDER_HPP
=====================================
modules/gui/qt/vlc.qrc
=====================================
@@ -267,11 +267,11 @@
<file alias="ListCoverShadow.qml">widgets/qml/ListCoverShadow.qml</file>
<file alias="OverlayMenu.qml">widgets/qml/OverlayMenu.qml</file>
<file alias="IconControlButton.qml">widgets/qml/IconControlButton.qml</file>
- <file alias="ShadowCoverGenerator.qml">widgets/qml/ShadowCoverGenerator.qml</file>
- <file alias="GridShadows.qml">widgets/qml/GridShadows.qml</file>
<file alias="ToolTipExt.qml">widgets/qml/ToolTipExt.qml</file>
<file alias="MLDragItem.qml">widgets/qml/MLDragItem.qml</file>
<file alias="ScaledImage.qml">widgets/qml/ScaledImage.qml</file>
+ <file alias="DropShadowImage.qml">widgets/qml/DropShadowImage.qml</file>
+ <file alias="DoubleShadow.qml">widgets/qml/DoubleShadow.qml</file>
</qresource>
<qresource prefix="/network">
<file alias="AddressbarButton.qml">network/qml/AddressbarButton.qml</file>
=====================================
modules/gui/qt/widgets/qml/GridShadows.qml → modules/gui/qt/widgets/qml/DoubleShadow.qml
=====================================
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (C) 2021 VLC authors and VideoLAN
+ * Copyright (C) 2022 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
@@ -15,56 +15,64 @@
* 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 2.11
import "qrc:///style/"
+// A convenience file to encapsulate two drop shadow images stacked on top
+// of each other
Item {
id: root
- property alias leftPadding: unselectedShadow.leftPadding
- property alias topPadding: unselectedShadow.topPadding
- property alias coverMargins: unselectedShadow.coverMargins
- property alias coverWidth: unselectedShadow.coverWidth
- property alias coverHeight: unselectedShadow.coverHeight
- property alias coverRadius: unselectedShadow.coverRadius
-
- property alias unselected: unselectedShadow.imageComponent
- property alias selected: selectedShadow.imageComponent
-
- ShadowCoverGenerator {
- id: unselectedShadow
-
- leftPadding: 0
- topPadding: 0
- coverMargins: 1
- coverWidth: VLCStyle.colWidth(1)
- coverHeight: VLCStyle.colWidth(1)
- coverRadius: VLCStyle.gridCover_radius
-
- secondaryVerticalOffset: VLCStyle.dp(1, VLCStyle.scale)
- secondaryRadius: VLCStyle.dp(2, VLCStyle.scale)
- secondarySamples: 1 + VLCStyle.dp(2, VLCStyle.scale) * 2
- primaryVerticalOffset: VLCStyle.dp(4, VLCStyle.scale)
- primaryRadius: VLCStyle.dp(9, VLCStyle.scale)
- primarySamples: 1 + VLCStyle.dp(9, VLCStyle.scale) * 2
+ property var xRadius: null
+ property var yRadius: null
+
+ property alias primaryVerticalOffset: primaryShadow.yOffset
+ property alias primaryHorizontalOffset: primaryShadow.xOffset
+ property alias primaryColor: primaryShadow.color
+ property alias primaryBlurRadius: primaryShadow.blurRadius
+ property alias primaryXRadius: primaryShadow.xRadius
+ property alias primaryYRadius: primaryShadow.yRadius
+
+ property alias secondaryVerticalOffset: secondaryShadow.yOffset
+ property alias secondaryHorizontalOffset: secondaryShadow.xOffset
+ property alias secondaryColor: secondaryShadow.color
+ property alias secondaryBlurRadius: secondaryShadow.blurRadius
+ property alias secondaryXRadius: secondaryShadow.xRadius
+ property alias secondaryYRadius: secondaryShadow.yRadius
+
+ property alias cache: primaryShadow.cache
+
+ visible: (width > 0 && height > 0)
+
+ DropShadowImage {
+ id: primaryShadow
+
+ anchors.centerIn: parent
+
+ color: VLCStyle.colors.bg
+ xOffset: 0
+
+ xRadius: root.xRadius
+ yRadius: root.yRadius
+
+ sourceSize: Qt.size(parent.width, parent.height)
}
- ShadowCoverGenerator {
- id: selectedShadow
-
- leftPadding: root.leftPadding
- topPadding: root.topPadding
- coverMargins: root.coverMargins
- coverWidth: root.coverWidth
- coverHeight: root.coverHeight
- coverRadius: root.coverRadius
-
- secondaryVerticalOffset: VLCStyle.dp(6, VLCStyle.scale)
- secondaryRadius: VLCStyle.dp(18, VLCStyle.scale)
- secondarySamples: 1 + VLCStyle.dp(18, VLCStyle.scale) * 2
- primaryVerticalOffset: VLCStyle.dp(32, VLCStyle.scale)
- primaryRadius: VLCStyle.dp(72, VLCStyle.scale)
- primarySamples: 1 + VLCStyle.dp(72, VLCStyle.scale) * 2
+ DropShadowImage {
+ id: secondaryShadow
+
+ anchors.centerIn: parent
+
+ color: VLCStyle.colors.bg
+ xOffset: 0
+
+ xRadius: root.xRadius
+ yRadius: root.yRadius
+
+ sourceSize: Qt.size(parent.width, parent.height)
+
+ cache: root.cache
}
}
=====================================
modules/gui/qt/widgets/qml/DropShadowImage.qml
=====================================
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (C) 2022 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 2.11
+
+import org.videolan.vlc 0.1
+
+ScaledImage {
+ property var blurRadius: null
+ property var color: null
+ property var xOffset: null
+ property var yOffset: null
+ property var xRadius: null
+ property var yRadius: null
+
+ cache: true
+ asynchronous: true
+
+ fillMode: Image.Pad
+
+ onSourceSizeChanged: {
+ // Do not load the image when size is not valid:
+ if (sourceSize.width > 0 && sourceSize.height > 0)
+ source = Qt.binding(function() {
+ return Effects.url((xRadius > 0 || yRadius > 0) ? Effects.RoundedRectDropShadow
+ : Effects.RectDropShadow,
+ {"blurRadius": blurRadius,
+ "color": color,
+ "xOffset": xOffset,
+ "yOffset": yOffset,
+ "xRadius": xRadius,
+ "yRadius": yRadius})
+ })
+ else
+ source = ""
+ }
+}
=====================================
modules/gui/qt/widgets/qml/GridItem.qml
=====================================
@@ -20,7 +20,7 @@ import QtQuick.Controls 2.4
import QtQuick.Templates 2.4 as T
import QtQuick.Layouts 1.11
import QtQml.Models 2.2
-import QtGraphicalEffects 1.0
+
import org.videolan.vlc 0.1
import "qrc:///widgets/" as Widgets
@@ -60,8 +60,9 @@ T.Control {
property alias playIconSize: picture.playIconSize
property alias pictureRadius: picture.radius
property alias pictureOverlay: picture.imageOverlay
- property alias unselectedUnderlay: unselectedUnderlayLoader.sourceComponent
- property alias selectedUnderlay: selectedUnderlayLoader.sourceComponent
+
+ property alias selectedShadow: selectedShadow
+ property alias unselectedShadow: unselectedShadow
// Signals
@@ -89,15 +90,13 @@ T.Control {
when: highlighted
PropertyChanges {
- target: selectedUnderlayLoader
- opacity: 1
- visible: true
+ target: selectedShadow
+ opacity: 1.0
}
PropertyChanges {
- target: unselectedUnderlayLoader
+ target: unselectedShadow
opacity: 0
- visible: false
}
PropertyChanges {
@@ -117,8 +116,8 @@ T.Control {
SequentialAnimation {
PropertyAction {
- targets: [picture, selectedUnderlayLoader]
- properties: "visible, playCoverVisible"
+ target: picture
+ properties: "playCoverVisible"
}
NumberAnimation {
@@ -126,11 +125,6 @@ T.Control {
duration: VLCStyle.duration_long
easing.type: Easing.InSine
}
-
- PropertyAction {
- target: unselectedUnderlayLoader
- property: "visible"
- }
}
},
@@ -140,8 +134,8 @@ T.Control {
SequentialAnimation {
PropertyAction {
- target: unselectedUnderlayLoader
- property: "visible, playCoverVisible"
+ target: picture
+ property: "playCoverVisible"
}
NumberAnimation {
@@ -149,11 +143,6 @@ T.Control {
duration: VLCStyle.duration_long
easing.type: Easing.OutSine
}
-
- PropertyAction {
- targets: [picture, selectedUnderlayLoader]
- properties: "visible"
- }
}
}
]
@@ -226,26 +215,6 @@ T.Control {
root.dragItem.Drag.active = drag.active
}
- Loader {
- id: unselectedUnderlayLoader
-
- asynchronous: true
- }
-
- Loader {
- id: selectedUnderlayLoader
-
- asynchronous: true
- active: false
- visible: false
- opacity: 0
-
- onVisibleChanged: {
- if (visible && !active)
- active = true
- }
- }
-
ColumnLayout {
id: layout
@@ -264,6 +233,50 @@ T.Control {
Layout.preferredHeight: pictureHeight
onPlayIconClicked: root.playClicked()
+
+ DoubleShadow {
+ id: unselectedShadow
+
+ anchors.fill: parent
+ anchors.margins: VLCStyle.dp(1) // outside border (unselected)
+ z: -1
+
+ opacity: 0.62
+ visible: opacity > 0
+
+ xRadius: parent.radius
+ yRadius: parent.radius
+
+ primaryColor: Qt.rgba(0, 0, 0, .18)
+ primaryVerticalOffset: VLCStyle.dp(1, VLCStyle.scale)
+ primaryBlurRadius: VLCStyle.dp(3, VLCStyle.scale)
+
+ secondaryColor: Qt.rgba(0, 0, 0, .22)
+ secondaryVerticalOffset: VLCStyle.dp(6, VLCStyle.scale)
+ secondaryBlurRadius: VLCStyle.dp(14, VLCStyle.scale)
+ }
+
+ DoubleShadow {
+ id: selectedShadow
+
+ anchors.fill: parent
+ anchors.margins: VLCStyle.dp()
+ z: -1
+
+ visible: opacity > 0
+ opacity: 0
+
+ xRadius: parent.radius
+ yRadius: parent.radius
+
+ primaryColor: Qt.rgba(0, 0, 0, .18)
+ primaryVerticalOffset: VLCStyle.dp(6, VLCStyle.scale)
+ primaryBlurRadius: VLCStyle.dp(18, VLCStyle.scale)
+
+ secondaryColor: Qt.rgba(0, 0, 0, .22)
+ secondaryVerticalOffset: VLCStyle.dp(32, VLCStyle.scale)
+ secondaryBlurRadius: VLCStyle.dp(72, VLCStyle.scale)
+ }
}
Widgets.ScrollingText {
=====================================
modules/gui/qt/widgets/qml/ListCoverShadow.qml
=====================================
@@ -21,11 +21,16 @@ import QtGraphicalEffects 1.0
import "qrc:///style/"
-CoverShadow {
+DoubleShadow {
id: root
primaryVerticalOffset: VLCStyle.dp(6, VLCStyle.scale)
- primaryRadius: VLCStyle.dp(14, VLCStyle.scale)
+ primaryBlurRadius: VLCStyle.dp(14, VLCStyle.scale)
+ primaryColor: Qt.rgba(0, 0, 0, .22)
+
secondaryVerticalOffset: VLCStyle.dp(1, VLCStyle.scale)
- secondaryRadius: VLCStyle.dp(3, VLCStyle.scale)
+ secondaryBlurRadius: VLCStyle.dp(3, VLCStyle.scale)
+ secondaryColor: Qt.rgba(0, 0, 0, .18)
+
+ z: -1
}
=====================================
modules/gui/qt/widgets/qml/ShadowCoverGenerator.qml deleted
=====================================
@@ -1,103 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2021 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 2.11
-import QtGraphicalEffects 1.0
-
-import "qrc:///style/"
-
-Item {
- id: root
-
- property real leftPadding: 0
- property real topPadding: 0
- property real coverMargins: 0
- property real coverWidth: 0
- property real coverHeight: 0
- property real coverRadius: 0
- property color coverColor: VLCStyle.colors.bg
-
- property alias primaryVerticalOffset: primaryShadow.verticalOffset
- property alias primaryRadius: primaryShadow.radius
- property alias primarySamples: primaryShadow.samples
- property alias secondaryVerticalOffset: secondaryShadow.verticalOffset
- property alias secondaryRadius: secondaryShadow.radius
- property alias secondarySamples: secondaryShadow.samples
-
- readonly property real _kernalRadius: Math.max(0, Math.ceil(root.primarySamples / 2))
- property real _reference: 0
-
- property Component imageComponent: ShaderEffectSource {
- sourceItem: container
- live: true
- x: - root._kernalRadius + root.leftPadding
- y: - root._kernalRadius + root.primaryVerticalOffset + root.topPadding
- width: container.width
- height: container.height
- hideSource: true
-
- Component.onCompleted: ++root._reference;
- Component.onDestruction: --root._reference;
- }
-
- Item {
- id: container
-
- // if imageComponent is used with invisible container, generated shadows are too dark
- // another possible fix is to set DropShadow::cached = false, but that has performance penalty
- visible: root._reference > 0
-
- width: baseRect.width + 2 * root._kernalRadius
- height: baseRect.height + 2 * root._kernalRadius
-
- Rectangle {
- id: baseRect
-
- x: root._kernalRadius + root.coverMargins
- y: root._kernalRadius - root.primaryVerticalOffset + root.coverMargins
- width: root.coverWidth - root.coverMargins * 2
- height: root.coverHeight - root.coverMargins * 2
- radius: root.coverRadius
- color: root.coverColor
- }
-
- DropShadow {
- id: primaryShadow
-
- anchors.fill: baseRect
- source: baseRect
- horizontalOffset: 0
- spread: 0
- color: Qt.rgba(0, 0, 0, .22)
- samples: 1 + radius * 2
- cached: true
- }
-
- DropShadow {
- id: secondaryShadow
-
- anchors.fill: baseRect
- source: baseRect
- horizontalOffset: 0
- spread: 0
- color: Qt.rgba(0, 0, 0, .18)
- samples: 1 + radius * 2
- cached: true
- }
- }
-}
=====================================
modules/gui/qt/widgets/qml/TableColumns.qml
=====================================
@@ -53,7 +53,6 @@ Item {
Layout.preferredWidth: root.titleCover_width
ListCoverShadow {
- source: cover
anchors.fill: cover
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/91b6dd6cf141542f0f35db2e4f3f4b24e21c8617...167ea8e130229eecc2b4112abc0c2dee577a09c0
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/91b6dd6cf141542f0f35db2e4f3f4b24e21c8617...167ea8e130229eecc2b4112abc0c2dee577a09c0
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