mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-10 09:18:13 +03:00
inform parabolicManager for separators and hidden
--the parabolicManager is informed about the applet ids for hidden applets and separators. This way the manager can process the signals for parabolic effect much better and correctly
This commit is contained in:
parent
fa9b313c92
commit
d4b785daf3
@ -28,6 +28,9 @@ import QtQuick 2.0
|
||||
Item {
|
||||
id: parManager
|
||||
|
||||
property var hidden: []
|
||||
property var separators: []
|
||||
|
||||
//!this is used in order to update the index when the signal is for the internal latte plasmoid
|
||||
function updateIdSendScale(appIndex, index, zScale, zStep){
|
||||
if(root.latteApplet && ((appIndex<root.latteAppletPos && index>=root.latteAppletPos)
|
||||
@ -178,6 +181,61 @@ Item {
|
||||
for (var k=endClearStart; k>=endBeginIndex; --k)
|
||||
root.updateScale(k, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// update the registered separators
|
||||
// -1, no = add separator
|
||||
// no, -1 = remove separator
|
||||
// no, no = update separator position
|
||||
function setSeparator(previousId, nextId) {
|
||||
if (previousId === nextId)
|
||||
return;
|
||||
|
||||
var update=false;
|
||||
//should update
|
||||
if (previousId>-1 && nextId>-1)
|
||||
update=true;
|
||||
|
||||
//remove
|
||||
if ((previousId>-1 && nextId===-1) || update) {
|
||||
var ind = separators.indexOf(previousId);
|
||||
if (ind>-1)
|
||||
separators.splice(ind,1);
|
||||
}
|
||||
|
||||
//add
|
||||
if ((previousId===-1 && nextId>-1) || update) {
|
||||
separators.push(nextId);
|
||||
}
|
||||
|
||||
//console.log("separators : "+separators);
|
||||
}
|
||||
|
||||
// update the registered hidden applets
|
||||
// -1, no = add hidden
|
||||
// no, -1 = remove hidden
|
||||
// no, no = update hidden position
|
||||
function setHidden(previousId, nextId) {
|
||||
if (previousId === nextId)
|
||||
return;
|
||||
|
||||
var update=false;
|
||||
//should update
|
||||
if (previousId>-1 && nextId>-1)
|
||||
update=true;
|
||||
|
||||
//remove
|
||||
if ((previousId>-1 && nextId===-1) || update) {
|
||||
var ind = hidden.indexOf(previousId);
|
||||
if (ind>-1)
|
||||
hidden.splice(ind,1);
|
||||
}
|
||||
|
||||
//add
|
||||
if ((previousId===-1 && nextId>-1) || update) {
|
||||
hidden.push(nextId);
|
||||
}
|
||||
|
||||
//console.log("hidden : "+hidden);
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,10 @@ Item {
|
||||
}
|
||||
property bool showZoomed: false
|
||||
property bool lockZoom: false
|
||||
property bool isHidden: applet && applet.status === PlasmaCore.Types.HiddenStatus ? true : false
|
||||
property bool isInternalViewSplitter: (internalSplitterId > 0)
|
||||
property bool isZoomed: false
|
||||
property bool isSeparator: applet && applet.pluginName === "audoban.applet.separator" ? true : false
|
||||
|
||||
//applet is in starting edge
|
||||
/*property bool startEdge: index < layoutsContainer.endLayout.beginIndex ? (index === 0)&&(layoutsContainer.mainLayout.count > 1) :
|
||||
@ -81,6 +83,7 @@ Item {
|
||||
property int maxHeight: root.isHorizontal ? root.height : root.width
|
||||
property int shownAppletMargin: applet && (applet.pluginName === "org.kde.plasma.systemtray") ? 0 : appletMargin
|
||||
property int internalSplitterId: 0
|
||||
property int previousIndex: -1
|
||||
property int sizeForFill: -1 //it is used in calculations for fillWidth,fillHeight applets
|
||||
property int spacersMaxSize: Math.max(0,Math.ceil(0.55*root.iconSize) - root.iconMargin)
|
||||
property int status: applet ? applet.status : -1
|
||||
@ -140,12 +143,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
onIndexChanged: {
|
||||
if (container.latteApplet) {
|
||||
root.latteAppletPos = index;
|
||||
}
|
||||
}
|
||||
|
||||
/// BEGIN functions
|
||||
function checkIndex(){
|
||||
index = -1;
|
||||
@ -255,6 +252,39 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
onIndexChanged: {
|
||||
if (container.latteApplet) {
|
||||
root.latteAppletPos = index;
|
||||
}
|
||||
|
||||
if (isHidden) {
|
||||
parabolicManager.setHidden(previousIndex, index);
|
||||
}
|
||||
|
||||
if (isSeparator) {
|
||||
parabolicManager.setSeparator(previousIndex, index);
|
||||
}
|
||||
|
||||
previousIndex = index;
|
||||
}
|
||||
|
||||
onIsHiddenChanged: {
|
||||
if (isHidden) {
|
||||
parabolicManager.setHidden(-1, index);
|
||||
} else {
|
||||
parabolicManager.setHidden(index, -1);
|
||||
}
|
||||
}
|
||||
|
||||
onIsSeparatorChanged: {
|
||||
if (isSeparator) {
|
||||
parabolicManager.setSeparator(-1, index);
|
||||
} else {
|
||||
parabolicManager.setSeparator(index, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onLatteAppletChanged: {
|
||||
if(container.latteApplet){
|
||||
root.latteApplet = container.latteApplet;
|
||||
|
Loading…
Reference in New Issue
Block a user