fix #349,launch application on the start

--by taking account the libtaskmanager way of doing
things. Latte is trying to delay the removal of the
launcher in order for the animation to play correctly.
At the same time if a window or startup is added is
not shown if there is a waitingLauncher(animated launcher)
until this launcher completes its animation
pull/1/head
Michail Vourlakos 8 years ago
parent 5fb513faf4
commit 7a7b25a187

@ -33,7 +33,7 @@ import org.kde.latte 0.1 as Latte
MouseArea{
id: mainItemContainer
visible: true//(isStartup && root.durationTime !== 0) ? false : true
visible: false //true//(isStartup && root.durationTime !== 0) ? false : true
anchors.bottom: (root.position === PlasmaCore.Types.BottomPositioned) ? parent.bottom : undefined
anchors.top: (root.position === PlasmaCore.Types.TopPositioned) ? parent.top : undefined
@ -47,7 +47,8 @@ MouseArea{
wrapper.height
acceptedButtons: Qt.LeftButton | Qt.MidButton | Qt.RightButton
hoverEnabled: (inAnimation !== true)&& (!IsStartup)&&(!root.taskInAnimation)&&(!root.editMode || root.debugLocation)
hoverEnabled: visible && (inAnimation !== true) && (!IsStartup) && (!root.taskInAnimation)
&& (!root.editMode || root.debugLocation)&&(!inBouncingAnimation)
// hoverEnabled: false
property bool buffersAreReady: false
@ -59,6 +60,7 @@ MouseArea{
property bool inAddRemoveAnimation: true
property bool inAnimation: true
property bool inBlockingAnimation: false
property bool inBouncingAnimation: false
property bool inPopup: false
property bool isActive: (IsActive === true) ? true : false
@ -240,8 +242,25 @@ MouseArea{
id: wrapper
opacity: 0
width: (mainItemContainer.isStartup && root.durationTime !==0 ) ? cleanScalingWidth : showDelegateWidth
height: (mainItemContainer.isStartup && root.durationTime !==0) ? cleanScalingHeight : showDelegateheight
width: {
if (!mainItemContainer.visible)
return 0;
if (mainItemContainer.isStartup && root.durationTime !==0 )
return cleanScalingWidth;
else
return showDelegateWidth;
}
height: {
if (!mainItemContainer.visible)
return 0;
if (mainItemContainer.isStartup && root.durationTime !==0)
return cleanScalingHeight;
else
return showDelegateheight;
}
//size needed fom the states below icons
//property int statesLineSize: root.statesLineSize
@ -412,7 +431,8 @@ MouseArea{
function signalUpdateScale(nIndex, nScale, step){
if ((index === nIndex)&&(!mainItemContainer.inAnimation)){
//if ((index === nIndex)&&(!mainItemContainer.inAnimation)){
if ((index === nIndex)&&(mainItemContainer.hoverEnabled)){
if(nScale >= 0) {
mScale = nScale + step;
} else {
@ -909,6 +929,8 @@ MouseArea{
function launcherAction(){
// if ((lastButtonClicked == Qt.LeftButton)||(lastButtonClicked == Qt.MidButton)){
inBouncingAnimation = true;
root.addWaitingLauncher(mainItemContainer.launcherUrl);
tasksModel.requestActivate(modelIndex());
// }
}
@ -1000,6 +1022,12 @@ MouseArea{
}
}
function slotWaitingLauncherRemoved(launch) {
if ((isWindow || isStartup) && !visible && launch === launcherUrl) {
visible = true;
}
}
///REMOVE
//fix wrong positioning of launchers....
onActivityChanged:{
@ -1019,6 +1047,14 @@ MouseArea{
root.publishTasksGeometries.connect(slotPublishGeometries);
root.showPreviewForTasks.connect(slotShowPreviewForTasks);
if ( (isWindow || isStartup) && root.waitingLauncherExists(launcherUrl)) {
root.waitingLauncherRemoved.connect(slotWaitingLauncherRemoved);
visible = false;
} else {
visible = true;
}
///REMOVE
//fix wrong positioning of launchers....
/*for(var i=0; i<tasksModel.launcherList.length; ++i){
@ -1032,6 +1068,7 @@ MouseArea{
Component.onDestruction: {
wrapper.sendEndOfNeedBothAxisAnimation();
root.waitingLauncherRemoved.disconnect(slotWaitingLauncherRemoved);
}
///REMOVE
@ -1317,6 +1354,18 @@ MouseArea{
}
}
//Ghost animation that acts as a delayer in case there is a bouncing animation
//taking place
PropertyAnimation {
target: wrapper
property: "opacity"
to: 1
duration: mainItemContainer.inBouncingAnimation ? //exactly how much the bounche animation lasts
5*(root.durationTime * 0.8 * units.longDuration) : 0
easing.type: Easing.InQuad
}
//end of ghost animation
PropertyAnimation {
target: wrapper
property: "mScale"
@ -1372,6 +1421,11 @@ MouseArea{
if(mainItemContainer.launcherUrl===root.launcherForRemoval && mainItemContainer.isLauncher)
root.launcherForRemoval="";
//send signal that the launcher is really removing
if (mainItemContainer.inBouncingAnimation) {
root.removeWaitingLauncher(mainItemContainer.launcherUrl);
}
}
}

@ -466,6 +466,20 @@ Item{
property int speed: root.durationTime * 0.8 * units.longDuration
SequentialAnimation{
ScriptAction {
script: mainItemContainer.launcherAction();
}
//Ghost animation that acts as a delayer
PropertyAnimation {
target: wrapper
property: "opacity"
to: 1
duration: 50
easing.type: Easing.InQuad
}
//end of ghost animation
ParallelAnimation{
PropertyAnimation {
target: wrapper
@ -492,10 +506,6 @@ Item{
easing.type: Easing.OutBounce
}
ScriptAction {
script: mainItemContainer.launcherAction();
}
ParallelAnimation{
PropertyAnimation {
target: wrapper
@ -516,14 +526,6 @@ Item{
}
onStopped: {
//wrapper.mScale = 1;
/* if ( root.noTasksInAnimation>0 ) {
root.noTasksInAnimation--;
}
if ( root.animations>0 ) {
root.animations--;
}*/
//console.log ("Nooo 2: "+root.noTasksInAnimation + " - "+root.animations);
clearAnimationsSignals();
mainItemContainer.setBlockingAnimation(false);

@ -87,6 +87,7 @@ Item {
//in launcher reference from libtaskmanager
property variant badgers:[]
property variant launchersOnActivities: []
property variant waitingLaunchers: []
property QtObject contextMenuComponent: Qt.createComponent("ContextMenu.qml");
property Item dragSource: null
@ -175,6 +176,7 @@ Item {
//trigger updating scaling of neighbour delegates of zoomed delegate
signal updateScale(int delegateIndex, real newScale, real step)
signal publishTasksGeometries();
signal waitingLauncherRemoved(string launch);
signal windowsHovered(variant winIds, bool hovered)
//onAnimationsChanged: console.log(animations);
@ -271,6 +273,39 @@ Item {
return createLaunchers;
}
/// waiting launchers... this is used in order to check
/// a window or startup if its launcher is playing its animation
function addWaitingLauncher(launch){
for(var i=0; i<waitingLaunchers.length; ++i){
if (waitingLaunchers[i]===launch) {
return;
}
}
waitingLaunchers.push(launch);
}
function removeWaitingLauncher(launch){
for(var i=0; i<waitingLaunchers.length; ++i){
if (waitingLaunchers[i]===launch) {
waitingLaunchers.splice(i,1);
waitingLauncherRemoved(launch);
return;
}
}
}
function waitingLauncherExists(launch){
for(var i=0; i<waitingLaunchers.length; ++i){
if (waitingLaunchers[i]===launch) {
return true;
}
}
return false;
}
///REMOVE
function updateLaunchersNewArchitecture(){
///frameworks 5.29.0 provide id 335104

Loading…
Cancel
Save