From cfd79ae713789883684a6df476cd1b3e41372b7e Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 5 May 2020 20:49:08 +0300 Subject: [PATCH] fixes for ParabolicEffect Ability --- .../contents/ui/abilities/ParabolicEffect.qml | 9 +------ containment/package/contents/ui/main.qml | 1 + .../abilities/applets/ParabolicEffect.qml | 2 ++ .../abilities/bridge/ParabolicEffect.qml | 8 +++++- .../abilities/containers/ParabolicEffect.qml | 12 +++++++++ .../abilities/definitions/ParabolicEffect.qml | 5 ++++ .../paraboliceffect/PrivateProperties.qml | 25 +++++++++++++++++++ 7 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 declarativeimports/abilities/definitions/paraboliceffect/PrivateProperties.qml diff --git a/containment/package/contents/ui/abilities/ParabolicEffect.qml b/containment/package/contents/ui/abilities/ParabolicEffect.qml index 4ff8e41c8..25a9fec69 100644 --- a/containment/package/contents/ui/abilities/ParabolicEffect.qml +++ b/containment/package/contents/ui/abilities/ParabolicEffect.qml @@ -31,19 +31,12 @@ ContainerAbility.ParabolicEffect { property Item animations: null property Item appletsRecords: null - property Item view: null + property QtObject view: null factor.zoom: LatteCore.WindowSystem.compositingActive && animations.active ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1 factor.maxZoom: Math.max(factor.zoom, appletsRecords.maxInnerZoomFactor) readonly property bool horizontal: plasmoid.formFactor === PlasmaCore.Types.Horizontal - readonly property bool directRenderingEnabled: _privates.directRenderingEnabled - readonly property int lastIndex: _privates.lastIndex - - readonly property Item _privates: Item { - property bool directRenderingEnabled: false - property int lastIndex: -1 - } Connections { target: parabolic diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index 99c2a1c7c..6e57af70e 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -1579,6 +1579,7 @@ Item { Ability.ParabolicEffect { id: _parabolic animations: _animations + appletsRecords: _appletsRecords view: latteView } diff --git a/declarativeimports/abilities/applets/ParabolicEffect.qml b/declarativeimports/abilities/applets/ParabolicEffect.qml index 3cfea02b0..d680cc44c 100644 --- a/declarativeimports/abilities/applets/ParabolicEffect.qml +++ b/declarativeimports/abilities/applets/ParabolicEffect.qml @@ -27,6 +27,8 @@ AbilityDefinition.ParabolicEffect { readonly property bool isActive: bridge !== null factor: ref.parabolic.factor + directRenderingEnabled: ref.parabolic.directRenderingEnabled + lastIndex: local.lastIndex /*special property that needs to remain the same*/ readonly property AbilityDefinition.ParabolicEffect local: AbilityDefinition.ParabolicEffect {} diff --git a/declarativeimports/abilities/bridge/ParabolicEffect.qml b/declarativeimports/abilities/bridge/ParabolicEffect.qml index 3de6490f7..7a87a5088 100644 --- a/declarativeimports/abilities/bridge/ParabolicEffect.qml +++ b/declarativeimports/abilities/bridge/ParabolicEffect.qml @@ -36,6 +36,12 @@ Item { host.sglUpdateHigherItemScale(appletIndex+1, newScale, step); } + /*Be Careful, needs to be considered how to not create + endless recursion because each one calls the other. + If applet in inside a container and as such is using + a parabolic host then the parabolic host clearZoom signal + should be called when needed. + Connections { target: client ? client : null onSglClearZoom: { @@ -43,7 +49,7 @@ Item { parabolicBridge.host.sglClearZoom(); } } - } + }*/ Connections { target: host ? host : null diff --git a/declarativeimports/abilities/containers/ParabolicEffect.qml b/declarativeimports/abilities/containers/ParabolicEffect.qml index 763c6c740..e023e6117 100644 --- a/declarativeimports/abilities/containers/ParabolicEffect.qml +++ b/declarativeimports/abilities/containers/ParabolicEffect.qml @@ -25,6 +25,18 @@ AbilityDefinition.ParabolicEffect { id: apis readonly property Item publicApi: Item { + readonly property alias directRenderingEnabled: apis.directRenderingEnabled readonly property alias factor: apis.factor + readonly property alias lastIndex: apis.lastIndex + + signal sglClearZoom(); + } + + Component.onCompleted: { + apis.sglClearZoom.connect(publicApi.sglClearZoom) + } + + Component.onDestruction: { + apis.sglClearZoom.disconnect(publicApi.sglClearZoom) } } diff --git a/declarativeimports/abilities/definitions/ParabolicEffect.qml b/declarativeimports/abilities/definitions/ParabolicEffect.qml index 588c53ca3..55e48c3c4 100644 --- a/declarativeimports/abilities/definitions/ParabolicEffect.qml +++ b/declarativeimports/abilities/definitions/ParabolicEffect.qml @@ -24,6 +24,11 @@ import "./paraboliceffect" as ParabolicEffectTypes Item { property ParabolicEffectTypes.Factor factor: ParabolicEffectTypes.Factor{} + readonly property bool directRenderingEnabled: _privates.directRenderingEnabled + readonly property int lastIndex: _privates.lastIndex + + readonly property ParabolicEffectTypes.PrivateProperties _privates: ParabolicEffectTypes.PrivateProperties {} + signal sglClearZoom(); signal sglUpdateLowerItemScale(int delegateIndex, real newScale, real step); signal sglUpdateHigherItemScale(int delegateIndex, real newScale, real step); diff --git a/declarativeimports/abilities/definitions/paraboliceffect/PrivateProperties.qml b/declarativeimports/abilities/definitions/paraboliceffect/PrivateProperties.qml new file mode 100644 index 000000000..4484744ac --- /dev/null +++ b/declarativeimports/abilities/definitions/paraboliceffect/PrivateProperties.qml @@ -0,0 +1,25 @@ +/* +* Copyright 2020 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 { + property bool directRenderingEnabled: false + property int lastIndex: -1 +}