mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-12 01:17:55 +03:00
fix #283, first improvements
--finally a way to not show removing launchers when some of their windows are added
This commit is contained in:
parent
fc7722099e
commit
1693191f81
@ -598,6 +598,7 @@ PlasmaComponents.ContextMenu {
|
||||
text: i18n("Remove Launcher")
|
||||
|
||||
onClicked: {
|
||||
root.launcherForRemoval = visualParent.m.LauncherUrlWithoutIcon;
|
||||
tasksModel.requestRemoveLauncher(visualParent.m.LauncherUrlWithoutIcon);
|
||||
root.updateLaunchersNewArchitecture();
|
||||
}
|
||||
|
@ -89,6 +89,13 @@ MouseArea{
|
||||
property string activity: tasksModel.activity
|
||||
|
||||
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 draggingResistaner: null
|
||||
@ -1061,29 +1068,25 @@ MouseArea{
|
||||
}
|
||||
}
|
||||
|
||||
function init(){
|
||||
if (root.durationTime !== 0) {
|
||||
function execute(){
|
||||
//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.tempScaleHeight = 0;
|
||||
start();
|
||||
} else {
|
||||
wrapper.tempScaleWidth = 1;
|
||||
wrapper.tempScaleHeight = 1;
|
||||
wrapper.opacity = 1;
|
||||
mainItemContainer.inAnimation = false;
|
||||
}
|
||||
}
|
||||
|
||||
function showWindow(){
|
||||
if((mainItemContainer.isLauncher || mainItemContainer.isStartup
|
||||
|| icList.delayingRemoval || (!mainItemContainer.buffersAreReady && !root.initializatedBuffers)) && root.durationTime !== 0){
|
||||
delayShowWindow.createObject(mainItemContainer);
|
||||
}
|
||||
else{
|
||||
execute();
|
||||
}
|
||||
}
|
||||
|
||||
function execute(){
|
||||
init();
|
||||
start();
|
||||
execute();
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
@ -1218,8 +1221,15 @@ MouseArea{
|
||||
|
||||
///Item's Removal Animation
|
||||
ListView.onRemove: SequentialAnimation {
|
||||
id: taskRealRemovalAnimation
|
||||
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{
|
||||
script:{
|
||||
root.mouseWasEntered.disconnect(signalMouseWasEntered);
|
||||
@ -1233,6 +1243,9 @@ MouseArea{
|
||||
icList.delayingRemoval = true;
|
||||
mainItemContainer.inAddRemoveAnimation = true;
|
||||
|
||||
// console.log("1." + mainItemContainer.launcherUrl + " - " + taskRealRemovalAnimation.enabledAnimation);
|
||||
// console.log("2." + root.launcherForRemoval + " - " + mainItemContainer.isLauncher);
|
||||
|
||||
root.signalAnimationsNeedLength(1);
|
||||
}
|
||||
}
|
||||
@ -1244,13 +1257,18 @@ MouseArea{
|
||||
|
||||
// property int speed: (IsStartup && !mainItemContainer.visible)? 0 : 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 {
|
||||
target: wrapper
|
||||
property: (icList.orientation == Qt.Vertical) ? "tempScaleWidth" : "tempScaleHeight"
|
||||
to: 0
|
||||
duration: showWindowAnimation.speed
|
||||
duration: taskRealRemovalAnimation.enabledAnimation ? showWindowAnimation.speed : 0
|
||||
easing.type: Easing.InQuad
|
||||
}
|
||||
}
|
||||
@ -1260,7 +1278,7 @@ MouseArea{
|
||||
target: wrapper
|
||||
property: (icList.orientation == Qt.Vertical) ? "tempScaleHeight" : "tempScaleWidth"
|
||||
to: 0
|
||||
duration: showWindowAnimation.speed
|
||||
duration: taskRealRemovalAnimation.enabledAnimation ? showWindowAnimation.speed : 0
|
||||
easing.type: Easing.InQuad
|
||||
}
|
||||
|
||||
@ -1276,6 +1294,9 @@ MouseArea{
|
||||
|
||||
mainItemContainer.inAnimation = 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))
|
||||
|
||||
//! it is used to play the animation correct when the user removes a launcher
|
||||
property string launcherForRemoval: ""
|
||||
|
||||
//BEGIN Now Dock Panel properties
|
||||
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(){
|
||||
///frameworks 5.29.0 provide id 335104
|
||||
@ -765,13 +783,13 @@ Item {
|
||||
|
||||
//more of a trouble
|
||||
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
|
||||
///the lists indexes !!!!!
|
||||
/* move: Transition {
|
||||
NumberAnimation { properties: "x,y"; duration: units.longDuration; easing.type: Easing.Linear }
|
||||
/* move: Transition {
|
||||
NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.Linear }
|
||||
} */
|
||||
|
||||
function childAtPos(x, y){
|
||||
|
Loading…
Reference in New Issue
Block a user