From 056da8ac9907869d6a22a1e13645c7c3f232ec59 Mon Sep 17 00:00:00 2001 From: Camilo Higuita Date: Mon, 21 Oct 2024 20:00:12 -0500 Subject: [PATCH] remove usage of qt5compact grphical effects --- caskcore/plugin/src/controls/Dashboard.qml | 6 +- .../src/controls/templates/PanelCard.qml | 11 +-- .../src/controls/templates/PanelPopup.qml | 24 ++--- src/qml/CaskScreen.qml | 2 - src/qml/chrome/Border.qml | 1 - src/qml/chrome/Chrome.qml | 96 +++++++++---------- src/qml/chrome/Decoration.qml | 13 +-- src/qml/shell/AppsOverview.qml | 47 +++++---- src/qml/shell/statusbar/StatusBar.qml | 9 +- .../items/notifications/NotificationItem.qml | 10 +- .../statusbar/items/player/PlayerCard.qml | 7 +- .../statusbar/items/player/PlayerPage.qml | 4 +- src/qml/shell/tasksbar/Dock.qml | 22 ++--- src/qml/shell/tasksbar/Launcher.qml | 11 +-- src/qml/shell/tasksbar/TaskBar.qml | 56 ++++++----- src/qml/shell/templates/SliderTemplate.qml | 20 ++-- src/qml/shell/zpaces/WorkZpaceSwitcher.qml | 2 - src/qml/shell/zpaces/Zpace.qml | 78 +++++++-------- 18 files changed, 200 insertions(+), 219 deletions(-) diff --git a/caskcore/plugin/src/controls/Dashboard.qml b/caskcore/plugin/src/controls/Dashboard.qml index aab1bd8..5e4bb46 100644 --- a/caskcore/plugin/src/controls/Dashboard.qml +++ b/caskcore/plugin/src/controls/Dashboard.qml @@ -4,8 +4,6 @@ import QtQuick.Controls import org.mauikit.controls as Maui import org.maui.cask as Cask -import Qt5Compat.GraphicalEffects - Item { id: control @@ -53,11 +51,11 @@ Item } } - Item { id: _superOverlay anchors.fill: parent + Item { id: _underneathContent @@ -111,6 +109,4 @@ Item { console.log("DESTROY DASHBOARD") } - - } diff --git a/caskcore/plugin/src/controls/templates/PanelCard.qml b/caskcore/plugin/src/controls/templates/PanelCard.qml index cb9547f..65df9e9 100644 --- a/caskcore/plugin/src/controls/templates/PanelCard.qml +++ b/caskcore/plugin/src/controls/templates/PanelCard.qml @@ -1,5 +1,5 @@ import QtQuick -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import QtQml.Models import QtQuick.Layouts import QtQuick.Controls @@ -81,12 +81,11 @@ Pane } layer.enabled: true - layer.effect: DropShadow + layer.effect: MultiEffect { - horizontalOffset: 0 - verticalOffset: 0 - samples: 10 - color: Qt.rgba(0,0,0,0.5) + autoPaddingEnabled: true + shadowEnabled: true + shadowColor: "#000000" } } diff --git a/caskcore/plugin/src/controls/templates/PanelPopup.qml b/caskcore/plugin/src/controls/templates/PanelPopup.qml index f053a8b..1217bbf 100644 --- a/caskcore/plugin/src/controls/templates/PanelPopup.qml +++ b/caskcore/plugin/src/controls/templates/PanelPopup.qml @@ -3,8 +3,7 @@ import QtQml import QtQuick.Window import QtQuick.Layouts import QtQuick.Controls - -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import org.mauikit.controls as Maui import org.maui.cask as Cask @@ -69,20 +68,15 @@ Container active: Maui.Style.enableEffects && control.displayOverlay anchors.fill: parent - sourceComponent: Item + sourceComponent: MultiEffect { - FastBlur - { - anchors.fill: parent - radius: 64 - source: _cask.superOverlay - - layer.enabled: true - layer.effect: Desaturate - { - desaturation: -1.2 - } - } + // opacity: 0.2 + blurEnabled: true + blurMax: 64 + saturation: -0.5 + blur: Math.min(0.7, (control.height/(availableGeometry.height* 0.7))) + autoPaddingEnabled: true + source: _cask.superOverlay } } diff --git a/src/qml/CaskScreen.qml b/src/qml/CaskScreen.qml index 85c34f1..517781d 100644 --- a/src/qml/CaskScreen.qml +++ b/src/qml/CaskScreen.qml @@ -23,8 +23,6 @@ import QtQuick.Layouts import QtQuick.Window -import Qt5Compat.GraphicalEffects - import QtWayland.Compositor import org.mauikit.controls as Maui diff --git a/src/qml/chrome/Border.qml b/src/qml/chrome/Border.qml index 12fa523..dc47f8b 100644 --- a/src/qml/chrome/Border.qml +++ b/src/qml/chrome/Border.qml @@ -1,4 +1,3 @@ - import QtQuick import QtQuick.Controls diff --git a/src/qml/chrome/Chrome.qml b/src/qml/chrome/Chrome.qml index 279e285..3784463 100644 --- a/src/qml/chrome/Chrome.qml +++ b/src/qml/chrome/Chrome.qml @@ -17,15 +17,15 @@ ****************************************************************************/ import QtQuick +import QtQml + import QtQuick.Controls import QtQuick.Layouts -import QtQml +import QtQuick.Effects import QtWayland.Compositor import QtWayland.Compositor.XdgShell -import Qt5Compat.GraphicalEffects - import org.mauikit.controls as Maui import org.maui.cask as Cask import Zpaces as ZP @@ -56,7 +56,6 @@ Cask.StackableItem property bool resizing : toplevel.resizing readonly property bool fullscreen : toplevel.fullscreen - property alias moveItem: surfaceItem.moveItem readonly property bool decorationVisible: win.formFactor === Cask.MauiMan.Desktop && toplevel.decorationMode === XdgToplevel.ServerSideDecoration @@ -72,20 +71,6 @@ Cask.StackableItem x: surfaceItem.moveItem.x y: surfaceItem.moveItem.y - // Binding on x - // { - // when: rootChrome.moveItem - // value: surfaceItem.moveItem.x - surfaceItem.output.geometry.x - // restoreMode: Binding.RestoreBinding - // } - - // Binding on y - // { - // when: rootChrome.moveItem - // value: surfaceItem.moveItem.y - surfaceItem.output.geometry.y - // restoreMode: Binding.RestoreBinding - // } - height: surfaceItem.height + titlebarHeight width: surfaceItem.width @@ -108,7 +93,6 @@ Cask.StackableItem } ] - Decoration { id: _decoration @@ -137,7 +121,7 @@ Cask.StackableItem y: titlebarHeight -// sizeFollowsSurface: false + // sizeFollowsSurface: false opacity: moving || pinch4.activeScale <= 0.5 ? 0.5 : 1.0 inputEventsEnabled: !rootChrome.overviewMode @@ -191,43 +175,54 @@ Cask.StackableItem valid = !surface.cursorSurface && surface.size.width > 0 && surface.size.height > 0 } - layer.enabled: rootChrome.decorationVisible - layer.effect: OpacityMask - { - maskSource: Maui.ShadowedRectangle - { - width: Math.floor(rootChrome.width) - height: Math.floor(rootChrome.height) - - corners - { - topLeftRadius: 0 - topRightRadius: 0 - bottomLeftRadius: _decoration.radius - bottomRightRadius: _decoration.radius - } - } - } + // layer.enabled: rootChrome.decorationVisible + // layer.effect: MultiEffect + // { + // maskEnabled: true + // maskThresholdMin: 0.5 + // maskSpreadAtMin: 1.0 + // maskSpreadAtMax: 0.0 + // maskThresholdMax: 1.0 + // maskSource: ShaderEffectSource + // { + // sourceItem: Maui.ShadowedRectangle + // { + // width: Math.floor(rootChrome.width) + // height: Math.floor(rootChrome.height) + + // corners + // { + // topLeftRadius: 0 + // topRightRadius: 0 + // bottomLeftRadius: _decoration.radius + // bottomRightRadius: _decoration.radius + // } + // } + // } + // } } - Rectangle + Loader { - id: _shield - radius: _decoration.radius - visible: Cask.Server.screenshot.blacklisted.indexOf(rootChrome.appId) >= 0 && _screenshotArea.running - color: Maui.Theme.backgroundColor + id: _shieldLoader anchors.fill: parent z: surfaceItem.z +1 - Maui.Holder + sourceComponent: Rectangle { - anchors.fill: parent - emoji: "dialog-warning-symbolic" - visible: true - title: i18n("Protected") - body: i18n("This app has requested to not be shown in screenshots.") - } + radius: _decoration.radius + visible: Cask.Server.screenshot.blacklisted.indexOf(rootChrome.appId) >= 0 && _screenshotArea.running + color: Maui.Theme.backgroundColor + Maui.Holder + { + anchors.fill: parent + emoji: "dialog-warning-symbolic" + visible: true + title: i18n("Protected") + body: i18n("This app has requested to not be shown in screenshots.") + } + } } Loader @@ -235,12 +230,11 @@ Cask.StackableItem asynchronous: true anchors.fill: parent active: win.formFactor === Cask.MauiMan.Desktop ? (rootChrome.decorationVisible && !window.maximized && !rootChrome.fullscreen) : (rootChrome.height < availableGeometry.height || rootChrome.width < availableGeometry.width || pinch4.active) - z: surfaceItem.z +9999999999 + z: surfaceItem.z + 9999999999 sourceComponent: Border {} } - Connections { target: rootChrome.parent diff --git a/src/qml/chrome/Decoration.qml b/src/qml/chrome/Decoration.qml index c695ce4..fb6fbf0 100644 --- a/src/qml/chrome/Decoration.qml +++ b/src/qml/chrome/Decoration.qml @@ -1,8 +1,8 @@ import QtQuick import QtQuick.Controls +import QtQuick.Effects import QtWayland.Compositor -import Qt5Compat.GraphicalEffects import org.mauikit.controls as Maui import org.maui.cask as Cask @@ -214,14 +214,11 @@ Rectangle } layer.enabled: control.showDropShadow - layer.effect: DropShadow + layer.effect: MultiEffect { - transparentBorder: true - horizontalOffset: 0 - verticalOffset: 0 - radius: 12 - samples: 17 - color: "#000000" + autoPaddingEnabled: true + shadowEnabled: true + shadowColor: "#000000" } } diff --git a/src/qml/shell/AppsOverview.qml b/src/qml/shell/AppsOverview.qml index 4865b2d..6b9f9d7 100644 --- a/src/qml/shell/AppsOverview.qml +++ b/src/qml/shell/AppsOverview.qml @@ -4,7 +4,7 @@ import QtQuick.Controls import QtQuick.Window import QtQuick.Layouts -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import QtWayland.Compositor @@ -24,13 +24,16 @@ Maui.Page property alias contentX : _flickable.contentX headBar.visible: false - background: FastBlur + background: MultiEffect { - id: fastBlur - source: _cask - radius: 64 - transparentBorder: false - cached: true + // opacity: 0.2 + blurEnabled: true + blurMax: 64 + saturation: -0.5 + blur: 1.0 + autoPaddingEnabled: true + source: _cask.superOverlay + Rectangle { @@ -190,17 +193,22 @@ Maui.Page anchors.fill: parent layer.enabled: true - layer.effect: OpacityMask + layer.effect: MultiEffect { - maskSource: Item + maskEnabled: true + maskThresholdMin: 0.5 + maskSpreadAtMin: 1.0 + maskSpreadAtMax: 0.0 + maskThresholdMax: 1.0 + maskSource: ShaderEffectSource { - width: _thumbnail.width - height: _thumbnail.height - - Rectangle + sourceItem: Rectangle { - anchors.fill: parent + width: _thumbnail.width + height: _thumbnail.height + radius: Maui.Style.radiusV + } } } @@ -227,14 +235,11 @@ Maui.Page } layer.enabled:true - layer.effect: DropShadow + layer.effect: MultiEffect { - transparentBorder: true - horizontalOffset: 0 - verticalOffset: 0 - radius: 8.0 - samples: 17 - color: Qt.rgba(0,0,0,0.5) + autoPaddingEnabled: true + shadowEnabled: true + shadowColor: "#000000" } } } diff --git a/src/qml/shell/statusbar/StatusBar.qml b/src/qml/shell/statusbar/StatusBar.qml index c53c010..d1d82e1 100644 --- a/src/qml/shell/statusbar/StatusBar.qml +++ b/src/qml/shell/statusbar/StatusBar.qml @@ -3,8 +3,6 @@ import QtQuick.Window import QtQuick.Layouts import QtQuick.Controls -import Qt5Compat.GraphicalEffects - import org.mauikit.controls as Maui import org.maui.cask as Cask @@ -71,12 +69,11 @@ Control // visible: !control.floating opacity: _notificationsSection.popup.opened || _statusSection.popup.opened ? 1 : 0.8 - LinearGradient + Rectangle { anchors.fill: parent opacity: 0.8 - start: Qt.point(0, 0) - end: Qt.point(0, height) + gradient: Gradient { GradientStop { position: 0.0; color: "#333" } @@ -97,9 +94,7 @@ Control { anchors.fill: parent color: !control.floating ? Maui.Theme.backgroundColor : "transparent" - } - } Rectangle diff --git a/src/qml/shell/statusbar/items/notifications/NotificationItem.qml b/src/qml/shell/statusbar/items/notifications/NotificationItem.qml index beb25a0..fd01944 100644 --- a/src/qml/shell/statusbar/items/notifications/NotificationItem.qml +++ b/src/qml/shell/statusbar/items/notifications/NotificationItem.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts import org.mauikit.controls as Maui -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import org.maui.cask as Cask @@ -132,11 +132,11 @@ ItemDelegate } layer.enabled: true - layer.effect: DropShadow + layer.effect: MultiEffect { - transparentBorder: true - horizontalOffset: 0 - verticalOffset: 0 + autoPaddingEnabled: true + shadowEnabled: true + shadowColor: "#000000" } } } diff --git a/src/qml/shell/statusbar/items/player/PlayerCard.qml b/src/qml/shell/statusbar/items/player/PlayerCard.qml index d930dfd..94d9147 100644 --- a/src/qml/shell/statusbar/items/player/PlayerCard.qml +++ b/src/qml/shell/statusbar/items/player/PlayerCard.qml @@ -5,8 +5,6 @@ import QtQuick.Layouts import org.mauikit.controls as Maui import org.maui.cask as Cask -import Qt5Compat.GraphicalEffects - ItemDelegate { id: control @@ -71,11 +69,10 @@ ItemDelegate iconSource: control.playerIcon maskRadius: Maui.Style.radiusV - LinearGradient + Rectangle { anchors.fill: parent - start: Qt.point(0, 0) - end: Qt.point(0, parent.height) + gradient: Gradient { GradientStop { position: 0.0; color: "transparent" } diff --git a/src/qml/shell/statusbar/items/player/PlayerPage.qml b/src/qml/shell/statusbar/items/player/PlayerPage.qml index 253c1f6..439d5fc 100644 --- a/src/qml/shell/statusbar/items/player/PlayerPage.qml +++ b/src/qml/shell/statusbar/items/player/PlayerPage.qml @@ -116,7 +116,7 @@ StackPage Component.onCompleted: { - control.player.updatePosition(); + control.player.updatePosition(); } Timer @@ -169,7 +169,7 @@ StackPage { Layout.fillWidth: true Layout.fillHeight: true - // fillMode: Image.PreserveAspectCrop + fillMode: Image.PreserveAspectFit imageSource: control.albumArt iconSource: control.playerIcon // iconSizeHint: 48 diff --git a/src/qml/shell/tasksbar/Dock.qml b/src/qml/shell/tasksbar/Dock.qml index c04d6ae..17b2211 100644 --- a/src/qml/shell/tasksbar/Dock.qml +++ b/src/qml/shell/tasksbar/Dock.qml @@ -6,7 +6,7 @@ import QtQuick.Layouts import org.mauikit.controls as Maui import org.maui.cask as Cask -import Qt5Compat.GraphicalEffects +import QtQuick.Effects Item { @@ -43,20 +43,16 @@ Item active: Maui.Style.enableEffects anchors.fill: parent - sourceComponent: Item + sourceComponent: MultiEffect { - FastBlur - { - anchors.fill: parent - radius: 64 - source: _cask.container + // opacity: 0.2 + blurEnabled: true + blurMax: 64 + saturation: -0.5 + blur: 1.0 + autoPaddingEnabled: true + source: _cask.container - layer.enabled: true - layer.effect: Desaturate - { - desaturation: -1.2 - } - } Rectangle { diff --git a/src/qml/shell/tasksbar/Launcher.qml b/src/qml/shell/tasksbar/Launcher.qml index d90fe72..3975602 100644 --- a/src/qml/shell/tasksbar/Launcher.qml +++ b/src/qml/shell/tasksbar/Launcher.qml @@ -7,7 +7,7 @@ import org.mauikit.filebrowsing as FB import org.maui.cask as Cask -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import Qt.labs.platform as Labs @@ -129,12 +129,11 @@ Maui.Page } layer.enabled: !control.fullscreenLauncher - layer.effect: DropShadow + layer.effect: MultiEffect { - horizontalOffset: 0 - verticalOffset: 0 - samples: 10 - color: Qt.rgba(0,0,0,0.5) + autoPaddingEnabled: true + shadowEnabled: true + shadowColor: "#000000" } } diff --git a/src/qml/shell/tasksbar/TaskBar.qml b/src/qml/shell/tasksbar/TaskBar.qml index 201e589..94f1808 100644 --- a/src/qml/shell/tasksbar/TaskBar.qml +++ b/src/qml/shell/tasksbar/TaskBar.qml @@ -7,7 +7,7 @@ import org.mauikit.controls as Maui import org.maui.cask as Cask import Zpaces as ZP -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import "../templates" @@ -55,23 +55,20 @@ Control // active: Maui.Style.enableEffects sourceComponent: Item { - - FastBlur + MultiEffect { - anchors.fill: parent - radius: 64 + // opacity: 0.2 + blurEnabled: true + blurMax: 64 + saturation: -0.5 + blur: 1.0 + autoPaddingEnabled: true source: ShaderEffectSource { live: true sourceItem: cask.container sourceRect: _bg.mapToItem(cask.container, Qt.rect(_bg.x, _bg.y, _bg.width, _bg.height)) } - - layer.enabled: true - layer.effect: Desaturate - { - desaturation: -1.2 - } } Rectangle @@ -81,26 +78,33 @@ Control opacity: 0.6 } - layer.enabled: true - layer.effect: OpacityMask - { - maskSource: Rectangle - { - width: _bg.width - height: _bg.height - radius: _bg.radius - } - } + // layer.enabled: true + // layer.effect: MultiEffect + // { + // maskEnabled: true + // maskThresholdMin: 0.5 + // maskSpreadAtMin: 1.0 + // maskSpreadAtMax: 0.0 + // maskThresholdMax: 1.0 + // maskSource: ShaderEffectSource + // { + // sourceItem: Rectangle + // { + // width: _bg.width + // height: _bg.height + // radius: _bg.radius + // } + // } + // } } } layer.enabled: win.formFactor === Cask.MauiMan.Desktop && Maui.Style.enableEffects - layer.effect: DropShadow + layer.effect: MultiEffect { - horizontalOffset: 0 - verticalOffset: 0 - samples: 10 - color: Qt.rgba(0,0,0,0.5) + autoPaddingEnabled: true + shadowEnabled: true + shadowColor: "#000000" } } diff --git a/src/qml/shell/templates/SliderTemplate.qml b/src/qml/shell/templates/SliderTemplate.qml index f423ec5..0c6e39a 100644 --- a/src/qml/shell/templates/SliderTemplate.qml +++ b/src/qml/shell/templates/SliderTemplate.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import org.mauikit.controls as Maui -import Qt5Compat.GraphicalEffects +import QtQuick.Effects Slider { @@ -72,13 +72,21 @@ Slider } layer.enabled: _animatedRec.visible - layer.effect: OpacityMask + layer.effect: MultiEffect { - maskSource: Rectangle + maskEnabled: true + maskThresholdMin: 0.5 + maskSpreadAtMin: 1.0 + maskSpreadAtMax: 0.0 + maskThresholdMax: 1.0 + maskSource: ShaderEffectSource { - width: _bg.width - height: _bg.height - radius: _bg.radius + sourceItem: Rectangle + { + width: _bg.width + height: _bg.height + radius: _bg.radius + } } } } diff --git a/src/qml/shell/zpaces/WorkZpaceSwitcher.qml b/src/qml/shell/zpaces/WorkZpaceSwitcher.qml index 16b0759..0f818f0 100644 --- a/src/qml/shell/zpaces/WorkZpaceSwitcher.qml +++ b/src/qml/shell/zpaces/WorkZpaceSwitcher.qml @@ -5,8 +5,6 @@ import QtQuick.Layouts import QtQuick.Window -import Qt5Compat.GraphicalEffects - import QtWayland.Compositor import org.mauikit.controls as Maui import org.maui.cask as Cask diff --git a/src/qml/shell/zpaces/Zpace.qml b/src/qml/shell/zpaces/Zpace.qml index bfb237d..d69d853 100644 --- a/src/qml/shell/zpaces/Zpace.qml +++ b/src/qml/shell/zpaces/Zpace.qml @@ -8,7 +8,7 @@ import org.maui.cask as Cask import Zpaces as ZP -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import "../.." import "../../chrome" @@ -89,37 +89,45 @@ Pane } } - ColorOverlay - { + // ColorOverlay + // { + // anchors.fill: _bgContainer + // source: _img + // color: ? : "transparent" + + // layer.enabled: control.radius > 0 || control.rise + // layer.effect: OpacityMask + // { + // maskSource: Rectangle + // { + // width: _img.width + // height: _img.height + // radius: control.radius + // } + // } + // } + + MultiEffect { id: _backgroundOverlay - anchors.fill: _bgContainer - source: _img - color: Cask.MauiMan.background.dimWallpaper ? "#80800000" : "transparent" - - layer.enabled: control.radius > 0 || control.rise - layer.effect: OpacityMask - { - maskSource: Rectangle - { - width: _img.width - height: _img.height - radius: control.radius - } - } - } - DropShadow - { - // visible: control.rise - transparentBorder: true anchors.fill: _bgContainer - horizontalOffset: 0 - verticalOffset: 0 - radius: 8.0 - samples: 17 - color: Qt.rgba(0,0,0,0.9) - source: _bgContainer - } + source: _img + colorization: Cask.MauiMan.background.dimWallpaper ? 1.0 : 0.0 + colorizationColor: "#80800000" + } + + // DropShadow + // { + // // visible: control.rise + // transparentBorder: true + // anchors.fill: _bgContainer + // horizontalOffset: 0 + // verticalOffset: 0 + // radius: 8.0 + // samples: 17 + // color: Qt.rgba(0,0,0,0.9) + // source: _bgContainer + // } } contentItem : Item @@ -146,19 +154,13 @@ Pane scale: isMobile ? 1 : _swipeView.scale - moveItem: Rectangle + moveItem: Item { - color: "pink" - Text { - anchors.bottom: parent.bottom - - text: parent.x + " - " + parent.y - color: "white" - } - opacity: 0.2 objectName: "moveItem" property bool moving: false + parent: _container + x: 0 y: 0