From e7bd122fabae9228a90efd9b651441f3ca52334e Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Wed, 3 Feb 2021 19:20:13 +0200 Subject: [PATCH] improvements for applet items --never overlay icons any more for applets --applet shadows are now below the applet --applet icon colors are discovered through LatteCore.IconItem --- .../package/contents/ui/applet/AppletItem.qml | 4 +- .../contents/ui/applet/ItemWrapper.qml | 81 ++++++++----------- 2 files changed, 37 insertions(+), 48 deletions(-) diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index 57c743fbe..33c10ce2b 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -725,8 +725,8 @@ Item { palette: colorizerManager.applyTheme //!icon colors - iconBackgroundColor: isSquare ? appletItem.wrapper.overlayIconLoader.backgroundColor : colorizerManager.buttonFocusColor - iconGlowColor: isSquare ? appletItem.wrapper.overlayIconLoader.glowColor : colorizerManager.focusGlowColor + iconBackgroundColor: appletItem.wrapper.overlayIconLoader.backgroundColor + iconGlowColor: appletItem.wrapper.overlayIconLoader.glowColor } //! InConfigureApplets visual paddings diff --git a/containment/package/contents/ui/applet/ItemWrapper.qml b/containment/package/contents/ui/applet/ItemWrapper.qml index 90bf27c6e..44b07db59 100644 --- a/containment/package/contents/ui/applet/ItemWrapper.qml +++ b/containment/package/contents/ui/applet/ItemWrapper.qml @@ -151,7 +151,6 @@ Item{ property Item wrapperContainer: _wrapperContainer property Item clickedEffect: _clickedEffect - property Item containerForOverlayIcon: _containerForOverlayIcon property Item overlayIconLoader: _overlayIconLoader readonly property int internalSplitterComputedLength: { @@ -360,12 +359,32 @@ Item{ } } + ///Shadow in applets + Loader{ + id: appletShadow + anchors.fill: _wrapperContainer + + active: appletItem.applet + && graphicsSystem.isAccelerated + && !appletColorizer.mustBeShown + && (appletItem.myView.itemShadow.isEnabled && !appletItem.communicator.indexerIsSupported) + + sourceComponent: DropShadow{ + anchors.fill: parent + color: appletItem.myView.itemShadow.shadowColor + fast: true + samples: 2 * radius + source: _wrapperContainer + radius: appletItem.myView.itemShadow.size + verticalOffset: root.forceTransparentPanel || root.forcePanelForBusyBackground ? 0 : 2 + } + } + //! Applet Main Container Item{ id:_wrapperContainer width: root.isHorizontal ? _length : _thickness height: root.isHorizontal ? _thickness : _length - opacity: appletShadow.active ? 0 : 1 property int _length:0 // through Binding to avoid binding loops property int _thickness:0 // through Binding to avoid binding loops @@ -413,18 +432,21 @@ Item{ } } - Item{ - id: _containerForOverlayIcon - anchors.fill: parent - } - Loader{ id: _overlayIconLoader anchors.fill: parent - active: communicator.appletMainIconIsFound + active: communicator.appletMainIconIsFound && indicators.info.needsIconColors - property color backgroundColor: "black" - property color glowColor: "white" + property color backgroundColor: "transparent" + property color glowColor: "transparent" + + readonly property bool isIconItemVisible: communicator.appletIconItem && communicator.appletIconItem.visible + + onIsIconItemVisibleChanged: { + if (isIconItemVisible) { + communicator.appletIconItem.roundToIconSize = false; + } + } sourceComponent: LatteCore.IconItem{ id: overlayIconItem @@ -432,16 +454,16 @@ Item{ visible: false source: { - if (communicator.appletIconItem && communicator.appletIconItem.visible) { + if (communicator.appletIconItem) { return communicator.appletIconItem.source; - } else if (communicator.appletImageItem && communicator.appletImageItem.visible) { + } else if (communicator.appletImageItem) { return communicator.appletImageItem.source; } return ""; } - providesColors: indicators.info.needsIconColors && source != "" + providesColors: source != "" usesPlasmaTheme: communicator.appletIconItem && communicator.appletIconItem.visible ? communicator.appletIconItem.usesPlasmaTheme : false Binding{ @@ -577,39 +599,6 @@ Item{ } } - ///Shadow in applets - Loader{ - id: appletShadow - anchors.fill: appletItem.appletWrapper - - active: appletItem.applet - && graphicsSystem.isAccelerated - && !appletColorizer.mustBeShown - && (appletItem.myView.itemShadow.isEnabled && !appletItem.communicator.indexerIsSupported) - - onActiveChanged: { - if (active && !isSeparator && graphicsSystem.isAccelerated) { - wrapperContainer.opacity = 0; - } else { - wrapperContainer.opacity = 1; - } - } - - opacity: isSeparator ? 0.4 : 1 - - sourceComponent: DropShadow{ - anchors.fill: parent - color: appletItem.myView.itemShadow.shadowColor - fast: true - samples: 2 * radius - source: appletItem.applet - radius: shadowSize - verticalOffset: root.forceTransparentPanel || root.forcePanelForBusyBackground ? 0 : 2 - - property int shadowSize : appletItem.myView.itemShadow.size - } - } - BrightnessContrast { id: _clickedEffect anchors.fill: _wrapperContainer