diff --git a/containment/package/contents/ui/applet/AppletHiddenSpacer.qml b/containment/package/contents/ui/applet/AppletHiddenSpacer.qml index f9942e51..e8888a6f 100644 --- a/containment/package/contents/ui/applet/AppletHiddenSpacer.qml +++ b/containment/package/contents/ui/applet/AppletHiddenSpacer.qml @@ -1,79 +1,81 @@ /* * Copyright 2016 Smith AR * 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.1 Item{ id: hiddenSpacer //we add one missing pixel from calculations width: root.isHorizontal ? nHiddenSize : wrapper.width height: root.isHorizontal ? wrapper.height : nHiddenSize ///check also if this is the first/last plasmoid in anylayout visible: (rightSpacer ? container.endEdge : container.startEdge) || separatorSpace>0 property bool neighbourSeparator: false; property int separatorSpace: neighbourSeparator && !container.isSeparator && !container.latteApplet ? (2+root.iconMargin/2) : 0 property real nHiddenSize: (nScale > 0) ? (container.spacersMaxSize * nScale) + separatorSpace : separatorSpace property bool rightSpacer: false property real nScale: 0 - Behavior on nScale { - enabled: !root.globalDirectRender + Behavior on nHiddenSize { + id: animatedBehavior + enabled: !root.globalDirectRender || restoreAnimation.running NumberAnimation { duration: 3 * container.animationTime } } - Behavior on nScale { - enabled: root.globalDirectRender && !restoreAnimation.running + Behavior on nHiddenSize { + id: directBehavior + enabled: !animatedBehavior.running NumberAnimation { duration: root.directRenderAnimationTime } } Connections{ target: root onSeparatorsUpdated: updateNeighbour(); } function updateNeighbour() { hiddenSpacer.neighbourSeparator = hiddenSpacer.rightSpacer ? parabolicManager.isSeparator(index+1) : parabolicManager.isSeparator(index-1) } Loader{ active: root.debugModeSpacers sourceComponent: Rectangle{ width: !root.isVertical ? hiddenSpacer.width : 1 height: !root.isVertical ? 1 : hiddenSpacer.height x: root.isVertical ? hiddenSpacer.width/2 : 0 y: !root.isVertical ? hiddenSpacer.height /2 : 0 border.width: 1 border.color: "red" color: "transparent" } } } diff --git a/plasmoid/package/contents/ui/task/TaskHiddenSpacer.qml b/plasmoid/package/contents/ui/task/TaskHiddenSpacer.qml index 776ea687..2359e332 100644 --- a/plasmoid/package/contents/ui/task/TaskHiddenSpacer.qml +++ b/plasmoid/package/contents/ui/task/TaskHiddenSpacer.qml @@ -1,134 +1,136 @@ /* * Copyright 2016 Smith AR * 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.0 import org.kde.latte 0.1 as Latte Item{ id: hiddenSpacer //we add one missing pixel from calculations width: root.vertical ? wrapper.width : nHiddenSize height: root.vertical ? nHiddenSize : wrapper.height visible: (rightSpacer ? index === parabolicManager.lastRealTaskIndex : index === parabolicManager.firstRealTaskIndex) || (separatorSpace > 0) || mainItemContainer.inAttentionAnimation || mainItemContainer.inFastRestoreAnimation || mainItemContainer.inMimicParabolicAnimation property bool neighbourSeparator: false //in case there is a neighbour separator, lastValidIndex is used in order to protect from false //when the task is removed property int indexUsed: index === -1 ? lastValidIndex : index //fix #846,empty tasks after activity changes //in some cases after activity changes some tasks //are shown empty because some ghost tasks are created. //This was tracked down to hidden TaskDelegates spacers. //the flag !root.inActivityChange protects from this //and it is used later on Behaviors in order to not break //the activity change animations from removal/additions of tasks property int separatorSpace: neighbourSeparator && !isSeparator && !(parabolicManager.hasInternalSeparator && root.dragSource) && !root.inActivityChange ? //fix for #846 - (2+root.iconMargin/2) : 0 + (2+root.iconMargin/2) : 0 property bool rightSpacer: false property real nHiddenSize: { if (!inAttentionAnimation && !inMimicParabolicAnimation && !inFastRestoreAnimation) { return (nScale > 0) ? (mainItemContainer.spacersMaxSize * nScale) + separatorSpace : separatorSpace; } else { return (nScale > 0) ? (root.iconSize * nScale) + separatorSpace : separatorSpace; } } property real nScale: 0 function updateNeighbour() { //index===-1 indicates that this item is removed if (root.editMode) { neighbourSeparator = false; } else if (latteDock && index!==-1) { if (!rightSpacer) { neighbourSeparator = (parabolicManager.taskIsSeparator(itemIndex-1) && !isSeparator && itemIndex!==parabolicManager.firstRealTaskIndex) || (latteDock.parabolicManager.isSeparator(latteDock.latteAppletPos-1) && parabolicManager.firstRealTaskIndex === itemIndex); } else { neighbourSeparator = (parabolicManager.taskIsSeparator(itemIndex+1) && !isSeparator && itemIndex!==parabolicManager.lastRealTaskIndex) || (latteDock.parabolicManager.isSeparator(latteDock.latteAppletPos+1) && parabolicManager.lastRealTaskIndex === itemIndex ); } /* if (launcherUrl.indexOf("kwrite") > -1 || launcherUrl.indexOf("dolphin") > -1 ) { var spacerName = "left"; if (rightSpacer) spacerName = "right"; console.log(launcherUrl +":" + itemIndex +"," + spacerName + " _-_- " +neighbourSeparator); }*/ } } Connections{ target: root onEditModeChanged: hiddenSpacer.updateNeighbour(); onLatteDockChanged: hiddenSpacer.updateNeighbour(); // onInternalSeparatorHiddenChanged: hiddenSpacer.updateNeighbour(); onSeparatorsUpdated: hiddenSpacer.updateNeighbour(); } Connections{ target: latteDock onSeparatorsUpdated: hiddenSpacer.updateNeighbour(); onLatteAppletPosChanged: hiddenSpacer.updateNeighbour(); } Connections{ target: mainItemContainer onItemIndexChanged: hiddenSpacer.updateNeighbour(); } Component.onCompleted: hiddenSpacer.updateNeighbour(); - - Behavior on separatorSpace { - enabled: mainItemContainer.inFastRestoreAnimation || showWindowAnimation.running || root.inActivityChange + Behavior on nHiddenSize { + id: animatedBehavior + enabled: (mainItemContainer.inFastRestoreAnimation || showWindowAnimation.running || restoreAnimation.running + || root.inActivityChange || mainItemContainer.inRemoveStage) + || (mainItemContainer.containsMouse && inAttentionAnimation && wrapper.mScale!==root.zoomFactor) NumberAnimation{ duration: 3 * mainItemContainer.animationTime } } - Behavior on separatorSpace { - enabled: !mainItemContainer.inFastRestoreAnimation && !showWindowAnimation.running - && !restoreAnimation.running && !root.inActivityChange + Behavior on nHiddenSize { + id: directBehavior + enabled: !animatedBehavior.running NumberAnimation { duration: root.directRenderAnimationTime } } Loader{ active: latteDock && latteDock.debugModeSpacers sourceComponent: Rectangle{ width: !root.vertical ? hiddenSpacer.width : 1 height: !root.vertical ? 1 : hiddenSpacer.height x: root.vertical ? hiddenSpacer.width/2 : 0 y: !root.vertical ? hiddenSpacer.height/2 : 0 border.width: 1 border.color: "red" color: "transparent" } } } diff --git a/plasmoid/package/contents/ui/task/TaskWrapper.qml b/plasmoid/package/contents/ui/task/TaskWrapper.qml index a6d250ea..cde04fdf 100644 --- a/plasmoid/package/contents/ui/task/TaskWrapper.qml +++ b/plasmoid/package/contents/ui/task/TaskWrapper.qml @@ -1,336 +1,342 @@ /* * Copyright 2016 Smith AR * 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.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.latte 0.1 as Latte Item{ id: wrapper opacity: 0 width: { if (!mainItemContainer.visible) return 0; if (mainItemContainer.isSeparator){ if (!root.vertical) return 0; //5 + root.widthMargins; else return (root.iconSize + root.widthMargins) + root.statesLineSize; } if (mainItemContainer.isStartup && root.durationTime !==0 ) { var moreThickness = root.vertical ? addedSpace : 0; return cleanScalingWidth + moreThickness; } else { return showDelegateWidth; } } height: { if (!mainItemContainer.visible) return 0; if (mainItemContainer.isSeparator){ if (root.vertical) return 0; //5 + root.heightMargins; else return (root.iconSize + root.heightMargins) + root.statesLineSize; } if (mainItemContainer.isStartup && root.durationTime !==0){ var moreThickness = !root.vertical ? addedSpace : 0; return cleanScalingHeight + moreThickness; } else { return showDelegateheight; } } //size needed fom the states below icons //property int statesLineSize: root.statesLineSize property int addedSpace: root.statesLineSize //7 property int maxThickness: !root.vertical ? addedSpace + root.zoomFactor*(root.iconSize+root.heightMargins) : addedSpace + root.zoomFactor*(root.iconSize+root.widthMargins) property real showDelegateWidth: root.vertical ? basicScalingWidth+addedSpace : basicScalingWidth property real showDelegateheight: root.vertical ? basicScalingHeight : basicScalingHeight + addedSpace //scales which are used mainly for activating InLauncher ////Scalers/////// property bool inTempScaling: ((tempScaleWidth !== 1) || (tempScaleHeight !== 1) ) property real mScale: 1 property real tempScaleWidth: 1 property real tempScaleHeight: 1 property real scaleWidth: (inTempScaling == true) ? tempScaleWidth : mScale property real scaleHeight: (inTempScaling == true) ? tempScaleHeight : mScale property real cleanScalingWidth: (root.iconSize + root.widthMargins) * mScale property real cleanScalingHeight: (root.iconSize + root.heightMargins) * mScale property real basicScalingWidth : (inTempScaling == true) ? ((root.iconSize + root.widthMargins) * scaleWidth) : cleanScalingWidth property real basicScalingHeight : (inTempScaling == true) ? ((root.iconSize + root.heightMargins) * scaleHeight) : cleanScalingHeight property real regulatorWidth: mainItemContainer.isSeparator ? width : basicScalingWidth; property real regulatorHeight: mainItemContainer.isSeparator ? height : basicScalingHeight; /// end of Scalers/////// //property int curIndex: icList.hoveredIndex // property int index: mainItemContainer.Positioner.index //property real center: (width + hiddenSpacerLeft.separatorSpace + hiddenSpacerRight.separatorSpace) / 2 property real center: (width + hiddenSpacerLeft.nHiddenSize + hiddenSpacerRight.nHiddenSize) / 2 property Item titleTooltipVisualParent: taskIconItem.titleTooltipVisualParent property Item previewsTooltipVisualParent: taskIconItem.previewsTootipVisualParent signal runLauncherAnimation(); /* Rectangle{ anchors.fill: parent border.width: 1 border.color: "green" color: "transparent" }*/ Behavior on mScale { enabled: !root.globalDirectRender || inMimicParabolicAnimation NumberAnimation{ duration: 3 * mainItemContainer.animationTime easing.type: Easing.OutCubic } } Behavior on mScale { enabled: root.globalDirectRender && !inMimicParabolicAnimation && !restoreAnimation.running NumberAnimation { duration: root.directRenderAnimationTime } } Flow{ anchors.bottom: (root.position === PlasmaCore.Types.BottomPositioned) ? parent.bottom : undefined anchors.top: (root.position === PlasmaCore.Types.TopPositioned) ? parent.top : undefined anchors.left: (root.position === PlasmaCore.Types.LeftPositioned) ? parent.left : undefined anchors.right: (root.position === PlasmaCore.Types.RightPositioned) ? parent.right : undefined anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : undefined anchors.verticalCenter: root.vertical ? parent.verticalCenter : undefined width: wrapper.width height: wrapper.height flow: root.vertical ? Flow.TopToBottom : Flow.LeftToRight Loader{ id: firstIndicator active:( (((root.position === PlasmaCore.Types.TopPositioned) || (root.position === PlasmaCore.Types.LeftPositioned)) && !root.reverseLinesPosition) || (((root.position === PlasmaCore.Types.BottomPositioned) || (root.position === PlasmaCore.Types.RightPositioned)) && root.reverseLinesPosition) ) visible: active sourceComponent: Component{ TaskGroupItem{} } } //! This is used from bouncing attention animation in order to played correctly Loader{ id: firstPadding active: secondIndicator.active && !root.reverseLinesPosition && (mainItemContainer.inAttentionAnimation || mainItemContainer.inFastRestoreAnimation) visible: active sourceComponent: Component{ Item{ width: root.vertical ? wrapper.maxThickness-wrapper.width : 1 height: !root.vertical ? wrapper.maxThickness-wrapper.height : 1 /* Rectangle{ width: !root.vertical ? 1 : parent.width height: !root.vertical ? parent.height : 1 x: !root.vertical ? wrapper.width /2 : 0 y: root.vertical ? wrapper.height /2 : 0 border.width: 1 border.color: "blue" color: "transparent" } */ } } } TaskIconItem{ id: taskIconItem} //! This is used from bouncing attention animation in order to played correctly Loader{ id: secondPadding active: firstIndicator.active && !root.reverseLinesPosition && (mainItemContainer.inAttentionAnimation || mainItemContainer.inFastRestoreAnimation) visible: active sourceComponent: Component{ Item{ width: root.vertical ? wrapper.maxThickness-wrapper.width : 1 height: !root.vertical ? wrapper.maxThickness-wrapper.height : 1 /*Rectangle{ width: !root.vertical ? 1 : parent.width height: !root.vertical ? parent.height : 1 x: !root.vertical ? wrapper.width/2 : 0 y: root.vertical ? wrapper.height/2 : 0 border.width: 1 border.color: "blue" color: "transparent" }*/ } } } Loader{ id: secondIndicator active: !firstIndicator.active visible: active sourceComponent: Component{ TaskGroupItem{} } } }//Flow function calculateScales( currentMousePosition ){ if (root.editMode || root.zoomFactor===1 || root.durationTime===0) { return; } var distanceFromHovered = Math.abs(index - icList.hoveredIndex); // A new algorithm tryig to make the zoom calculation only once // and at the same time fixing glitches if ((distanceFromHovered === 0) && //! IMPORTANT: IS FIXING A BUG THAT NEGATIVE VALUES ARE SENT onEntered EVENT OF MOUSEAREA // (currentMousePosition>=0) && (root.dragSource === null) ){ //use the new parabolicManager in order to handle all parabolic effect messages var scales = parabolicManager.applyParabolicEffect(index, currentMousePosition, center); //Left hiddenSpacer for first task if(((index === parabolicManager.firstRealTaskIndex )&&(root.tasksCount>0)) && !root.disableLeftSpacer && !inMimicParabolicAnimation && !inFastRestoreAnimation && !inAttentionAnimation){ hiddenSpacerLeft.nScale = scales.leftScale - 1; } //Right hiddenSpacer for last task if(((index === parabolicManager.lastRealTaskIndex )&&(root.tasksCount>0)) && !root.disableRightSpacer && !inMimicParabolicAnimation && !inFastRestoreAnimation && !inAttentionAnimation){ hiddenSpacerRight.nScale = scales.rightScale - 1; } - if (!mainItemContainer.inAttentionAnimation) + if (!mainItemContainer.inAttentionAnimation) { mScale = root.zoomFactor; + } else { + var subSpacerScale = (root.zoomFactor-1)/2; + + hiddenSpacerLeft.nScale = subSpacerScale; + hiddenSpacerRight.nScale = subSpacerScale; + } mainItemContainer.scalesUpdatedOnce = false; } } //nScale function signalUpdateScale(nIndex, nScale, step){ if (!mainItemContainer.containsMouse && (index === nIndex) && (mainItemContainer.hoverEnabled || inMimicParabolicAnimation)&&(waitingLaunchers.length===0)){ if (mainItemContainer.inAttentionAnimation) { var subSpacerScale = (nScale-1)/2; hiddenSpacerLeft.nScale = subSpacerScale; hiddenSpacerRight.nScale = subSpacerScale; } else if (!inBlockingAnimation || mainItemContainer.inMimicParabolicAnimation) { var newScale = 1; if(nScale >= 0) { newScale = nScale + step; } else { newScale = mScale + step; } if (inMimicParabolicAnimation && mimicParabolicScale === -1) { mimicParabolicScale = newScale; } mScale = newScale; } } } function sendEndOfNeedBothAxisAnimation(){ if (mainItemContainer.isZoomed) { mainItemContainer.isZoomed = false; root.signalAnimationsNeedBothAxis(-1); } } onMScaleChanged: { if ((mScale === root.zoomFactor) && !root.directRenderTimerIsRunning && !root.globalDirectRender) { root.setGlobalDirectRender(true); } if (inMimicParabolicAnimation){ if (mScale >= mimicParabolicScale) { inMimicParabolicAnimation = false; inAnimation = false; inBlockingAnimation = false; mimicParabolicScale = -1; } else { var tempScale = (root.zoomFactor - mScale) / 2; hiddenSpacerLeft.nScale = tempScale; hiddenSpacerRight.nScale = tempScale; } } if ((mScale > 1) && !mainItemContainer.isZoomed) { mainItemContainer.isZoomed = true; root.signalAnimationsNeedBothAxis(1); } else if ((mScale == 1) && mainItemContainer.isZoomed) { sendEndOfNeedBothAxisAnimation(); } } Component.onCompleted: { if (!Latte.WindowSystem.compositingActive) { opacity = 1; } root.updateScale.connect(signalUpdateScale); } Component.onDestruction: { root.updateScale.disconnect(signalUpdateScale); } }// Main task area // id:wrapper