fix #283, first improvements

--finally a way to not show removing launchers
when some of their windows are added
v0.6
Michail Vourlakos 8 years ago
parent ce54a41557
commit 41395ee5c1

@ -598,6 +598,7 @@ PlasmaComponents.ContextMenu {
text: i18n("Remove Launcher") text: i18n("Remove Launcher")
onClicked: { onClicked: {
root.launcherForRemoval = visualParent.m.LauncherUrlWithoutIcon;
tasksModel.requestRemoveLauncher(visualParent.m.LauncherUrlWithoutIcon); tasksModel.requestRemoveLauncher(visualParent.m.LauncherUrlWithoutIcon);
root.updateLaunchersNewArchitecture(); root.updateLaunchersNewArchitecture();
} }

@ -89,6 +89,13 @@ MouseArea{
property string activity: tasksModel.activity property string activity: tasksModel.activity
readonly property var m: model readonly property var m: model
property string modelLauncherUrl: (LauncherUrlWithoutIcon !== null) ? LauncherUrlWithoutIcon : ""
property string launcherUrl: ""
onModelLauncherUrlChanged: {
if (modelLauncherUrl !== "")
launcherUrl = modelLauncherUrl;
}
property QtObject contextMenu: null property QtObject contextMenu: null
property QtObject draggingResistaner: null property QtObject draggingResistaner: null
@ -1061,29 +1068,25 @@ MouseArea{
} }
} }
function init(){ function execute(){
if (root.durationTime !== 0) { //Animation Add/Remove (2) - when is window with no launcher, animations enabled
//Animation Add/Remove (3) - when is launcher with no window, animations enabled
if (( (!root.launcherExists(mainItemContainer.launcherUrl) && mainItemContainer.isWindow)
|| ( (!root.taskExists(mainItemContainer.launcherUrl) && mainItemContainer.isLauncher)))
&& (root.durationTime !== 0)){
wrapper.tempScaleWidth = 0; wrapper.tempScaleWidth = 0;
wrapper.tempScaleHeight = 0; wrapper.tempScaleHeight = 0;
start();
} else { } else {
wrapper.tempScaleWidth = 1; wrapper.tempScaleWidth = 1;
wrapper.tempScaleHeight = 1; wrapper.tempScaleHeight = 1;
wrapper.opacity = 1;
mainItemContainer.inAnimation = false;
} }
} }
function showWindow(){ function showWindow(){
if((mainItemContainer.isLauncher || mainItemContainer.isStartup execute();
|| icList.delayingRemoval || (!mainItemContainer.buffersAreReady && !root.initializatedBuffers)) && root.durationTime !== 0){
delayShowWindow.createObject(mainItemContainer);
}
else{
execute();
}
}
function execute(){
init();
start();
} }
Component.onDestruction: { Component.onDestruction: {
@ -1218,8 +1221,15 @@ MouseArea{
///Item's Removal Animation ///Item's Removal Animation
ListView.onRemove: SequentialAnimation { ListView.onRemove: SequentialAnimation {
id: taskRealRemovalAnimation
PropertyAction { target: mainItemContainer; property: "ListView.delayRemove"; value: true } PropertyAction { target: mainItemContainer; property: "ListView.delayRemove"; value: true }
//Animation Add/Remove (1) - when is window with no launcher, animations enabled
//Animation Add/Remove (4) - the user removes a launcher, animation enabled
property bool enabledAnimation: ((!root.launcherExists(mainItemContainer.launcherUrl) && mainItemContainer.isWindow)
||(mainItemContainer.launcherUrl===root.launcherForRemoval && mainItemContainer.isLauncher))
&& (root.durationTime !== 0);
ScriptAction{ ScriptAction{
script:{ script:{
root.mouseWasEntered.disconnect(signalMouseWasEntered); root.mouseWasEntered.disconnect(signalMouseWasEntered);
@ -1233,6 +1243,9 @@ MouseArea{
icList.delayingRemoval = true; icList.delayingRemoval = true;
mainItemContainer.inAddRemoveAnimation = true; mainItemContainer.inAddRemoveAnimation = true;
// console.log("1." + mainItemContainer.launcherUrl + " - " + taskRealRemovalAnimation.enabledAnimation);
// console.log("2." + root.launcherForRemoval + " - " + mainItemContainer.isLauncher);
root.signalAnimationsNeedLength(1); root.signalAnimationsNeedLength(1);
} }
} }
@ -1244,13 +1257,18 @@ MouseArea{
// property int speed: (IsStartup && !mainItemContainer.visible)? 0 : 400 // property int speed: (IsStartup && !mainItemContainer.visible)? 0 : 400
//property int speed: 400 //property int speed: 400
NumberAnimation { target: wrapper; property: "opacity"; to: 0; duration: showWindowAnimation.speed; easing.type: Easing.InQuad } NumberAnimation {
target: wrapper;
property: "opacity";
to: 0;
duration: taskRealRemovalAnimation.enabledAnimation ? showWindowAnimation.speed : 0
easing.type: Easing.InQuad }
PropertyAnimation { PropertyAnimation {
target: wrapper target: wrapper
property: (icList.orientation == Qt.Vertical) ? "tempScaleWidth" : "tempScaleHeight" property: (icList.orientation == Qt.Vertical) ? "tempScaleWidth" : "tempScaleHeight"
to: 0 to: 0
duration: showWindowAnimation.speed duration: taskRealRemovalAnimation.enabledAnimation ? showWindowAnimation.speed : 0
easing.type: Easing.InQuad easing.type: Easing.InQuad
} }
} }
@ -1260,7 +1278,7 @@ MouseArea{
target: wrapper target: wrapper
property: (icList.orientation == Qt.Vertical) ? "tempScaleHeight" : "tempScaleWidth" property: (icList.orientation == Qt.Vertical) ? "tempScaleHeight" : "tempScaleWidth"
to: 0 to: 0
duration: showWindowAnimation.speed duration: taskRealRemovalAnimation.enabledAnimation ? showWindowAnimation.speed : 0
easing.type: Easing.InQuad easing.type: Easing.InQuad
} }
@ -1276,6 +1294,9 @@ MouseArea{
mainItemContainer.inAnimation = false; mainItemContainer.inAnimation = false;
icList.delayingRemoval = false; icList.delayingRemoval = false;
if(mainItemContainer.launcherUrl===root.launcherForRemoval && mainItemContainer.isLauncher)
root.launcherForRemoval="";
} }
} }

@ -89,6 +89,9 @@ Item {
property color minimizedDotColor: textColorLuma > 0.5 ? Qt.darker(theme.textColor, 1+ (1-textColorLuma)) : Qt.lighter(theme.textColor, 1+(1-textColorLuma)) property color minimizedDotColor: textColorLuma > 0.5 ? Qt.darker(theme.textColor, 1+ (1-textColorLuma)) : Qt.lighter(theme.textColor, 1+(1-textColorLuma))
//! it is used to play the animation correct when the user removes a launcher
property string launcherForRemoval: ""
//BEGIN Now Dock Panel properties //BEGIN Now Dock Panel properties
property bool directRender: icList.directRender property bool directRender: icList.directRender
@ -230,6 +233,21 @@ Item {
} }
///// /////
function launcherExists(url) {
return (ActivitiesTools.getIndex(url, tasksModel.launcherList)>=0);
}
function taskExists(url) {
var tasks = icList.contentItem.children;
for(var i=0; i<tasks.length; ++i){
var task = tasks[i];
if (task.launcherUrl===url && task.isWindow) {
return true;
}
}
return false;
}
function updateLaunchersNewArchitecture(){ function updateLaunchersNewArchitecture(){
///frameworks 5.29.0 provide id 335104 ///frameworks 5.29.0 provide id 335104
@ -765,13 +783,13 @@ Item {
//more of a trouble //more of a trouble
moveDisplaced: Transition { moveDisplaced: Transition {
NumberAnimation { properties: "x,y"; duration: root.durationTime*units.shortDuration; easing.type: Easing.Linear } NumberAnimation { properties: "x,y"; duration: root.durationTime*units.longDuration; easing.type: Easing.Linear }
} }
///this transition can not be used with dragging !!!! I breaks ///this transition can not be used with dragging !!!! I breaks
///the lists indexes !!!!! ///the lists indexes !!!!!
/* move: Transition { /* move: Transition {
NumberAnimation { properties: "x,y"; duration: units.longDuration; easing.type: Easing.Linear } NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.Linear }
} */ } */
function childAtPos(x, y){ function childAtPos(x, y){

Loading…
Cancel
Save