From 3e2c59b5bbfd70979824d98581928662b0c5d69b Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sun, 24 Jan 2021 20:13:24 +0200 Subject: [PATCH] containment more simplifications for indicators --- .../package/contents/ui/applet/AppletItem.qml | 36 +++++++-- .../applet/{indicator => }/IndicatorLevel.qml | 0 .../contents/ui/applet/indicator/Bridge.qml | 47 ----------- .../ui/applet/indicator/LevelOptions.qml | 47 ----------- .../contents/ui/layouts/indicator/Bridge.qml | 77 ------------------- .../contents/ui/layouts/indicator/Loader.qml | 41 ---------- .../items/indicators/LevelOptions.qml | 2 +- 7 files changed, 30 insertions(+), 220 deletions(-) rename containment/package/contents/ui/applet/{indicator => }/IndicatorLevel.qml (100%) delete mode 100644 containment/package/contents/ui/applet/indicator/Bridge.qml delete mode 100644 containment/package/contents/ui/applet/indicator/LevelOptions.qml delete mode 100644 containment/package/contents/ui/layouts/indicator/Bridge.qml delete mode 100644 containment/package/contents/ui/layouts/indicator/Loader.qml diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index 13856d209..7bd6115a5 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -30,9 +30,10 @@ import org.kde.kquickcontrolsaddons 2.0 import org.kde.latte.core 0.2 as LatteCore import org.kde.latte.components 1.0 as LatteComponents +import org.kde.latte.abilities.items 0.1 as AbilityItem + import "colorizer" as Colorizer import "communicator" as Communicator -import "indicator" as Indicator import "../debugger" as Debugger Item { @@ -754,8 +755,29 @@ Item { width: wrapper.width height: wrapper.height - Indicator.Bridge{ - id: indicatorBridge + AbilityItem.IndicatorObject { + id: appletIndicatorObj + animations: appletItem.animations + metrics: appletItem.metrics + indicatorsHost: indicators + + isApplet: true + + isActive: appletItem.isActive + isHovered: appletItem.containsMouse + isSquare: appletItem.isSquare + + hasActive: isActive + + scaleFactor: appletItem.wrapper.zoomScale + panelOpacity: root.background.currentOpacity + shadowColor: root.appShadowColorSolid + + palette: colorizerManager.applyTheme + + //!icon colors + iconBackgroundColor: isSquare ? appletItem.wrapper.overlayIconLoader.backgroundColor : colorizerManager.buttonFocusColor + iconGlowColor: isSquare ? appletItem.wrapper.overlayIconLoader.glowColor : colorizerManager.focusGlowColor } //! InConfigureApplets visual paddings @@ -768,12 +790,12 @@ Item { } //! Indicator Back Layer - Indicator.IndicatorLevel{ + IndicatorLevel{ id: indicatorBackLayer visualParent: appletItem indicatorsHost: indicators level.isBackground: true - level.bridge: indicatorBridge + level.bridge: appletIndicatorObj Loader{ anchors.fill: parent @@ -817,12 +839,12 @@ Item { } //! Indicator Front Layer - Indicator.IndicatorLevel{ + IndicatorLevel{ id: indicatorFrontLayer visualParent: appletItem indicatorsHost: indicators level.isForeground: true - level.bridge: indicatorBridge + level.bridge: appletIndicatorObj } //! Applet Shortcut Visual Badge diff --git a/containment/package/contents/ui/applet/indicator/IndicatorLevel.qml b/containment/package/contents/ui/applet/IndicatorLevel.qml similarity index 100% rename from containment/package/contents/ui/applet/indicator/IndicatorLevel.qml rename to containment/package/contents/ui/applet/IndicatorLevel.qml diff --git a/containment/package/contents/ui/applet/indicator/Bridge.qml b/containment/package/contents/ui/applet/indicator/Bridge.qml deleted file mode 100644 index aa5e53af5..000000000 --- a/containment/package/contents/ui/applet/indicator/Bridge.qml +++ /dev/null @@ -1,47 +0,0 @@ -/* -* Copyright 2019 Michail Vourlakos -* -* This file is part of Latte-Dock -* -* Latte-Dock 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. -* -* Latte-Dock 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, see . -*/ - -import QtQuick 2.7 - -import org.kde.latte.abilities.items 0.1 as AbilityItem - -AbilityItem.IndicatorObject{ - id: indicatorBridge - animations: appletItem.animations - metrics: appletItem.metrics - indicatorsHost: indicators - - isApplet: true - - isActive: appletItem.isActive - isHovered: appletItem.containsMouse - isSquare: appletItem.isSquare - - hasActive: isActive - - scaleFactor: appletItem.wrapper.zoomScale - panelOpacity: root.background.currentOpacity - shadowColor: root.appShadowColorSolid - - palette: colorizerManager.applyTheme - - //!icon colors - iconBackgroundColor: isSquare ? appletItem.wrapper.overlayIconLoader.backgroundColor : colorizerManager.buttonFocusColor - iconGlowColor: isSquare ? appletItem.wrapper.overlayIconLoader.glowColor : colorizerManager.focusGlowColor -} diff --git a/containment/package/contents/ui/applet/indicator/LevelOptions.qml b/containment/package/contents/ui/applet/indicator/LevelOptions.qml deleted file mode 100644 index 8881f5d6a..000000000 --- a/containment/package/contents/ui/applet/indicator/LevelOptions.qml +++ /dev/null @@ -1,47 +0,0 @@ -/* -* Copyright 2019 Michail Vourlakos -* -* This file is part of Latte-Dock -* -* Latte-Dock 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. -* -* Latte-Dock 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, see . -*/ - -import QtQuick 2.7 - -Item { - id: level - - signal mousePressed(int x, int y, int button); - signal mouseReleased(int x, int y, int button); - - property bool isBackground: true - property bool isForeground: false - - property bool isDrawn: false - - readonly property Item requested: Item{ - property int iconOffsetX: 0 - property int iconOffsetY: 0 - } - - property Item bridge - - onIsBackgroundChanged: { - isForeground = !isBackground; - } - - onIsForegroundChanged: { - isBackground = !isForeground; - } -} diff --git a/containment/package/contents/ui/layouts/indicator/Bridge.qml b/containment/package/contents/ui/layouts/indicator/Bridge.qml deleted file mode 100644 index 6f78f0f1d..000000000 --- a/containment/package/contents/ui/layouts/indicator/Bridge.qml +++ /dev/null @@ -1,77 +0,0 @@ -/* -* Copyright 2019 Michail Vourlakos -* -* This file is part of Latte-Dock -* -* Latte-Dock 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. -* -* Latte-Dock 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, see . -*/ - -import QtQuick 2.7 - -Item{ - id: indicatorBridge - anchors.fill: parent - - readonly property bool active: true - - /* Indicators Properties in order use them*/ - readonly property bool isTask: false - readonly property bool isApplet: false - readonly property bool /*since 0.9.3*/ - - readonly property bool isLauncher: false - readonly property bool isStartup: false - readonly property bool isWindow: false - - readonly property bool isActive: false - readonly property bool isGroup: false - readonly property bool isHovered: false - readonly property bool isMinimized: false - readonly property bool isPressed: mainArea.pressed - readonly property bool inAttention: false - readonly property bool inRemoving: false - - readonly property bool isSquare: false - - readonly property bool hasActive: false - readonly property bool hasMinimized: false - readonly property bool hasShown: false - readonly property int windowsCount: 0 - readonly property int windowsMinimizedCount: 0 - - readonly property int currentIconSize: metrics.iconSize - readonly property int maxIconSize: metrics.maxIconSize - readonly property real scaleFactor: 1 - readonly property real panelOpacity: root.background.currentOpacity - readonly property color shadowColor: root.appShadowColorSolid - - readonly property bool animationsEnabled: animations.active - readonly property real durationTime: animations.speedFactor.current - - readonly property bool progressVisible: false /*since 0.9.2*/ - readonly property real progress: 0 /*since 0.9.2*/ - - readonly property int screenEdgeMargin: 0 /*since 0.10*/ - - readonly property QtObject palette: colorizerManager.applyTheme - - //!icon colors - property color iconBackgroundColor: "brown" - property color iconGlowColor: "pink" - - //! grouped options - readonly property Item shared: indicators - readonly property QtObject configuration: indicators.configuration - readonly property QtObject resources: indicators.resources -} diff --git a/containment/package/contents/ui/layouts/indicator/Loader.qml b/containment/package/contents/ui/layouts/indicator/Loader.qml deleted file mode 100644 index df73bc0ff..000000000 --- a/containment/package/contents/ui/layouts/indicator/Loader.qml +++ /dev/null @@ -1,41 +0,0 @@ -/* -* Copyright 2019 Michail Vourlakos -* -* This file is part of Latte-Dock -* -* Latte-Dock 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. -* -* Latte-Dock 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, see . -*/ - -import QtQuick 2.7 - -import org.kde.plasma.core 2.0 as PlasmaCore - -Loader { - id: indicatorLoader - anchors.fill: parent - - active: level.bridge && level.bridge.active && (level.isBackground || (level.isForeground && indicators.info.providesFrontLayer)) - sourceComponent: indicators.indicatorComponent - - //! Communications !// - - property Item level - - Connections { - target: mainArea - enabled: indicators.info.needsMouseEventCoordinates - onPressed: level.mousePressed(mouse.x, mouse.y, mouse.button); - onReleased: level.mouseReleased(mouse.x, mouse.y, mouse.button); - } -} diff --git a/declarativeimports/abilities/items/indicators/LevelOptions.qml b/declarativeimports/abilities/items/indicators/LevelOptions.qml index a6d2451dd..8081de75e 100644 --- a/declarativeimports/abilities/items/indicators/LevelOptions.qml +++ b/declarativeimports/abilities/items/indicators/LevelOptions.qml @@ -34,7 +34,7 @@ Item { property int iconOffsetY: 0 } - property Item bridge + property Item bridge: null onIsBackgroundChanged: { isForeground = !isBackground;