1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-25 19:21:41 +03:00

improve how fillRealApplets are counted

--a new parameter to count only fillApplets
that are not splitters was needed
This commit is contained in:
Michail Vourlakos 2021-01-02 21:25:50 +02:00
parent 35b757f508
commit 77520f7407
3 changed files with 30 additions and 11 deletions

View File

@ -90,6 +90,7 @@ Item {
var curApplet = layout.children[i];
// console.log( "org.kde.latte s3_-1 " + curApplet.pluginName + " : "+ curApplet.index +" (" +curApplet.isAutoFillApplet+","+!curApplet.isHidden +") ");
// console.log( "org.kde.latte s3_-1 " + curApplet.pluginName + " : "+ availableSpace + " _ " + sizePerApplet + " _ " + noOfApplets);
if (curApplet && curApplet.isAutoFillApplet && !curApplet.isHidden
&& (curApplet.applet || curApplet.isInternalViewSplitter)) {
@ -185,7 +186,7 @@ Item {
var isNeutral = (minSize<=0 && prefSize<=0);
// console.log( " s4_0 " + curApplet.pluginName + " : (" +minSize+","+prefSize+","+maxSize+") ");
// console.log( " org.kde.latte s4_0 " + curApplet.pluginName + " : (" +minSize+","+prefSize+","+maxSize+") ");
if (!isNeutral && maxSize===Infinity
&& ((inMaxAutoFillCalculations && curApplet.maxAutoFillLength>mostDemandingAppletSize)
@ -208,13 +209,13 @@ Item {
mostDemandingApplet.minAutoFillLength = mostDemandingApplet.minAutoFillLength + sizePerApplet;
}
// console.log("s4_1 "+ mostDemandingApplet.applet.pluginName + " assigned: " + mostDemandingApplet.maxAutoFillLength + "\n");
// console.log(" org.kde.latte s4_1 "+ mostDemandingApplet.applet.pluginName + " assigned: " + mostDemandingApplet.maxAutoFillLength + "\n");
} else if (neutralAppletsNo>0) {
//! if no demanding applets was found then the available space is splitted equally
//! between all neutralApplets
var adjustedAppletSize = (sizePerApplet / neutralAppletsNo);
for (var j=0; j<neutralApplets.length; ++j) {
// console.log("s4_2.0 "+ neutralApplets[j].pluginName + " _ " + neutralApplets[j].maxAutoFillLength + " _ " + adjustedAppletSize);
// console.log(" org.kde.latte s4_2.0 "+ neutralApplets[j].pluginName + " _ " + neutralApplets[j].maxAutoFillLength + " _ " + adjustedAppletSize);
if (inMaxAutoFillCalculations) {
neutralApplets[j].maxAutoFillLength = neutralApplets[j].maxAutoFillLength + adjustedAppletSize;
@ -222,7 +223,7 @@ Item {
neutralApplets[j].minAutoFillLength = neutralApplets[j].minAutoFillLength + adjustedAppletSize;
}
// console.log("s4_2 "+ neutralApplets[j].pluginName + " assigned: " + sizePerApplet + "\n");
// console.log(" org.kde.latte s4_2.1 "+ neutralApplets[j].pluginName + " assigned: " + sizePerApplet + "\n");
}
}
} else {
@ -236,7 +237,7 @@ Item {
curApplet.minAutoFillLength = Math.max(curApplet.appletMinimumLength,sizePerApplet);
}
// console.log("s4_3 "+ curApplet.pluginName + " assigned: " + sizePerApplet + "\n");
// console.log(" org.kde.latte s4_3 "+ curApplet.pluginName + " assigned: " + sizePerApplet + "\n");
curApplet.inFillCalculations = false;
}
}

View File

@ -32,6 +32,7 @@ Item {
//it is used in calculations for fillWidth,fillHeight applets
property int shownApplets: 0
property int fillApplets: 0
property int fillRealApplets: 0 //with no internal separators counted
//it is used in calculations for fillWidth,fillHeight applets
property int sizeWithNoFillApplets: 0
@ -99,6 +100,23 @@ Item {
}
}
Binding{
target: appletsContainer
property:"fillRealApplets"
when: appletsContainer && grid && !updateIsBlocked
value: {
var no = 0;
for (var i=0; i<grid.children.length; ++i){
if (grid.children[i] && grid.children[i].isAutoFillApplet && grid.children[i].applet && !grid.children[i].isHidden) {
//console.log("fill :::: " + children[i].applet.pluginName);
no++;
}
}
return no;
}
}
Binding{
target: appletsContainer
property:"firstVisibleIndex"

View File

@ -61,7 +61,7 @@ Item {
property bool inFillCalculations: false //temp record, is used in calculations for fillWidth,fillHeight applets
property bool isAutoFillApplet: {
if (isInternalViewSplitter) {
return true;
return isFillSplitter;
}
if (!applet || !applet.Layout)
@ -79,15 +79,15 @@ Item {
readonly property int isFillSplitter: isInternalViewSplitter
&& ((parent === layoutsContainer.startLayout
&& appletItem.layouter.startLayout.fillApplets === 1
&& appletItem.layouter.startLayout.fillRealApplets === 0
&& (appletItem.layouter.mainLayout.shownApplets>=1 /*main layout has applet in it*/
|| (appletItem.layouter.mainLayout.shownApplets===0 /*main layout is empty*/
&& appletItem.layouter.endLayout.fillApplets === 1)))
&& appletItem.layouter.endLayout.fillRealApplets === 0)))
|| (parent === layoutsContainer.endLayout
&& appletItem.layouter.endLayout.fillApplets === 1
&& appletItem.layouter.endLayout.fillRealApplets === 0
&& (appletItem.layouter.mainLayout.shownApplets>=1 /*main layout has applet in it*/
|| (appletItem.layouter.mainLayout.shownApplets===0 /*main layout is empty*/
&& appletItem.layouter.startLayout.fillApplets === 1))))
&& appletItem.layouter.startLayout.fillRealApplets === 0))))
readonly property bool inConfigureAppletsDragging: root.dragOverlay
@ -1067,7 +1067,7 @@ Item {
readonly property string labeltext: {
if (appletItem.isAutoFillApplet) {
return " / max_fill:"+appletItem.maxAutoFillLength + " / min_fill:"+appletItem.minAutoFillLength;
return " || max_fill:"+appletItem.maxAutoFillLength + " / min_fill:"+appletItem.minAutoFillLength;
}
return "";