Warning, /plasma/latte-dock/plasmoid/package/contents/ui/task/animations/LauncherAnimation.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 ////bouncing task, e.g. on launcher activating and when a new window is
0012 ////added in a group task
0013 Item{
0014 id:launcherAnimation
0015 property bool launchedAlready: false
0016 property int speed: 0.9 * taskItem.abilities.animations.speedFactor.current * taskItem.abilities.animations.duration.large
0017
0018 readonly property bool running: launcherAnimationLoader.item ? launcherAnimationLoader.item.running : false
0019 readonly property bool paused: launcherAnimationLoader.active ? launcherAnimationLoader.item.paused : false
0020
0021 readonly property string needThicknessEvent: launcherAnimation + "_launcher"
0022
0023 Loader {
0024 id: launcherAnimationLoader
0025 source: "launcher/BounceAnimation.qml"
0026 }
0027
0028 Connections {
0029 target: launcherAnimationLoader.item
0030
0031 onStopped: {
0032 if (!taskItem.inRemoveStage) {
0033 taskItem.inBouncingAnimation = false;
0034 tasksExtendedManager.removeWaitingLauncher(taskItem.launcherUrl);
0035 }
0036
0037 taskItem.abilities.parabolic.setDirectRenderingEnabled(false);
0038 clearAnimationsSignals();
0039
0040 taskItem.setBlockingAnimation(false);
0041 taskItem.animationEnded();
0042 }
0043 }
0044
0045 Binding {
0046 target: taskItem
0047 property: "isLauncherBuiltinAnimationRunning"
0048 value: running
0049 }
0050
0051 function clearAnimationsSignals() {
0052 if ( launchedAlready && root.noTasksInAnimation>0 ) {
0053 root.noTasksInAnimation--;
0054 }
0055
0056 if ( launchedAlready ) {
0057 taskItem.abilities.animations.needThickness.removeEvent(needThicknessEvent);
0058 }
0059
0060 launchedAlready = false;
0061 }
0062
0063 function init(){
0064 //console.log ("Nooo 1 : "+root.noTasksInAnimation);
0065 if(!launchedAlready) {
0066 taskItem.abilities.parabolic.invkClearZoom();
0067 launchedAlready = true;
0068 taskItem.abilities.animations.needThickness.addEvent(needThicknessEvent);
0069
0070 taskItem.abilities.parabolic.setDirectRenderingEnabled(false);
0071
0072 root.noTasksInAnimation++;
0073 taskItem.inBouncingAnimation = true;
0074 taskItem.setBlockingAnimation(true);
0075
0076 //trying to fix the ListView nasty behavior
0077 //during the removal the anchoring for ListView children changes a lot
0078 var previousTask = icList.childAtIndex(taskItem.lastValidIndex-1);
0079 if (previousTask !== undefined && !previousTask.isStartup && !previousTask.inBouncingAnimation){
0080 if (root.vertical) {
0081 taskItem.anchors.top = previousTask.bottom;
0082 } else {
0083 taskItem.anchors.left = previousTask.right;
0084 }
0085 }
0086 }
0087 }
0088
0089 function startLauncherAnimation(){
0090 if (taskItem.abilities.indicators.info.providesTaskLauncherAnimation) {
0091 return;
0092 }
0093
0094 if(root.launcherBouncingEnabled) {
0095 taskItem.animationStarted();
0096 init();
0097 launcherAnimationLoader.item.start();
0098 } else {
0099 launcherAnimationLoader.item.stop();
0100 }
0101 }
0102
0103
0104 Component.onCompleted: {
0105 taskItem.taskLauncherActivated.connect(startLauncherAnimation);
0106 }
0107
0108 Component.onDestruction: {
0109 clearAnimationsSignals();
0110 taskItem.taskLauncherActivated.disconnect(startLauncherAnimation);
0111 }
0112 }
0113 /////////////////// end of launcher animation