From 7cd1ae4ba74e0816d7262909f18aae7de4be7a79 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sun, 1 Jan 2017 11:25:40 +0200 Subject: [PATCH] improve mechanism for animations counting --- containment/contents/ui/AppletItem.qml | 4 +- containment/contents/ui/EditModeVisual.qml | 6 +-- containment/contents/ui/VisibilityManager.qml | 8 ++-- containment/contents/ui/main.qml | 30 ++++++++----- plasmoid/contents/ui/TaskDelegate.qml | 13 +++--- plasmoid/contents/ui/TaskIconItem.qml | 8 ++-- plasmoid/contents/ui/main.qml | 42 ------------------- 7 files changed, 38 insertions(+), 73 deletions(-) diff --git a/containment/contents/ui/AppletItem.qml b/containment/contents/ui/AppletItem.qml index fc35284aa..722360fd0 100644 --- a/containment/contents/ui/AppletItem.qml +++ b/containment/contents/ui/AppletItem.qml @@ -359,13 +359,13 @@ Item { if ((zoomScale > 1) && !container.isZoomed) { container.isZoomed = true; if (!root.editMode && !animationWasSent) { - root.appletsAnimations++; + root.slotAppletsAnimations(1); animationWasSent = true; } } else if ((zoomScale == 1) && container.isZoomed) { container.isZoomed = false; if (!root.editMode && animationWasSent) { - root.appletsAnimations--; + root.slotAppletsAnimations(-1); animationWasSent = false; } } diff --git a/containment/contents/ui/EditModeVisual.qml b/containment/contents/ui/EditModeVisual.qml index 0db089660..7b4eb39a1 100644 --- a/containment/contents/ui/EditModeVisual.qml +++ b/containment/contents/ui/EditModeVisual.qml @@ -94,8 +94,7 @@ Image{ if(!animationSent) { animationSent = true; - var anim = root.animationsNeedLength+1; - root.slotAnimationsNeedLength(anim); + root.slotAnimationsNeedLength(1); } } } @@ -153,8 +152,7 @@ Image{ script:{ editVisual.editAnimationEnded = false; if (editVisual.animationSent) { - var anim = root.animationsNeedLength-1; - root.slotAnimationsNeedLength(anim); + root.slotAnimationsNeedLength(-1); editVisual.animationSent = false; } } diff --git a/containment/contents/ui/VisibilityManager.qml b/containment/contents/ui/VisibilityManager.qml index 56ac8e4ca..5d8509138 100644 --- a/containment/contents/ui/VisibilityManager.qml +++ b/containment/contents/ui/VisibilityManager.qml @@ -106,10 +106,10 @@ Item{ && (!mainLayout.animatedLength) // debug maskArea criteria - //console.log(root.nowDockHoveredIndex + ", " + layoutsContainer.hoveredIndex + ", " - // + root.appletsAnimations+ ", " - // + root.animationsNeedBothAxis + ", " + root.animationsNeedLength + ", " + root.animationsNeedThickness +", " - // + mainLayout.animatedLength); + console.log(root.nowDockHoveredIndex + ", " + layoutsContainer.hoveredIndex + ", " + + root.appletsAnimations+ ", " + + root.animationsNeedBothAxis + ", " + root.animationsNeedLength + ", " + root.animationsNeedThickness +", " + + mainLayout.animatedLength); var tempLength = root.isHorizontal ? width : height; var tempThickness = root.isHorizontal ? height : width; diff --git a/containment/contents/ui/main.qml b/containment/contents/ui/main.qml index a144973a7..4b1631d6c 100644 --- a/containment/contents/ui/main.qml +++ b/containment/contents/ui/main.qml @@ -388,7 +388,7 @@ DragDrop.DropArea { //////////////START OF CONNECTIONS //this is used from zoomed applets in that container - onAppletsAnimationsChanged: visibilityManager.updateMaskArea(); + //onAppletsAnimationsChanged: visibilityManager.updateMaskArea(); onEditModeChanged: { if (editMode) { @@ -804,32 +804,42 @@ DragDrop.DropArea { return false; } - function slotAnimationsNeedBothAxis(value) { - if (animationsNeedBothAxis === value) { + function slotAnimationsNeedBothAxis(step) { + if (step === 0) { return; } - animationsNeedBothAxis = Math.max(value, 0); + animationsNeedBothAxis = Math.max(animationsNeedBothAxis + step, 0); visibilityManager.updateMaskArea(); } - function slotAnimationsNeedLength(value) { - if (animationsNeedLength === value) { + function slotAnimationsNeedLength(step) { + if (step === 0) { return; } - animationsNeedLength = Math.max(value, 0); + animationsNeedLength = Math.max(animationsNeedLength + step, 0); visibilityManager.updateMaskArea(); } - function slotAnimationsNeedThickness(value) { - if (animationsNeedThickness === value) { + function slotAnimationsNeedThickness(step) { + if (step === 0) { return; } - animationsNeedThickness = Math.max(value, 0); + animationsNeedThickness = Math.max(animationsNeedThickness + step, 0); + + visibilityManager.updateMaskArea(); + } + + function slotAppletsAnimations(step) { + if (step === 0) { + return; + } + + appletsAnimations = Math.max(appletsAnimations + step, 0); visibilityManager.updateMaskArea(); } diff --git a/plasmoid/contents/ui/TaskDelegate.qml b/plasmoid/contents/ui/TaskDelegate.qml index 1b5b6dc68..0311bf029 100644 --- a/plasmoid/contents/ui/TaskDelegate.qml +++ b/plasmoid/contents/ui/TaskDelegate.qml @@ -378,14 +378,14 @@ MouseArea{ function sendEndOfNeedBothAxisAnimation(){ if (mainItemContainer.isZoomed) { mainItemContainer.isZoomed = false; - panel.setAnimationsNeedBothAxis(-1); + panel.signalAnimationsNeedBothAxis(-1); } } onScaleChanged: { if ((scale > 1) && !mainItemContainer.isZoomed) { mainItemContainer.isZoomed = true; - panel.setAnimationsNeedBothAxis(1); + panel.signalAnimationsNeedBothAxis(1); } else if ((scale == 1) && mainItemContainer.isZoomed) { sendEndOfNeedBothAxisAnimation(); } @@ -918,7 +918,7 @@ MouseArea{ mainItemContainer.inAnimation = false; if (isWindow || isStartup) { - panel.setAnimationsNeedLength(-1); + panel.signalAnimationsNeedLength(-1); } } @@ -927,7 +927,7 @@ MouseArea{ wrapper.tempScaleHeight = 0; if (isWindow || isStartup) { - panel.setAnimationsNeedLength(1); + panel.signalAnimationsNeedLength(1); } } @@ -1042,6 +1042,7 @@ MouseArea{ ///Item's Removal Animation ListView.onRemove: SequentialAnimation { + ScriptAction{script:{panel.signalAnimationsNeedLength(1)}} PropertyAction { target: mainItemContainer; property: "ListView.delayRemove"; value: true } PropertyAction { target: mainItemContainer; property: "inAnimation"; value: true } PropertyAction { target: icList; property: "delayingRemoval"; value: true } @@ -1076,9 +1077,7 @@ MouseArea{ PropertyAction { target: mainItemContainer; property: "inAnimation"; value: false } PropertyAction { target: mainItemContainer; property: "ListView.delayRemove"; value: false } PropertyAction { target: icList; property: "delayingRemoval"; value: false } - - onStarted: panel.setAnimationsNeedLength(+1); - onStopped: panel.setAnimationsNeedLength(-1); + ScriptAction{script:{panel.signalAnimationsNeedLength(-1)}} } }// main Item diff --git a/plasmoid/contents/ui/TaskIconItem.qml b/plasmoid/contents/ui/TaskIconItem.qml index bf576e3b1..90fd2ee4e 100644 --- a/plasmoid/contents/ui/TaskIconItem.qml +++ b/plasmoid/contents/ui/TaskIconItem.qml @@ -475,7 +475,7 @@ Item{ } if ( launchedAlready ) { - panel.setAnimationsNeedThickness(-1); + panel.signalAnimationsNeedThickness(-1); } launchedAlready = false; @@ -485,7 +485,7 @@ Item{ //console.log ("Nooo 1 : "+panel.noTasksInAnimation); if(!launchedAlready) { launchedAlready = true; - panel.setAnimationsNeedThickness(1); + panel.signalAnimationsNeedThickness(1); panel.noTasksInAnimation++; mainItemContainer.setBlockingAnimation(true); } @@ -582,7 +582,7 @@ Item{ function sendEndOfNeedThicknessAnimation(){ if (needsThicknessSent) { needsThicknessSent = false; - panel.setAnimationsNeedThickness(-1); + panel.signalAnimationsNeedThickness(-1); } } @@ -597,7 +597,7 @@ Item{ if (!needsThicknessSent) { needsThicknessSent = true; - panel.setAnimationsNeedThickness(1); + panel.signalAnimationsNeedThickness(1); } // icList.hoveredIndex = -1; diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml index 4e0c74d13..4d7d7a764 100644 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -66,9 +66,6 @@ Item { property bool vertical: ((panel.position === PlasmaCore.Types.LeftPositioned) || (panel.position === PlasmaCore.Types.RightPositioned)) ? true : false - property int animationsNeedBothAxis:0 //animations need space in both axes, e.g zooming a task - property int animationsNeedLength: 0 // animations need length, e.g. adding a task - property int animationsNeedThickness: 0 // animations need thickness, e.g. bouncing animation property int clearWidth property int clearHeight @@ -164,45 +161,6 @@ Item { onGroupingLauncherUrlBlacklistChanged: tasksModel.groupingLauncherUrlBlacklist = plasmoid.configuration.groupingLauncherUrlBlacklist; } - function setAnimationsNeedBothAxis(step) { - if ((step === 0) || (plasmoid.configuration.durationTime ===0)) { - return; - } - - animationsNeedBothAxis = animationsNeedBothAxis + step; - if (animationsNeedBothAxis < 0) { - animationsNeedBothAxis = 0; - } - - signalAnimationsNeedBothAxis(animationsNeedBothAxis); - } - - function setAnimationsNeedLength(step) { - if ((step === 0) || (plasmoid.configuration.durationTime ===0)) { - return; - } - - animationsNeedLength = animationsNeedLength + step; - if (animationsNeedLength < 0) { - animationsNeedLength = 0; - } - - signalAnimationsNeedLength(animationsNeedLength); - } - - function setAnimationsNeedThickness(step) { - if ((step === 0) || (plasmoid.configuration.durationTime ===0)) { - return; - } - - animationsNeedThickness = animationsNeedThickness + step; - if (animationsNeedThickness < 0) { - animationsNeedThickness = 0; - } - - signalAnimationsNeedThickness(animationsNeedThickness); - } - ///// PlasmaCore.ColorScope{ id: colorScopePalette