From d4b785daf30bad88dcc1176145efa42f76594b05 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 23 May 2017 22:37:57 +0300 Subject: [PATCH] inform parabolicManager for separators and hidden --the parabolicManager is informed about the applet ids for hidden applets and separators. This way the manager can process the signals for parabolic effect much better and correctly --- .../package/contents/ui/ParabolicManager.qml | 58 +++++++++++++++++++ .../package/contents/ui/applet/AppletItem.qml | 42 ++++++++++++-- 2 files changed, 94 insertions(+), 6 deletions(-) diff --git a/containment/package/contents/ui/ParabolicManager.qml b/containment/package/contents/ui/ParabolicManager.qml index c789bde40..e63f7f786 100644 --- a/containment/package/contents/ui/ParabolicManager.qml +++ b/containment/package/contents/ui/ParabolicManager.qml @@ -28,6 +28,9 @@ import QtQuick 2.0 Item { id: parManager + property var hidden: [] + property var separators: [] + //!this is used in order to update the index when the signal is for the internal latte plasmoid function updateIdSendScale(appIndex, index, zScale, zStep){ if(root.latteApplet && ((appIndex=root.latteAppletPos) @@ -178,6 +181,61 @@ Item { for (var k=endClearStart; k>=endBeginIndex; --k) root.updateScale(k, 1, 0); } + } + + // update the registered separators + // -1, no = add separator + // no, -1 = remove separator + // no, no = update separator position + function setSeparator(previousId, nextId) { + if (previousId === nextId) + return; + + var update=false; + //should update + if (previousId>-1 && nextId>-1) + update=true; + + //remove + if ((previousId>-1 && nextId===-1) || update) { + var ind = separators.indexOf(previousId); + if (ind>-1) + separators.splice(ind,1); + } + + //add + if ((previousId===-1 && nextId>-1) || update) { + separators.push(nextId); + } + + //console.log("separators : "+separators); + } + + // update the registered hidden applets + // -1, no = add hidden + // no, -1 = remove hidden + // no, no = update hidden position + function setHidden(previousId, nextId) { + if (previousId === nextId) + return; + + var update=false; + //should update + if (previousId>-1 && nextId>-1) + update=true; + + //remove + if ((previousId>-1 && nextId===-1) || update) { + var ind = hidden.indexOf(previousId); + if (ind>-1) + hidden.splice(ind,1); + } + + //add + if ((previousId===-1 && nextId>-1) || update) { + hidden.push(nextId); + } + //console.log("hidden : "+hidden); } } diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index ed3364923..d27e59c38 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -56,8 +56,10 @@ Item { } property bool showZoomed: false property bool lockZoom: false + property bool isHidden: applet && applet.status === PlasmaCore.Types.HiddenStatus ? true : false property bool isInternalViewSplitter: (internalSplitterId > 0) property bool isZoomed: false + property bool isSeparator: applet && applet.pluginName === "audoban.applet.separator" ? true : false //applet is in starting edge /*property bool startEdge: index < layoutsContainer.endLayout.beginIndex ? (index === 0)&&(layoutsContainer.mainLayout.count > 1) : @@ -81,6 +83,7 @@ Item { property int maxHeight: root.isHorizontal ? root.height : root.width property int shownAppletMargin: applet && (applet.pluginName === "org.kde.plasma.systemtray") ? 0 : appletMargin property int internalSplitterId: 0 + property int previousIndex: -1 property int sizeForFill: -1 //it is used in calculations for fillWidth,fillHeight applets property int spacersMaxSize: Math.max(0,Math.ceil(0.55*root.iconSize) - root.iconMargin) property int status: applet ? applet.status : -1 @@ -140,12 +143,6 @@ Item { } } - onIndexChanged: { - if (container.latteApplet) { - root.latteAppletPos = index; - } - } - /// BEGIN functions function checkIndex(){ index = -1; @@ -255,6 +252,39 @@ Item { } } + onIndexChanged: { + if (container.latteApplet) { + root.latteAppletPos = index; + } + + if (isHidden) { + parabolicManager.setHidden(previousIndex, index); + } + + if (isSeparator) { + parabolicManager.setSeparator(previousIndex, index); + } + + previousIndex = index; + } + + onIsHiddenChanged: { + if (isHidden) { + parabolicManager.setHidden(-1, index); + } else { + parabolicManager.setHidden(index, -1); + } + } + + onIsSeparatorChanged: { + if (isSeparator) { + parabolicManager.setSeparator(-1, index); + } else { + parabolicManager.setSeparator(index, -1); + } + + } + onLatteAppletChanged: { if(container.latteApplet){ root.latteApplet = container.latteApplet;