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

Abilities:move iconSize to containmentAbility

This commit is contained in:
Michail Vourlakos 2020-04-18 19:24:21 +03:00
parent e525596a04
commit 0db7b29a2d
19 changed files with 218 additions and 122 deletions

View File

@ -22,6 +22,7 @@ var layout;
var layoutS;
var layoutE;
var root;
var containmentAb;
var plasmoid;
var lastSpacer;
@ -449,7 +450,7 @@ function insertAtLayoutCoordinates(tLayout, item, x, y) {
if (!child) {
// check if dragging takes place after the end of the layout
var neededSpace = 1.5 * (root.iconSize + root.lengthMargin);
var neededSpace = 1.5 * (containmentAb.iconSize + root.lengthMargin);
if ( (((root.isVertical && (y - neededSpace) <= tLayout.height) && y>=0)
||(root.isHorizontal && (x - neededSpace) <= tLayout.width) && x>=0)
&& tLayout.children.length>0 ){

View File

@ -63,14 +63,19 @@ Item {
sizer.updateAutomaticIconSize();
}
}
}
Connections {
target: containmentAb
onProportionIconSizeChanged: {
if (root.proportionIconSize!==-1) {
if (containmentAb.proportionIconSize!==-1) {
sizer.updateAutomaticIconSize();
}
}
onIconSizeChanged: {
if (((root.iconSize === sizer.automaticIconSizeBasedSize) || (root.iconSize === root.maxIconSize)) && sizer.automaticSizeAnimation){
if (((containmentAb.iconSize === sizer.automaticIconSizeBasedSize) || (containmentAb.iconSize === containmentAb.maxIconSize)) && sizer.automaticSizeAnimation){
root.slotAnimationsNeedBothAxis(-1);
sizer.automaticSizeAnimation=false;
}
@ -80,13 +85,13 @@ Item {
Connections {
target: latteView
onWidthChanged:{
if (root.isHorizontal && root.proportionIconSize!==-1) {
if (root.isHorizontal && containmentAb.proportionIconSize!==-1) {
sizer.updateAutomaticIconSize();
}
}
onHeightChanged:{
if (root.isVertical && root.proportionIconSize!==-1) {
if (root.isVertical && containmentAb.proportionIconSize!==-1) {
sizer.updateAutomaticIconSize();
}
}
@ -133,8 +138,8 @@ Item {
function updateAutomaticIconSize() {
if ( !doubleCallAutomaticUpdateIconSize.running && !visibilityManager.inTempHiding
&& ((visibilityManager.normalState || root.editMode)
&& (sizer.isActive || (!sizer.isActive && root.iconSize!==root.maxIconSize)))
&& (root.iconSize===root.maxIconSize || root.iconSize === sizer.automaticIconSizeBasedSize) ) {
&& (sizer.isActive || (!sizer.isActive && containmentAb.iconSize!==root.maxIconSize)))
&& (containmentAb.iconSize===containmentAb.maxIconSize || containmentAb.iconSize === sizer.automaticIconSizeBasedSize) ) {
//!doubler timer
if (!doubleCallAutomaticUpdateIconSize.secondTimeCallApplied) {
@ -157,7 +162,7 @@ Item {
layoutsContainer.startLayout.width+layoutsContainer.mainLayout.width+layoutsContainer.endLayout.width : layoutsContainer.mainLayout.width
}
var itemLength = root.iconSize + lengthMargins;
var itemLength = containmentAb.iconSize + lengthMargins;
var toShrinkLimit = maxLength - (root.zoomFactor * itemLength);
//! to grow limit must be a little less than the shrink one in order to be more robust and
@ -170,11 +175,11 @@ Item {
var newIconSizeFound = false;
if (layoutLength > toShrinkLimit) { //must shrink
// console.log("step3");
var nextIconSize = root.maxIconSize;
var nextIconSize = containmentAb.maxIconSize;
do {
nextIconSize = nextIconSize - automaticStep;
var factor = nextIconSize / root.iconSize;
var factor = nextIconSize / containmentAb.iconSize;
var nextLength = factor * layoutLength;
} while ( (nextLength>toShrinkLimit) && (nextIconSize !== 16));
@ -188,7 +193,7 @@ Item {
addPrediction(intLength, intNextLength);
// console.log("Step 3 - found:"+automaticIconSizeBasedSize);
} else if ((layoutLength<toGrowLimit
&& (root.iconSize === automaticIconSizeBasedSize)) ) { //must grow probably
&& (containmentAb.iconSize === automaticIconSizeBasedSize)) ) { //must grow probably
// console.log("step4");
var nextIconSize2 = automaticIconSizeBasedSize;
var foundGoodSize = -1;
@ -201,13 +206,13 @@ Item {
if (nextLength2 < toGrowLimit) {
foundGoodSize = nextIconSize2;
}
} while ( (nextLength2<toGrowLimit) && (nextIconSize2 !== root.maxIconSize ));
} while ( (nextLength2<toGrowLimit) && (nextIconSize2 !== containmentAb.maxIconSize ));
var intLength2 = Math.round(layoutLength);
var intNextLength2 = Math.round(nextLength2);
if (foundGoodSize > 0 && !producesEndlessLoop(intLength2, intNextLength2)) {
if (foundGoodSize === root.maxIconSize) {
if (foundGoodSize === containmentAb.maxIconSize) {
automaticIconSizeBasedSize = -1;
} else {
automaticIconSizeBasedSize = foundGoodSize;

View File

@ -412,7 +412,7 @@ Window{
}
Text{
text: root.iconSize
text: containmentAb.iconSize
}
Text{
@ -428,7 +428,7 @@ Window{
}
Text{
text: root.proportionIconSize
text: containmentAb.proportionIconSize
}
Text{

View File

@ -228,9 +228,9 @@ Item{
property int panelSize: automaticPanelSize
property int automaticPanelSize: {
if (root.behaveAsPlasmaPanel) {
return root.iconSize + root.thickMargins;// + 2;
return containmentAb.iconSize + root.thickMargins;// + 2;
} else {
var icons = root.iconSize + root.thickMargins;// + 2;
var icons = containmentAb.iconSize + root.thickMargins;// + 2;
var panelt = root.themePanelThickness;// + 2;
root.realPanelThickness = icons + root.localScreenEdgeMargin;

View File

@ -40,7 +40,7 @@ Item{
property bool inForceHiding: false //is used when the docks are forced in hiding e.g. when changing layouts
property bool normalState : false // this is being set from updateMaskArea
property bool previousNormalState : false // this is only for debugging purposes
property bool panelIsBiggerFromIconSize: root.useThemePanel && (root.themePanelThickness >= (root.iconSize + root.thickMargin))
property bool panelIsBiggerFromIconSize: root.useThemePanel && (root.themePanelThickness >= (containmentAb.iconSize + root.thickMargin))
property bool maskIsFloating: !root.behaveAsPlasmaPanel
&& !root.editMode
@ -72,25 +72,25 @@ Item{
}
property int thicknessAutoHidden: LatteCore.WindowSystem.compositingActive ? 2 : 1
property int thicknessMid: root.screenEdgeMargin + (1 + (0.65 * (root.maxZoomFactor-1)))*(root.iconSize+root.thickMargins+extraThickMask) //needed in some animations
property int thicknessNormal: root.screenEdgeMargin + Math.max(root.iconSize + root.thickMargins + extraThickMask + 1, root.realPanelSize + root.panelShadow)
property int thicknessMid: root.screenEdgeMargin + (1 + (0.65 * (root.maxZoomFactor-1)))*(containmentAb.iconSize+root.thickMargins+extraThickMask) //needed in some animations
property int thicknessNormal: root.screenEdgeMargin + Math.max(containmentAb.iconSize + root.thickMargins + extraThickMask + 1, root.realPanelSize + root.panelShadow)
property int thicknessZoom: root.screenEdgeMargin + ((root.iconSize+root.thickMargins+extraThickMask) * root.maxZoomFactor) + 2
property int thicknessZoom: root.screenEdgeMargin + ((containmentAb.iconSize+root.thickMargins+extraThickMask) * root.maxZoomFactor) + 2
//it is used to keep thickness solid e.g. when iconSize changes from auto functions
property int thicknessMidOriginal: root.screenEdgeMargin + Math.max(thicknessNormalOriginal,extraThickMask + (1 + (0.65 * (root.maxZoomFactor-1)))*(root.maxIconSize+root.maxThickMargin)) //needed in some animations
property int thicknessNormalOriginal: root.screenEdgeMargin + root.maxIconSize + (root.maxThickMargin * 2) //this way we always have the same thickness published at all states
property int thicknessMidOriginal: root.screenEdgeMargin + Math.max(thicknessNormalOriginal,extraThickMask + (1 + (0.65 * (root.maxZoomFactor-1)))*(containmentAb.maxIconSize+root.maxThickMargin)) //needed in some animations
property int thicknessNormalOriginal: root.screenEdgeMargin + containmentAb.maxIconSize + (root.maxThickMargin * 2) //this way we always have the same thickness published at all states
/*property int thicknessNormalOriginal: !root.behaveAsPlasmaPanel || root.editMode ?
thicknessNormalOriginalValue : root.realPanelSize + root.panelShadow*/
property int thicknessNormalOriginalValue: root.screenEdgeMargin + root.maxIconSize + (root.maxThickMargin * 2) + extraThickMask + 1
property int thicknessZoomOriginal:root.screenEdgeMargin + Math.max( ((root.maxIconSize+(root.maxThickMargin * 2)) * root.maxZoomFactor) + extraThickMask + 2,
property int thicknessNormalOriginalValue: root.screenEdgeMargin + containmentAb.maxIconSize + (root.maxThickMargin * 2) + extraThickMask + 1
property int thicknessZoomOriginal:root.screenEdgeMargin + Math.max( ((containmentAb.maxIconSize+(root.maxThickMargin * 2)) * root.maxZoomFactor) + extraThickMask + 2,
root.realPanelSize + root.panelShadow,
(LatteCore.WindowSystem.compositingActive ? thicknessEditMode + root.editShadow : thicknessEditMode))
//! is used from Panel in edit mode in order to provide correct masking
property int thicknessEditMode: thicknessNormalOriginalValue + editModeVisual.settingsThickness
//! when Latte behaves as Plasma panel
property int thicknessAsPanel: root.iconSize + root.thickMargins
property int thicknessAsPanel: containmentAb.iconSize + root.thickMargins
//! is used to increase the mask thickness
readonly property int marginBetweenContentsAndRuler: root.editMode ? 10 : 0
@ -128,7 +128,7 @@ Item{
value: root.behaveAsPlasmaPanel && !root.editMode ? thicknessAsPanel : thicknessZoomOriginal
}
property bool validIconSize: (root.iconSize===root.maxIconSize || root.iconSize === automaticItemSizer.automaticIconSizeBasedSize)
property bool validIconSize: (containmentAb.iconSize===containmentAb.maxIconSize || containmentAb.iconSize === automaticItemSizer.automaticIconSizeBasedSize)
property bool inPublishingState: validIconSize && !inSlidingIn && !inSlidingOut && !inTempHiding && !inForceHiding
Binding{
@ -735,7 +735,7 @@ Item{
}
}
var validIconSize = (root.iconSize===root.maxIconSize || root.iconSize === automaticItemSizer.automaticIconSizeBasedSize);
var validIconSize = (containmentAb.iconSize===containmentAb.maxIconSize || containmentAb.iconSize === automaticItemSizer.automaticIconSizeBasedSize);
//console.log("reached updating geometry ::: "+dock.maskArea);
@ -748,7 +748,7 @@ Item{
//the shadows size must be removed from the maskArea
//before updating the localDockGeometry
if (!latteView.behaveAsPlasmaPanel || root.editMode) {
var cleanThickness = root.iconSize + root.thickMargins;
var cleanThickness = containmentAb.iconSize + root.thickMargins;
var edgeMargin = root.screenEdgeMargin;
if (plasmoid.location === PlasmaCore.Types.TopEdge) {

View File

@ -0,0 +1,24 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.7
Item {
property QtObject publicApi: Item{}
}

View File

@ -0,0 +1,28 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.7
ContainmentPrivate {
id: apis
publicApi: Item {
readonly property alias iconSize: apis.iconSize
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.7
import org.kde.plasma.plasmoid 2.0
Ability {
property int iconSize: autoItemSizerAb.automaticIconSizeBasedSize > 0 && autoItemSizerAb.isActive ?
Math.min(autoItemSizerAb.automaticIconSizeBasedSize, maxIconSize) :
maxIconSize
//what is the highest icon size based on what icon size is used, screen calculated or user specified
readonly property int maxIconSize: proportionIconSize!==-1 ? proportionIconSize : plasmoid.configuration.iconSize
readonly property int proportionIconSize: { //icon size based on screen height
if ((plasmoid.configuration.proportionIconSize===-1) || !latteView)
return -1;
return Math.max(16,Math.round(latteView.screenGeometry.height * plasmoid.configuration.proportionIconSize/100/8)*8);
}
//! Behaviors
Behavior on iconSize {
enabled: !(root.editMode && root.behaveAsPlasmaPanel)
NumberAnimation {
duration: 0.8 * root.animationTime
onRunningChanged: {
if (!running) {
delayUpdateMaskArea.start();
}
}
}
}
}

View File

@ -163,14 +163,14 @@ Item {
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.lengthMargins)
property int spacersMaxSize: Math.max(0,Math.ceil(0.55 * containmentAb.iconSize) - root.lengthMargins)
property int status: applet ? applet.status : -1
//! local margins
readonly property bool parabolicEffectMarginsEnabled: root.zoomFactor>1 && !originalAppletBehavior
property int lengthAppletIntMargin: root.lengthAppletIntMarginFactor === -1 || parabolicEffectMarginsEnabled ?
root.lengthIntMargin : root.lengthAppletIntMarginFactor * root.iconSize
root.lengthIntMargin : root.lengthAppletIntMarginFactor * containmentAb.iconSize
property int lengthAppletFullMargin: lengthAppletIntMargin + root.lengthExtMargin
property int lengthAppletFullMargins: 2 * lengthAppletFullMargin
@ -398,8 +398,8 @@ Item {
return;
}
var maxSize = root.iconSize + root.thickMargins;
var maxForMinimumSize = root.iconSize + root.thickMargins;
var maxSize = containmentAb.iconSize + root.thickMargins;
var maxForMinimumSize = containmentAb.iconSize + root.thickMargins;
if ( isSystray
|| appletItem.needsFillSpace
@ -838,7 +838,7 @@ Item {
width: {
if (root.isHorizontal) {
return root.iconSize * wrapper.zoomScale
return containmentAb.iconSize * wrapper.zoomScale
} else {
return badgeThickness;
}
@ -848,17 +848,17 @@ Item {
if (root.isHorizontal) {
return badgeThickness;
} else {
return root.iconSize * wrapper.zoomScale
return containmentAb.iconSize * wrapper.zoomScale
}
}
readonly property int badgeThickness: {
if (plasmoid.location === PlasmaCore.Types.BottomEdge
|| plasmoid.location === PlasmaCore.Types.RightEdge) {
return ((root.iconSize + root.thickMargin) * wrapper.zoomScale) + root.localScreenEdgeMargin;
return ((containmentAb.iconSize + root.thickMargin) * wrapper.zoomScale) + root.localScreenEdgeMargin;
}
return ((root.iconSize + root.thickMargin) * wrapper.zoomScale);
return ((containmentAb.iconSize + root.thickMargin) * wrapper.zoomScale);
}
ShortcutBadge{
@ -917,7 +917,7 @@ Item {
// width: root.isHorizontal ? parent.width : parent.width - root.localScreenEdgeMargin
// height: root.isHorizontal ? parent.height - root.localScreenEdgeMargin : parent.height
radius: root.iconSize/10
radius: containmentAb.iconSize/10
opacity: root.addLaunchersMessage ? 1 : 0
backgroundOpacity: 0.75
duration: root.durationTime

View File

@ -50,7 +50,7 @@ Item{
var constrainedWidth = MathTools.bound(applet.Layout.minimumWidth, applet.Layout.preferredWidth, maximumValue);
return root.inConfigureAppletsMode ? Math.max(constrainedWidth, root.iconSize) : constrainedWidth;
return root.inConfigureAppletsMode ? Math.max(constrainedWidth, containmentAb.iconSize) : constrainedWidth;
}
if(appletItem.sizeForFill>-1){
@ -62,7 +62,7 @@ Item{
return latteApplet.tasksWidth;
} else {
if (root.isHorizontal && root.inConfigureAppletsMode) {
return Math.max(Math.min(root.iconSize, root.minAppletLengthInConfigure), scaledWidth);
return Math.max(Math.min(containmentAb.iconSize, root.minAppletLengthInConfigure), scaledWidth);
}
return root.isVertical ? scaledWidth + root.localScreenEdgeMargin : scaledWidth;
@ -85,7 +85,7 @@ Item{
var constrainedHeight = MathTools.bound(applet.Layout.minimumHeight, applet.Layout.preferredHeight, maximumValue);
return root.inConfigureAppletsMode ? Math.max(constrainedHeight, root.iconSize) : constrainedHeight;
return root.inConfigureAppletsMode ? Math.max(constrainedHeight, containmentAb.iconSize) : constrainedHeight;
}
if (appletItem.sizeForFill>-1){
@ -97,7 +97,7 @@ Item{
return latteApplet.tasksHeight;
} else {
if (root.isVertical && root.inConfigureAppletsMode) {
return Math.max(Math.min(root.iconSize, root.minAppletLengthInConfigure), scaledHeight);
return Math.max(Math.min(containmentAb.iconSize, root.minAppletLengthInConfigure), scaledHeight);
}
return root.isHorizontal ? scaledHeight + root.localScreenEdgeMargin : scaledHeight;
@ -124,7 +124,7 @@ Item{
property int appletMaximumWidth: applet && applet.Layout ? applet.Layout.maximumWidth : -1
property int appletMaximumHeight: applet && applet.Layout ? applet.Layout.maximumHeight : -1
property int iconSize: root.iconSize
property int iconSize: containmentAb.iconSize
property int marginWidth: root.isVertical ?
root.thickMargins :
@ -188,11 +188,11 @@ Item{
console.log("Real Wrapper Height: "+wrapper.height);
console.log("-----");
console.log("Can be hovered: " + canBeHovered);
console.log("Icon size: " + root.iconSize);
console.log("Icon size: " + containmentAb.iconSize);
console.log("Thick Margins: " + root.thickMargins);
console.log("Intern. Margins: " + (root.lengthIntMargin * 2));
console.log("Intern. Margins: " + (root.lengthExtMargin * 2));
console.log("Max hovered criteria: " + (root.iconSize + thickMargins));
console.log("Max hovered criteria: " + (containmentAb.iconSize + thickMargins));
console.log("-----");
console.log("LayoutW: " + layoutWidth);
console.log("LayoutH: " + layoutHeight);
@ -314,39 +314,39 @@ Item{
if(!root.inConfigureAppletsMode) {
layoutHeight = 0;
} else {
layoutHeight = (root.isHorizontal ? root.iconSize : Math.min(root.iconSize, root.maxJustifySplitterSize));
layoutHeight = (root.isHorizontal ? containmentAb.iconSize : Math.min(containmentAb.iconSize, root.maxJustifySplitterSize));
}
}
else if(appletItem.isSystray && root.isHorizontal){
layoutHeight = root.iconSize;
layoutHeight = containmentAb.iconSize;
}
else{
if(applet && (applet.Layout.minimumHeight > root.iconSize) && root.isVertical && !canBeHovered && !communicator.overlayLatteIconIsActive){
if(applet && (applet.Layout.minimumHeight > containmentAb.iconSize) && root.isVertical && !canBeHovered && !communicator.overlayLatteIconIsActive){
blockParabolicEffect = true;
layoutHeight = applet.Layout.minimumHeight;
} //it is used for plasmoids that need to scale only one axis... e.g. the Weather Plasmoid
else if(applet
&& ( applet.Layout.maximumHeight < root.iconSize
|| applet.Layout.preferredHeight > root.iconSize
&& ( applet.Layout.maximumHeight < containmentAb.iconSize
|| applet.Layout.preferredHeight > containmentAb.iconSize
|| appletItem.originalAppletBehavior)
&& root.isVertical
&& !disableScaleWidth
&& !communicator.overlayLatteIconIsActive) {
//this way improves performance, probably because during animation the preferred sizes update a lot
if((applet.Layout.maximumHeight < root.iconSize)){
if((applet.Layout.maximumHeight < containmentAb.iconSize)){
layoutHeight = applet.Layout.maximumHeight;
} else if (applet.Layout.minimumHeight > root.iconSize){
} else if (applet.Layout.minimumHeight > containmentAb.iconSize){
blockParabolicEffect = true;
layoutHeight = applet.Layout.minimumHeight;
} else if ((applet.Layout.preferredHeight > root.iconSize)
} else if ((applet.Layout.preferredHeight > containmentAb.iconSize)
|| (appletItem.originalAppletBehavior && applet.Layout.preferredHeight > 0 )){
blockParabolicEffect = true;
layoutHeight = applet.Layout.preferredHeight;
} else{
layoutHeight = root.iconSize;
layoutHeight = containmentAb.iconSize;
}
} else {
layoutHeight = root.iconSize;
layoutHeight = containmentAb.iconSize;
}
}
@ -375,41 +375,41 @@ Item{
if(!root.inConfigureAppletsMode) {
layoutWidth = 0;
} else {
layoutWidth = (root.isVertical ? root.iconSize : Math.min(root.iconSize, root.maxJustifySplitterSize));
layoutWidth = (root.isVertical ? containmentAb.iconSize : Math.min(containmentAb.iconSize, root.maxJustifySplitterSize));
}
}
else if(appletItem.isSystray && root.isVertical){
layoutWidth = root.iconSize;
layoutWidth = containmentAb.iconSize;
}
else{
if(applet && (applet.Layout.minimumWidth > root.iconSize) && root.isHorizontal && !canBeHovered && !communicator.overlayLatteIconIsActive){
if(applet && (applet.Layout.minimumWidth > containmentAb.iconSize) && root.isHorizontal && !canBeHovered && !communicator.overlayLatteIconIsActive){
blockParabolicEffect = true;
layoutWidth = applet.Layout.minimumWidth;
} //it is used for plasmoids that need to scale only one axis... e.g. the Weather Plasmoid
else if(applet
&& ( applet.Layout.maximumWidth < root.iconSize
|| applet.Layout.preferredWidth > root.iconSize
&& ( applet.Layout.maximumWidth < containmentAb.iconSize
|| applet.Layout.preferredWidth > containmentAb.iconSize
|| appletItem.originalAppletBehavior)
&& root.isHorizontal
&& !disableScaleHeight
&& !communicator.overlayLatteIconIsActive){
//this way improves performance, probably because during animation the preferred sizes update a lot
if((applet.Layout.maximumWidth < root.iconSize)){
if((applet.Layout.maximumWidth < containmentAb.iconSize)){
// return applet.Layout.maximumWidth;
layoutWidth = applet.Layout.maximumWidth;
} else if (applet.Layout.minimumWidth > root.iconSize){
} else if (applet.Layout.minimumWidth > containmentAb.iconSize){
blockParabolicEffect = true;
layoutWidth = applet.Layout.minimumWidth;
} else if ((applet.Layout.preferredWidth > root.iconSize)
} else if ((applet.Layout.preferredWidth > containmentAb.iconSize)
|| (appletItem.originalAppletBehavior && applet.Layout.preferredWidth > 0 )){
blockParabolicEffect = true;
layoutWidth = applet.Layout.preferredWidth;
} else{
layoutWidth = root.iconSize;
layoutWidth = containmentAb.iconSize;
}
} else{
layoutWidth = root.iconSize;
layoutWidth = containmentAb.iconSize;
}
}
@ -434,7 +434,7 @@ Item{
return wrapper.layoutWidth;
} else {
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
var wrapperContainerThickness = parent.zoomScaleWidth * (root.iconSize + root.thickMargins);
var wrapperContainerThickness = parent.zoomScaleWidth * (containmentAb.iconSize + root.thickMargins);
return appletItem.supportsScreenEdgeMargin ? wrapperContainerThickness + root.localScreenEdgeMargin : wrapperContainerThickness;
} else {
return parent.zoomScaleWidth * wrapper.layoutWidth;
@ -451,7 +451,7 @@ Item{
return wrapper.layoutHeight;
} else {
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) {
var wrapperContainerThickness = parent.zoomScaleHeight * (root.iconSize + root.thickMargins);
var wrapperContainerThickness = parent.zoomScaleHeight * (containmentAb.iconSize + root.thickMargins);
return appletItem.supportsScreenEdgeMargin ? wrapperContainerThickness + root.localScreenEdgeMargin : wrapperContainerThickness;
} else {
return parent.zoomScaleHeight * wrapper.layoutHeight;
@ -612,7 +612,7 @@ Item{
PlasmaCore.SvgItem{
id:splitterImage
anchors.centerIn: parent
width: Math.min(root.maxJustifySplitterSize, root.iconSize)
width: Math.min(root.maxJustifySplitterSize, containmentAb.iconSize)
height: width
rotation: root.isVertical ? 90 : 0

View File

@ -102,13 +102,13 @@ Loader{
// when iconSize < 48, height is always = 24, height / iconSize > 50%
// we prefer center aligned badges to top-left aligned ones
property bool centerInParent: root.iconSize < 48
property bool centerInParent: containmentAb.iconSize < 48
anchors.left: centerInParent? undefined : parent.left
anchors.top: centerInParent? undefined : parent.top
anchors.centerIn: centerInParent? parent : undefined
minimumWidth: 0.4 * (wrapper.zoomScale * root.iconSize)
height: Math.max(24, 0.4 * (wrapper.zoomScale * root.iconSize))
minimumWidth: 0.4 * (wrapper.zoomScale * containmentAb.iconSize)
height: Math.max(24, 0.4 * (wrapper.zoomScale * containmentAb.iconSize))
borderColor: colorizerManager.originalLightTextColor
proportion: 0

View File

@ -31,7 +31,7 @@ Item{
property int size: 1
property int thickness: Math.min(Math.max(minimumThickness, preferredThickness), maximumThickness)
property int minimumThickness: 0
readonly property int preferredThickness: (root.zoomFactor * (root.iconSize + root.thickMargins)) + root.localScreenEdgeMargin
readonly property int preferredThickness: (root.zoomFactor * (containmentAb.iconSize + root.thickMargins)) + root.localScreenEdgeMargin
property int maximumThickness: 9999
//border.width: 1

View File

@ -86,7 +86,7 @@ Item{
// USE CASE: it can be used from applets that want their size to be always
// relevant to the view icon size
// @since: 0.9
readonly property int iconSize: root.iconSize
readonly property int iconSize: containmentAb.iconSize
// NAME: screenEdgeMargin
// USAGE: read-only
@ -113,6 +113,8 @@ Item{
readonly property QtObject windowsTracker: mainCommunicator.windowsTrackingEnabled && latteView && latteView.windowsTracker ?
latteView.windowsTracker : null
readonly property Item containment: containmentAb
property Item actions: Actions{}
Connections {

View File

@ -58,8 +58,8 @@ Item{
readonly property int windowsCount: 0
readonly property int windowsMinimizedCount: 0
readonly property int currentIconSize: root.iconSize
readonly property int maxIconSize: root.maxIconSize
readonly property int currentIconSize: containmentAb.iconSize
readonly property int maxIconSize: containmentAb.maxIconSize
readonly property real scaleFactor: appletIsValid ? appletItem.wrapperAlias.zoomScale : 1
readonly property real panelOpacity: root.currentPanelOpacity
readonly property color shadowColor: root.appShadowColorSolid

View File

@ -68,8 +68,8 @@ Loader {
readonly property bool locked: appletItem.lockZoom || root.zoomFactor === 1
property real visualLockedWidth: root.iconSize + appletItem.internalWidthMargins
property real visualLockedHeight: root.iconSize + appletItem.internalHeightMargins
property real visualLockedWidth: containmentAb.iconSize + appletItem.internalWidthMargins
property real visualLockedHeight: containmentAb.iconSize + appletItem.internalHeightMargins
//! Communications !//

View File

@ -45,8 +45,8 @@ Item{
property int speed: LatteCore.WindowSystem.compositingActive ? root.appliedDurationTime*3.6*root.longDuration : 10
property int thickness: visibilityManager.thicknessEditMode + root.editShadow
property int rootThickness: visibilityManager.thicknessZoomOriginal + root.editShadow //- visibilityManager.thicknessEditMode
property int editLength: root.isHorizontal ? (root.behaveAsPlasmaPanel ? root.width - root.maxIconSize/4 : root.width)://root.maxLength) :
(root.behaveAsPlasmaPanel ? root.height - root.maxIconSize/4 : root.height)
property int editLength: root.isHorizontal ? (root.behaveAsPlasmaPanel ? root.width - containmentAb.maxIconSize/4 : root.width)://root.maxLength) :
(root.behaveAsPlasmaPanel ? root.height - containmentAb.maxIconSize/4 : root.height)
property bool animationSent: false
property bool farEdge: (plasmoid.location===PlasmaCore.Types.BottomEdge) || (plasmoid.location===PlasmaCore.Types.RightEdge)

View File

@ -43,7 +43,7 @@ Loader {
acceptedButtons: Qt.LeftButton | Qt.MidButton
readonly property int localThickness: (root.isHovered ? (root.iconSize + root.thickMargins)*root.zoomFactor : (root.iconSize + root.thickMargins))
readonly property int localThickness: (root.isHovered ? (containmentAb.iconSize + root.thickMargins)*root.zoomFactor : (containmentAb.iconSize + root.thickMargins))
readonly property int length: {
if (screenEdgeMarginEnabled && plasmoid.configuration.fittsLawIsRequested) {
return root.isHorizontal ? root.width : root.height;

View File

@ -52,8 +52,8 @@ Item{
readonly property int windowsCount: 0
readonly property int windowsMinimizedCount: 0
readonly property int currentIconSize: root.iconSize
readonly property int maxIconSize: root.maxIconSize
readonly property int currentIconSize: containmentAb.iconSize
readonly property int maxIconSize: containmentAb.maxIconSize
readonly property real scaleFactor: 1
readonly property real panelOpacity: root.currentPanelOpacity
readonly property color shadowColor: root.appShadowColorSolid

View File

@ -32,6 +32,7 @@ import org.kde.latte 0.2 as Latte
import org.kde.latte.core 0.2 as LatteCore
import org.kde.latte.components 1.0 as LatteComponents
import "abilities" as Ability
import "applet" as Applet
import "colorizer" as Colorizer
import "editmode" as EditMode
@ -260,19 +261,6 @@ Item {
readonly property int minAppletLengthInConfigure: 64
readonly property int maxJustifySplitterSize: 96
//what is the highest icon size based on what icon size is used, screen calculated or user specified
property int maxIconSize: proportionIconSize!==-1 ? proportionIconSize : plasmoid.configuration.iconSize
property int iconSize: automaticItemSizer.automaticIconSizeBasedSize > 0 && automaticItemSizer.isActive ?
Math.min(automaticItemSizer.automaticIconSizeBasedSize, root.maxIconSize) :
root.maxIconSize
property int proportionIconSize: { //icon size based on screen height
if ((plasmoid.configuration.proportionIconSize===-1) || !latteView)
return -1;
return Math.max(16,Math.round(latteView.screenGeometry.height * plasmoid.configuration.proportionIconSize/100/8)*8);
}
property int latteAppletPos: -1
property int minLengthPerCentage: plasmoid.configuration.minLength
property int maxLengthPerCentage: hideLengthScreenGaps ? 100 : plasmoid.configuration.maxLength
@ -339,8 +327,8 @@ Item {
}
property int appShadowOpacity: (plasmoid.configuration.shadowOpacity/100) * 255
property int appShadowSize: enableShadows ? (0.5*root.iconSize) * (plasmoid.configuration.shadowSize/100) : 0
property int appShadowSizeOriginal: enableShadows ? (0.5*maxIconSize) * (plasmoid.configuration.shadowSize/100) : 0
property int appShadowSize: enableShadows ? (0.5*containmentAb.iconSize) * (plasmoid.configuration.shadowSize/100) : 0
property int appShadowSizeOriginal: enableShadows ? (0.5*containmentAb.maxIconSize) * (plasmoid.configuration.shadowSize/100) : 0
property string appChosenShadowColor: {
if (plasmoid.configuration.shadowColorType === Latte.Types.ThemeColorShadow) {
@ -395,13 +383,13 @@ Item {
property int themePanelThickness: {
var panelBase = root.panelThickMarginHigh + root.panelThickMarginBase;
var margin = shrinkThickMargins ? 0 : thickMargins + localScreenEdgeMargin;
var maxPanelSize = (iconSize + margin) - panelBase;
var maxPanelSize = (containmentAb.iconSize + margin) - panelBase;
var percentage = LatteCore.WindowSystem.compositingActive ? plasmoid.configuration.panelSize/100 : 1;
return Math.max(panelBase, panelBase + percentage*maxPanelSize);
}
property int lengthIntMargin: lengthIntMarginFactor * root.iconSize
property int lengthExtMargin: lengthExtMarginFactor * root.iconSize
property int lengthIntMargin: lengthIntMarginFactor * containmentAb.iconSize
property int lengthExtMargin: lengthExtMarginFactor * containmentAb.iconSize
property real lengthIntMarginFactor: indicators.isEnabled ? indicators.padding : 0
property real lengthExtMarginFactor: plasmoid.configuration.lengthExtMargin / 100
@ -415,7 +403,7 @@ Item {
//0.075 old statesLineSize and 0.06 old default thickMargin
return Math.max(indicators.info.minThicknessPadding, plasmoid.configuration.thickMargin / 100)
}
property int thickMargin: thickMarginFactor * root.iconSize
property int thickMargin: thickMarginFactor * containmentAb.iconSize
property bool screenEdgeMarginEnabled: plasmoid.configuration.screenEdgeMargin >= 0 && !plasmoid.configuration.shrinkThickMargins
property int screenEdgeMargin: {
@ -438,7 +426,7 @@ Item {
//it is used in order to not break the calculations for the thickness placement
//especially in automatic icon sizes calculations
property int maxThickMargin: thickMarginFactor * maxIconSize
property int maxThickMargin: thickMarginFactor * containmentAb.maxIconSize
property int lengthMargin: lengthIntMargin + lengthExtMargin
property int lengthMargins: 2 * lengthMargin
@ -474,6 +462,9 @@ Item {
property Item toolBox
property Item latteAppletContainer
property Item latteApplet
readonly property Item autoItemSizerAb: automaticItemSizer
readonly property Item containmentAb: _containmentAb
readonly property Item indicatorsManager: indicators
readonly property Item parabolicManager: _parabolicManager
readonly property Item maskManager: visibilityManager
@ -515,9 +506,9 @@ Item {
if (!universalSettings || universalSettings.mouseSensitivity === Latte.Types.HighSensitivity) {
return 1;
} else if (universalSettings.mouseSensitivity === Latte.Types.MediumSensitivity) {
return Math.max(3, root.iconSize / 18);
return Math.max(3, containmentAb.iconSize / 18);
} else if (universalSettings.mouseSensitivity === Latte.Types.LowSensitivity) {
return Math.max(5, root.iconSize / 10);
return Math.max(5, containmentAb.iconSize / 10);
}
}
@ -602,7 +593,7 @@ Item {
///The index of user's current icon size
property int currentIconIndex:{
for(var i=iconsArray.length-1; i>=0; --i){
if(iconsArray[i] === iconSize){
if(iconsArray[i] === containmentAb.iconSize){
return i;
}
}
@ -645,19 +636,6 @@ Item {
}
}
Behavior on iconSize {
enabled: !(root.editMode && root.behaveAsPlasmaPanel)
NumberAnimation {
duration: 0.8 * root.animationTime
onRunningChanged: {
if (!running) {
delayUpdateMaskArea.start();
}
}
}
}
Behavior on offset {
enabled: editModeVisual.editAnimationInFullThickness
NumberAnimation {
@ -782,12 +760,11 @@ Item {
}
}
// onIconSizeChanged: console.log("Icon Size Changed:"+iconSize);
Component.onCompleted: {
// currentLayout.isLayoutHorizontal = isHorizontal
LayoutManager.plasmoid = plasmoid;
LayoutManager.root = root;
LayoutManager.containmentAb = containmentAb;
LayoutManager.layout = layoutsContainer.mainLayout;
LayoutManager.layoutS = layoutsContainer.startLayout;
LayoutManager.layoutE = layoutsContainer.endLayout;
@ -1766,8 +1743,8 @@ Item {
width: root.isHorizontal ? length : thickness
height: root.isHorizontal ? thickness : length
readonly property int length: root.iconSize + root.lengthMargins
readonly property int thickness: root.iconSize + root.thickMargins + root.localScreenEdgeMargin
readonly property int length: containmentAb.iconSize + root.lengthMargins
readonly property int thickness: containmentAb.iconSize + root.thickMargins + root.localScreenEdgeMargin
Layout.preferredWidth: width
Layout.preferredHeight: height
@ -1846,6 +1823,14 @@ Item {
///////////////END UI elements
///////////////BEGIN ABILITIES
Ability.Containment{
id: _containmentAb
}
///////////////END ABILITIES
///////////////BEGIN TIMER elements