Warning, /plasma/latte-dock/plasmoid/package/contents/ui/task/animations/ShowWindowAnimation.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2016 Smith AR <audoban@openmailbox.org>
0003 SPDX-FileCopyrightText: 2016 Michail Vourlakos <mvourlakos@gmail.com>
0004 SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006
0007 import QtQuick 2.0
0008
0009 import org.kde.plasma.plasmoid 2.0
0010
0011 import org.kde.latte.core 0.2 as LatteCore
0012
0013 ///item's added Animation
0014 SequentialAnimation{
0015 id:showWindowAnimation
0016 property int speed: root.newWindowSlidingEnabled ? (1.2 * taskItem.abilities.animations.speedFactor.normal * taskItem.abilities.animations.duration.large) : 0
0017 property bool animationSent: false
0018
0019 readonly property string needLengthEvent: showWindowAnimation + "_showwindow"
0020
0021 //Ghost animation that acts as a delayer, in order to fix #342
0022 PropertyAnimation {
0023 target: taskItem.parabolicItem
0024 property: "opacity"
0025 to: 0
0026 //it is not depend to durationTime when animations are active
0027 duration: root.newWindowSlidingEnabled ? 750 : 0
0028 easing.type: Easing.InQuad
0029 }
0030 //end of ghost animation
0031
0032 ScriptAction{
0033 script:{
0034 if (!showWindowAnimation.animationSent) {
0035 showWindowAnimation.animationSent = true;
0036 taskItem.abilities.animations.needLength.addEvent(needLengthEvent);
0037 }
0038 }
0039 }
0040
0041 PropertyAnimation {
0042 target: taskItem.parabolicItem
0043 property: "zoomLength"
0044 to: 1
0045 duration: showWindowAnimation.speed
0046 easing.type: Easing.OutQuad
0047 }
0048
0049 ParallelAnimation{
0050
0051 PropertyAnimation {
0052 target: taskItem.parabolicItem
0053 property: "zoomThickness"
0054 to: 1
0055 duration: showWindowAnimation.speed
0056 easing.type: Easing.OutQuad
0057 }
0058
0059
0060 PropertyAnimation {
0061 target: taskItem.parabolicItem
0062 property: "opacity"
0063 from: 0
0064 to: 1
0065 duration: showWindowAnimation.speed
0066 easing.type: Easing.OutQuad
0067 }
0068
0069 PropertyAnimation {
0070 target: taskItem
0071 property: taskItem.isVertical ? "iconAnimatedOffsetX" : "iconAnimatedOffsetY"
0072 from: -taskItem.abilities.metrics.iconSize
0073 to: 0
0074 duration: showWindowAnimation.speed
0075 easing.type: Easing.OutQuad
0076 }
0077 }
0078
0079 onStopped: {
0080 taskItem.inAddRemoveAnimation = false;
0081
0082 if (tasksExtendedManager.toBeAddedLauncherExists(taskItem.launcherUrl)) {
0083 tasksExtendedManager.removeToBeAddedLauncher(taskItem.launcherUrl);
0084 }
0085
0086 if(taskItem.isWindow || taskItem.isStartup){
0087 publishGeometryTimer.start();
0088 if (taskItem.isDemandingAttention){
0089 taskItem.taskGroupedWindowAdded();
0090 }
0091 }
0092 taskItem.inAnimation = false;
0093
0094 if (showWindowAnimation.animationSent) {
0095 taskItem.abilities.animations.needLength.removeEvent(needLengthEvent);
0096 showWindowAnimation.animationSent = false;
0097 }
0098 }
0099
0100 function execute(){
0101 //trying to fix the ListView nasty behavior
0102 //during the removal the anchoring for ListView children changes a lot
0103 if (isWindow){
0104 var previousTask = icList.childAtIndex(index-1);
0105 var nextTask = icList.childAtIndex(index+1);
0106 if (previousTask !== undefined && nextTask !== undefined && nextTask.inBouncingAnimation){
0107 if (root.vertical) {
0108 taskItem.anchors.top = previousTask.bottom;
0109 } else {
0110 taskItem.anchors.left = previousTask.right;
0111 }
0112 }
0113 }
0114
0115 var hasShownLauncher = ((tasksModel.launcherPosition(taskItem.launcherUrl) !== -1)
0116 || (tasksModel.launcherPosition(taskItem.launcherUrlWithIcon) !== -1) );
0117
0118 var launcherIsAlreadyShown = hasShownLauncher && isLauncher && !root.inActivityChange && !tasksExtendedManager.toBeAddedLauncherExists(taskItem.launcherUrl) ;
0119
0120 //Animation Add/Remove (2) - when is window with no launcher, animations enabled
0121 //Animation Add/Remove (3) - when is launcher with no window, animations enabled
0122 var animation2 = ((!hasShownLauncher || !taskItem.abilities.launchers.inCurrentActivity(taskItem.launcherUrl))
0123 && taskItem.isWindow
0124 && LatteCore.WindowSystem.compositingActive);
0125
0126 var animation3 = (!tasksExtendedManager.immediateLauncherExists(taskItem.launcherUrl)
0127 && taskItem.isLauncher
0128 && LatteCore.WindowSystem.compositingActive);
0129
0130 var activities = tasksModel.launcherActivities(taskItem.launcherUrl);
0131 var animation6 = (root.inActivityChange && taskItem.isWindow
0132 && activities.indexOf(activityInfo.currentActivity)>=0
0133 && activities.indexOf(activityInfo.previousActivity) === -1
0134 && LatteCore.WindowSystem.compositingActive);
0135
0136
0137 //startup without launcher, animation should be blocked
0138 var launcherExists = !(!hasShownLauncher || !taskItem.abilities.launchers.inCurrentActivity(taskItem.launcherUrl));
0139
0140 //var hideStartup = launcherExists && taskItem.isStartup; //! fix #976
0141 var hideWindow = (root.showWindowsOnlyFromLaunchers || root.disableAllWindowsFunctionality) && !launcherExists && taskItem.isWindow;
0142
0143 if (tasksExtendedManager.immediateLauncherExists(taskItem.launcherUrl) && taskItem.isLauncher) {
0144 tasksExtendedManager.removeImmediateLauncher(taskItem.launcherUrl);
0145 }
0146
0147 //if (hideStartup || hideWindow) { //fix #976
0148 if (hideWindow) {
0149 isForcedHidden = true;
0150 taskItem.visible = false;
0151 taskItem.parabolicItem.zoomLength = 0.0;
0152 taskItem.parabolicItem.zoomThickness = 0.0;
0153 taskItem.parabolicItem.opacity = 0;
0154 taskItem.inAnimation = false;
0155 } else if (!LatteCore.WindowSystem.compositingActive || root.inDraggingPhase
0156 || taskItem.isSeparator) {
0157 isForcedHidden = false;
0158 taskItem.visible = true;
0159 taskItem.parabolicItem.zoomLength = 1.0;
0160 taskItem.parabolicItem.zoomThickness = 1.0;
0161 taskItem.parabolicItem.zoom = 1;
0162 taskItem.parabolicItem.opacity = 1;
0163 taskItem.inAnimation = false;
0164 } else if (( animation2 || animation3 || animation6 || isForcedHidden)
0165 && (taskItem.abilities.animations.speedFactor.current !== 0) && !launcherIsAlreadyShown){
0166 isForcedHidden = false;
0167 taskItem.visible = true;
0168 taskItem.parabolicItem.zoomLength = 0.0;
0169 taskItem.parabolicItem.zoomThickness = 0.0;
0170 start();
0171 } else {
0172 isForcedHidden = false;
0173 var frozenTask = tasksExtendedManager.getFrozenTask(taskItem.launcherUrl);
0174
0175 if (frozenTask && frozenTask.zoom>1) {
0176 taskItem.parabolicItem.zoom = frozenTask.zoom;
0177 tasksExtendedManager.removeFrozenTask(taskItem.launcherUrl);
0178 } else {
0179 taskItem.parabolicItem.zoomLength = 1.0;
0180 taskItem.parabolicItem.zoomThickness = 1.0;
0181 }
0182
0183 //! by enabling it we break the bouncing animation and the indicators launchers animations
0184 //taskItem.visible = true;
0185 taskItem.parabolicItem.opacity = 1;
0186 taskItem.inAnimation = false;
0187 }
0188 }
0189
0190 function showWindow(){
0191 execute();
0192 }
0193
0194 Component.onDestruction: {
0195 if (animationSent){
0196 //console.log("SAFETY REMOVAL 2: animation removing ended");
0197 animationSent = false;
0198 taskItem.abilities.animations.needLength.removeEvent(needLengthEvent);
0199 }
0200 }
0201 }