[vlc-commits] [Git][videolan/vlc][master] 5 commits: contrib: qtdeclarative: enable qt quick effects
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Oct 11 05:22:36 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
a12f6f12 by Fatih Uzunoglu at 2024-10-11T04:46:28+00:00
contrib: qtdeclarative: enable qt quick effects
- - - - -
b326ffa8 by Fatih Uzunoglu at 2024-10-11T04:46:28+00:00
qt: import qt quick effects module
- - - - -
e16c2568 by Fatih Uzunoglu at 2024-10-11T04:46:28+00:00
qml: introduce `DynamicShadow`
- Provides `DynamicShadow.qml` that uses Qt Quick MultiEffect.
- Provides `compat/DynamicShadow.qml` that uses shadow image.
- - - - -
e80f9a22 by Fatih Uzunoglu at 2024-10-11T04:46:28+00:00
qml: consider painted size in `DropShadowImage.qml`
This was already done in `DoubleShadow.qml`.
- - - - -
7b1acdc1 by Fatih Uzunoglu at 2024-10-11T04:46:28+00:00
qml: use `DynamicShadow` in `Player.qml`
- - - - -
10 changed files:
- configure.ac
- contrib/src/qtdeclarative/rules.mak
- modules/gui/qt/Makefile.am
- modules/gui/qt/meson.build
- modules/gui/qt/player/qml/Player.qml
- modules/gui/qt/plugins.hpp
- modules/gui/qt/qt.cpp
- modules/gui/qt/widgets/qml/DropShadowImage.qml
- + modules/gui/qt/widgets/qml/DynamicShadow.qml
- + modules/gui/qt/widgets/qml/compat/DynamicShadow.qml
Changes:
=====================================
configure.ac
=====================================
@@ -4223,6 +4223,7 @@ AM_CONDITIONAL([HAVE_QT_GUI_PRIVATE], [test "${have_qt_gui_private}" = "yes"])
AM_CONDITIONAL([HAVE_QT_CORE_PRIVATE], [test "${have_qt_core_private}" = "yes"])
AM_CONDITIONAL([HAVE_FXC], [test "${have_fxc}" = "yes"])
AM_CONDITIONAL([HAVE_QT67], [test "${QT_VERSION_MAJ:-0}" -gt "6" || (test "${QT_VERSION_MAJ:-0}" = "6" && test "${QT_VERSION_MIN:-0}" -ge "7")])
+AM_CONDITIONAL([HAVE_QT65], [test "${QT_VERSION_MAJ:-0}" -gt "6" || (test "${QT_VERSION_MAJ:-0}" = "6" && test "${QT_VERSION_MIN:-0}" -ge "5")])
dnl
dnl detect kde4-config patch (used for kde solids).
=====================================
contrib/src/qtdeclarative/rules.mak
=====================================
@@ -49,7 +49,6 @@ qtdeclarative: qtdeclarative-everywhere-src-$(QTDECLARATIVE_VERSION).tar.xz .sum
sed -i.orig -e 's,add_subdirectory(svgtoqml),#add_subdirectory(svgtoqml),' $(UNPACK_DIR)/tools/CMakeLists.txt
sed -i.orig -e 's,add_subdirectory(quickdialogs),#add_subdirectory(quickdialogs),' $(UNPACK_DIR)/src/CMakeLists.txt
sed -i.orig -e 's,add_subdirectory(qmldom),#add_subdirectory(qmldom),' $(UNPACK_DIR)/src/CMakeLists.txt
- sed -i.orig -e 's,add_subdirectory(effects),#add_subdirectory(effects),' $(UNPACK_DIR)/src/CMakeLists.txt
sed -i.orig -e 's,add_subdirectory(quickwidgets),#add_subdirectory(quickwidgets),' $(UNPACK_DIR)/src/CMakeLists.txt
$(MOVE)
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -1248,6 +1248,11 @@ libqml_module_widgets_a_QML = \
widgets/qml/PartialEffect.qml \
widgets/qml/ViewHeader.qml \
widgets/qml/ProgressIndicator.qml
+if HAVE_QT65
+libqml_module_widgets_a_QML += widgets/qml/DynamicShadow.qml
+else
+libqml_module_widgets_a_QML += widgets/qml/compat/DynamicShadow.qml
+endif
nodist_libqml_module_widgets_a_SOURCES = widgets_qmlassets.cpp
$(libqml_module_widgets_a_QML:.qml=.cpp) : $(builddir)/widgets/res.qrc
$(libqml_module_widgets_a_QML:.qml=.cpp) : QML_CACHEGEN_ARGS=--resource=$(builddir)/widgets/res.qrc
=====================================
modules/gui/qt/meson.build
=====================================
@@ -798,6 +798,12 @@ qml_modules += {
),
}
+if qt6_dep.version().version_compare('>=6.5.0')
+ qml_dynamicshadow_file = 'widgets/qml/DynamicShadow.qml'
+else
+ qml_dynamicshadow_file = 'widgets/qml/compat/DynamicShadow.qml'
+endif
+
qml_modules += {
'name' : 'VLC.Widgets',
'target' : 'widgets',
@@ -880,7 +886,8 @@ qml_modules += {
'widgets/qml/PopupIconToolButton.qml',
'widgets/qml/PartialEffect.qml',
'widgets/qml/ViewHeader.qml',
- 'widgets/qml/ProgressIndicator.qml'
+ 'widgets/qml/ProgressIndicator.qml',
+ qml_dynamicshadow_file,
),
}
=====================================
modules/gui/qt/player/qml/Player.qml
=====================================
@@ -322,6 +322,24 @@ FocusScope {
readonly property real sizeConstant: 2.7182
+ Widgets.DynamicShadow {
+ anchors.centerIn: cover
+ sourceItem: cover
+
+ color: Qt.rgba(0, 0, 0, .18)
+ yOffset: VLCStyle.dp(24)
+ blurRadius: VLCStyle.dp(54)
+ }
+
+ Widgets.DynamicShadow {
+ anchors.centerIn: cover
+ sourceItem: cover
+
+ color: Qt.rgba(0, 0, 0, .22)
+ yOffset: VLCStyle.dp(5)
+ blurRadius: VLCStyle.dp(14)
+ }
+
Image {
id: cover
@@ -350,19 +368,6 @@ FocusScope {
if (status === Image.Ready)
backgroundImage.scheduleUpdate()
}
-
- // TODO: Qt >= 6.4 Investigate using MultiEffect.
- Widgets.DoubleShadow {
- anchors.centerIn: parent
- sourceItem: parent
-
- cache: false
-
- primaryVerticalOffset: VLCStyle.dp(24)
- primaryBlurRadius: VLCStyle.dp(54)
- secondaryVerticalOffset: VLCStyle.dp(5)
- secondaryBlurRadius: VLCStyle.dp(14)
- }
}
}
=====================================
modules/gui/qt/plugins.hpp
=====================================
@@ -51,6 +51,7 @@
Q_IMPORT_QML_PLUGIN(QtQuickLayoutsPlugin)
Q_IMPORT_QML_PLUGIN(QtQuick_WindowPlugin)
Q_IMPORT_QML_PLUGIN(QtQuickTemplates2Plugin)
+ Q_IMPORT_QML_PLUGIN(QtQuickEffectsPlugin)
Q_IMPORT_QML_PLUGIN(QtQmlModelsPlugin)
Q_IMPORT_QML_PLUGIN(QtGraphicalEffectsPlugin)
Q_IMPORT_QML_PLUGIN(QtGraphicalEffectsPrivatePlugin)
=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -866,6 +866,34 @@ static void *Thread( void *obj )
Q_INIT_RESOURCE( qmake_QtQuick_Controls_Basic_impl );
Q_INIT_RESOURCE( qmake_QtQuick_Layouts );
Q_INIT_RESOURCE( qmake_QtQuick_Templates );
+ // Qt Quick Effects:
+ Q_INIT_RESOURCE( qmake_QtQuick_Effects );
+ Q_INIT_RESOURCE( effects );
+ Q_INIT_RESOURCE( multieffect_shaders1 );
+ Q_INIT_RESOURCE( multieffect_shaders2 );
+ Q_INIT_RESOURCE( multieffect_shaders3 );
+ Q_INIT_RESOURCE( multieffect_shaders4 );
+ Q_INIT_RESOURCE( multieffect_shaders5 );
+ Q_INIT_RESOURCE( multieffect_shaders6 );
+ Q_INIT_RESOURCE( multieffect_shaders7 );
+ Q_INIT_RESOURCE( multieffect_shaders8 );
+ Q_INIT_RESOURCE( multieffect_shaders9 );
+ Q_INIT_RESOURCE( multieffect_shaders10 );
+ Q_INIT_RESOURCE( multieffect_shaders11 );
+ Q_INIT_RESOURCE( multieffect_shaders12 );
+ Q_INIT_RESOURCE( multieffect_shaders13 );
+ Q_INIT_RESOURCE( multieffect_shaders14 );
+ Q_INIT_RESOURCE( multieffect_shaders15 );
+ Q_INIT_RESOURCE( multieffect_shaders16 );
+ Q_INIT_RESOURCE( multieffect_shaders17 );
+ Q_INIT_RESOURCE( multieffect_shaders18 );
+ Q_INIT_RESOURCE( multieffect_shaders19 );
+ Q_INIT_RESOURCE( multieffect_shaders20 );
+ Q_INIT_RESOURCE( multieffect_shaders21 );
+ Q_INIT_RESOURCE( multieffect_shaders22 );
+ Q_INIT_RESOURCE( multieffect_shaders23 );
+ Q_INIT_RESOURCE( multieffect_shaders24 );
+ Q_INIT_RESOURCE( multieffect_shaders25 );
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
Q_INIT_RESOURCE( QuickControls2Basic_raw_qml_0 );
=====================================
modules/gui/qt/widgets/qml/DropShadowImage.qml
=====================================
@@ -30,8 +30,8 @@ ScaledImage {
property real blurRadius: 0
property color color
- property real rectWidth: sourceItem?.width ?? 0
- property real rectHeight: sourceItem?.height ?? 0
+ property real rectWidth: sourceItem ? Math.min(sourceItem.paintedWidth ?? Number.MAX_VALUE, sourceItem.width) : 0
+ property real rectHeight: sourceItem ? Math.min(sourceItem.paintedHeight ?? Number.MAX_VALUE, sourceItem.height) : 0
property real xOffset: 0
property real yOffset: 0
=====================================
modules/gui/qt/widgets/qml/DynamicShadow.qml
=====================================
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * Copyright (C) 2024 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.Effects
+
+MultiEffect {
+ id: effect
+
+ implicitWidth: sourceItem ? Math.min(sourceItem.paintedWidth ?? Number.MAX_VALUE, sourceItem.width) : 0
+ implicitHeight: sourceItem ? Math.min(sourceItem.paintedHeight ?? Number.MAX_VALUE, sourceItem.height) : 0
+
+ shadowEnabled: true
+ shadowBlur: 1.0
+
+ paddingRect: Qt.rect(xOffset, yOffset, 0, 0)
+
+ property alias sourceItem: effect.source
+
+ property alias xOffset: effect.shadowHorizontalOffset
+ property alias yOffset: effect.shadowVerticalOffset
+
+ property alias blurRadius: effect.blurMax
+
+ property alias color: effect.shadowColor
+
+ Binding {
+ // Source item should be made invisible
+ // since multi effect already renders
+ // the source item.
+ when: sourceItem && effect.visible
+ target: sourceItem
+ property: "visible"
+ value: false
+ }
+}
=====================================
modules/gui/qt/widgets/qml/compat/DynamicShadow.qml
=====================================
@@ -0,0 +1,24 @@
+/*****************************************************************************
+ * Copyright (C) 2024 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 VLC.Widgets
+
+DropShadowImage {
+ cache: false
+}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8a6b026280d5d2794b18e765690f8208aec6187c...7b1acdc1bfb741b3bb7c2fef2b485af61e737953
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8a6b026280d5d2794b18e765690f8208aec6187c...7b1acdc1bfb741b3bb7c2fef2b485af61e737953
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