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

Abilities:Move Tasks iconSizes to ContainmentAb

This commit is contained in:
Michail Vourlakos 2020-04-18 19:53:39 +03:00
parent 0db7b29a2d
commit 42c44c20da
18 changed files with 127 additions and 73 deletions

View File

@ -24,5 +24,6 @@ ContainmentPrivate {
publicApi: Item {
readonly property alias iconSize: apis.iconSize
readonly property alias maxIconSize: apis.maxIconSize
}
}

View File

@ -122,7 +122,7 @@ function insertIndexAt(above, x, y) {
} else {
var distance = root.vertical ? y : x;
//var step = root.vertical ? LayoutManager.taskWidth() : LayoutManager.taskHeight();
var step = root.iconSize + root.lengthMargins;
var step = containment.iconSize + root.lengthMargins;
var stripe = Math.ceil(distance / step);
/* if (stripe === LayoutManager.calculateStripes()) {

View File

@ -0,0 +1,23 @@
/*
* 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 {
}

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
Item {
readonly property int iconSize: latteBridge ? latteBridge.containment.iconSize : localIconSize
readonly property int maxIconSize: latteBridge ? latteBridge.containment.maxIconSize : iconSize
property int localIconSize: 48
}

View File

@ -35,6 +35,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 "previews" as Previews
import "task" as Task
import "taskslayout" as TasksLayout
@ -135,6 +136,7 @@ Item {
property Item dragSource: null
property Item parabolicManager: _parabolicManager
property Item tasksExtendedManager: _tasksExtendedManager
readonly property Item containment: _containment
readonly property alias containsDrag: mouseHandler.containsDrag
readonly property bool dragAreaEnabled: latteView ? (root.dragSource !== null
@ -185,9 +187,7 @@ Item {
property int directRenderAnimationTime: latteView ? latteView.directRenderAnimationTime : 0
property int dockHoveredIndex : latteView ? latteView.hoveredIndex : -1
property int iconSize: latteView ? latteView.iconSize : Math.max(plasmoid.configuration.iconSize, 16)
property int launchersGroup: plasmoid.configuration.launchersGroup
property int maxIconSize: latteView ? latteView.maxIconSize : iconSize
property int leftClickAction: plasmoid.configuration.leftClickAction
property int middleClickAction: plasmoid.configuration.middleClickAction
@ -215,10 +215,10 @@ Item {
}
}
property int thickMargin: latteView ? latteView.thickMargin : 0.16*iconSize
property int thickMargin: latteView ? latteView.thickMargin : 0.16*containment.iconSize
property int thickMargins: 2 * thickMargin
property int lengthIntMargin: latteView ? latteView.lengthIntMargin : 0.04*iconSize
property int lengthExtMargin: latteView ? latteView.lengthExtMargin : 0.1 * iconSize
property int lengthIntMargin: latteView ? latteView.lengthIntMargin : 0.04 * containment.iconSize
property int lengthExtMargin: latteView ? latteView.lengthExtMargin : 0.1 * containment.iconSize
property int lengthMargin: lengthIntMargin + lengthExtMargin
property int lengthMargins: 2 * lengthMargin
@ -249,7 +249,7 @@ Item {
property real durationTime: latteView ? latteView.durationTime : plasmoid.configuration.durationTime
property real zoomFactor: latteView ? latteView.zoomFactor : ( 1 + (plasmoid.configuration.zoomLevel / 20) )
property int appShadowSize: latteView ? latteView.appShadowSize : Math.ceil(0.12*iconSize)
property int appShadowSize: latteView ? latteView.appShadowSize : Math.ceil(0.12*containment.iconSize)
property string appShadowColor: latteView ? latteView.appShadowColor : "#ff080808"
property string appShadowColorSolid: latteView ? latteView.appShadowColorSolid : "#ff080808"
@ -967,9 +967,11 @@ Item {
id: _tasksExtendedManager
}
/* IconsModel{
id: iconsmdl
}*/
Ability.ContainmentAbility {
id: _containment
localIconSize: Math.max(plasmoid.configuration.iconSize, 16)
}
Component{
id: attentionTimerComponent
@ -1054,15 +1056,15 @@ Item {
anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : undefined
anchors.verticalCenter: root.vertical ? parent.verticalCenter : undefined
width: root.vertical ? 1 : 2 * root.iconSize
height: root.vertical ? 2 * root.iconSize : 1
width: root.vertical ? 1 : 2 * containment.iconSize
height: root.vertical ? 2 * containment.iconSize : 1
color: "red"
x: (root.location === PlasmaCore.Types.LeftEdge) ? neededSpace : parent.width - neededSpace
y: (root.location === PlasmaCore.Types.TopEdge) ? neededSpace : parent.height - neededSpace
visible: plasmoid.configuration.zoomHelper
property int neededSpace: zoomFactor*(iconSize+lengthMargins)
property int neededSpace: zoomFactor*(containment.iconSize+lengthMargins)
}
Item{
@ -1078,8 +1080,8 @@ Item {
width: ( icList.orientation === Qt.Horizontal ) ? icList.width + spacing : smallSize
height: ( icList.orientation === Qt.Vertical ) ? icList.height + spacing : smallSize
property int spacing: latteView ? 0 : root.iconSize / 2
property int smallSize: Math.max(0.10 * root.iconSize, 16)
property int spacing: latteView ? 0 : containment.iconSize / 2
property int smallSize: Math.max(0.10 * containment.iconSize, 16)
Behavior on opacity{
NumberAnimation { duration: root.durationTime*root.longDuration }
@ -1176,8 +1178,8 @@ Item {
visible: root.dragAreaEnabled
property int maxSize: (((root.hoveredIndex>=0 || dockHoveredIndex>=0 ) || windowPreviewIsShown) && !root.dragSource) ?
root.zoomFactor * (root.iconSize + root.thickMargins) + root.screenEdgeMargin :
root.iconSize + root.thickMargins + root.screenEdgeMargin
root.zoomFactor * (containment.iconSize + root.thickMargins) + root.screenEdgeMargin :
containment.iconSize + root.thickMargins + root.screenEdgeMargin
function onlyLaunchersInList(list){
return list.every(function (item) {
@ -1239,7 +1241,7 @@ Item {
return !latteView.thickAnimated ? latteView.maskManager.thicknessNormal : latteView.maskManager.thicknessZoom;
}
return (root.thickMargins + root.iconSize) * root.zoomFactor;
return (root.thickMargins + containment.iconSize) * root.zoomFactor;
}
//onCurrentPosChanged: console.log("CP :: "+ currentPos + " icW:"+icList.width + " rw: "+root.width + " w:" +width);
@ -1360,7 +1362,7 @@ Item {
id: newDroppedLauncherVisual
anchors.fill: parent
visible: backgroundOpacity > 0
radius: root.iconSize/10
radius: containment.iconSize/10
backgroundOpacity: root.dropNewLauncher && mouseHandler.onlyLaunchers && (root.dragSource == null)? 0.75 : 0
duration: root.durationTime

View File

@ -64,7 +64,7 @@ Item{
} else if (!inAttentionAnimation && !inMimicParabolicAnimation && !inFastRestoreAnimation) {
return (nScale > 0) ? (taskItem.spacersMaxSize * nScale) + separatorSpace : separatorSpace;
} else {
return (nScale > 0) ? (root.iconSize * nScale) + separatorSpace : separatorSpace;
return (nScale > 0) ? (containment.iconSize * nScale) + separatorSpace : separatorSpace;
}
}
}

View File

@ -119,12 +119,12 @@ Item{
TitleTooltipParent{
id: titleTooltipParent
thickness: root.zoomFactor * (root.iconSize + root.thickMargins)
thickness: root.zoomFactor * (containment.iconSize + root.thickMargins)
}
TitleTooltipParent{
id: previewsTooltipParent
thickness: root.zoomFactor * (root.iconSize + root.thickMargins) + 1
thickness: root.zoomFactor * (containment.iconSize + root.thickMargins) + 1
}
//!
@ -186,12 +186,12 @@ Item{
}
}
property int zoomedSize: root.zoomFactor * root.iconSize
property int zoomedSize: root.zoomFactor * containment.iconSize
property real basicScalingWidth : wrapper.inTempScaling ? (root.iconSize * wrapper.scaleWidth) :
root.iconSize * wrapper.mScale
property real basicScalingHeight : wrapper.inTempScaling ? (root.iconSize * wrapper.scaleHeight) :
root.iconSize * wrapper.mScale
property real basicScalingWidth : wrapper.inTempScaling ? (containment.iconSize * wrapper.scaleWidth) :
containment.iconSize * wrapper.mScale
property real basicScalingHeight : wrapper.inTempScaling ? (containment.iconSize * wrapper.scaleHeight) :
containment.iconSize * wrapper.mScale
property real newTempSize: {
if (wrapper.opacity === 1 ) {
@ -600,8 +600,8 @@ Item{
height: !root.vertical ? thickness : length
anchors.centerIn: parent
readonly property int length: root.iconSize + root.lengthMargins
readonly property int thickness: root.iconSize + root.thickMargins
readonly property int length: containment.iconSize + root.lengthMargins
readonly property int thickness: containment.iconSize + root.thickMargins
readonly property real applyOpacity: root.dropNewLauncher && !mouseHandler.onlyLaunchers
&& (root.dragSource == null) && (mouseHandler.hoveredItem === taskItem) ? 0.7 : 0
@ -788,7 +788,7 @@ Item{
if(!running){
var halfZoom = 1 + ((root.zoomFactor - 1) / 2);
wrapper.calculateScales((root.iconSize+root.thickMargins)/2);
wrapper.calculateScales((containment.iconSize+root.thickMargins)/2);
taskItem.animationEnded();
// root.animations--;

View File

@ -64,7 +64,7 @@ Item {
if (showsAudioBadge) {
return height;
} else if ( index === parabolicManager.firstRealTaskIndex && !taskItem.containsMouse) {
return (wrapper.mScale * (root.iconSize - (root.enableShadows ? shadowSize/2 : 0)));
return (wrapper.mScale * (containment.iconSize - (root.enableShadows ? shadowSize/2 : 0)));
} else {
return 999999;
}

View File

@ -60,13 +60,13 @@ Loader{
id: taskNumber
// 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: containment.iconSize < 48
anchors.left: centerInParent? undefined : parent.left
anchors.top: centerInParent? undefined : parent.top
anchors.centerIn: centerInParent? parent : undefined
minimumWidth: 0.4 * (wrapper.mScale * root.iconSize)
height: Math.max(24, 0.4 * (wrapper.mScale * root.iconSize))
minimumWidth: 0.4 * (wrapper.mScale * containment.iconSize)
height: Math.max(24, 0.4 * (wrapper.mScale * containment.iconSize))
style3d: root.badges3DStyle
textValue: shorcutBadge.badgeString

View File

@ -52,7 +52,7 @@ MouseArea{
if (isSeparator) {
if (root.vertical) {
return root.iconSize + root.thickMargins + root.screenEdgeMargin;
return containment.iconSize + root.thickMargins + root.screenEdgeMargin;
} else {
if (root.dragSource || !root.parabolicEffectEnabled) {
return LatteCore.Environment.separatorLength+2*root.lengthExtMargin;
@ -79,7 +79,7 @@ MouseArea{
if (isSeparator) {
if (!root.vertical) {
return root.iconSize + root.thickMargins + root.screenEdgeMargin;
return containment.iconSize + root.thickMargins + root.screenEdgeMargin;
} else {
if (root.dragSource || !root.parabolicEffectEnabled) {
return LatteCore.Environment.separatorLength+2*root.lengthExtMargin;
@ -137,7 +137,7 @@ MouseArea{
property bool isWindow: (IsWindow === true) ? true : false
property bool isZoomed: false
property bool canPublishGeometries: (isWindow || isStartup || isGroupParent) && visible && width>=root.iconSize && height>=root.iconSize
property bool canPublishGeometries: (isWindow || isStartup || isGroupParent) && visible && width>=containment.iconSize && height>=containment.iconSize
&& !taskItem.delayingRemove
&& (wrapper.mScale===1 || wrapper.mScale===root.zoomFactor) //don't publish during zoomFactor
@ -153,7 +153,7 @@ MouseArea{
property int pressX: -1
property int pressY: -1
property int resistanceDelay: 450
property int spacersMaxSize: Math.max(0,Math.ceil(0.55*root.iconSize) - root.lengthMargins)
property int spacersMaxSize: Math.max(0,Math.ceil(0.55*containment.iconSize) - root.lengthMargins)
property int windowsCount: subWindows.windowsCount
property int windowsMinimizedCount: subWindows.windowsMinimized
@ -344,8 +344,8 @@ MouseArea{
opacity: (separatorShadow.active) || forceHiddenState ? 0 : 0.4
visible: taskItem.isSeparator
width: root.vertical ? root.iconSize : ((root.dragSource || root.editMode) ? LatteCore.Environment.separatorLength+root.lengthMargins: 1)
height: !root.vertical ? root.iconSize : ((root.dragSource || root.editMode) ? LatteCore.Environment.separatorLength+root.lengthMargins: 1)
width: root.vertical ? containment.iconSize : ((root.dragSource || root.editMode) ? LatteCore.Environment.separatorLength+root.lengthMargins: 1)
height: !root.vertical ? containment.iconSize : ((root.dragSource || root.editMode) ? LatteCore.Environment.separatorLength+root.lengthMargins: 1)
property bool forceHiddenState: false
@ -421,8 +421,8 @@ MouseArea{
Rectangle {
anchors.centerIn: parent
width: root.vertical ? root.iconSize - 4 : 1
height: !root.vertical ? root.iconSize - 4 : 1
width: root.vertical ? containment.iconSize - 4 : 1
height: !root.vertical ? containment.iconSize - 4 : 1
color: enforceLattePalette ? latteBridge.palette.textColor : theme.textColor
}
@ -1305,7 +1305,7 @@ MouseArea{
var adjX = Math.min(limits.x+limits.width, Math.max(limits.x, globalChoords.x));
var adjY = Math.min(limits.y+limits.height, Math.max(limits.y, globalChoords.y));
var length = root.iconSize * wrapper.mScale;
var length = containment.iconSize * wrapper.mScale;
var thickness = length;
//! Magic Lamp effect doesn't like coordinates outside the screen and

View File

@ -27,7 +27,7 @@ Item{
width: root.vertical ? thickness : size
height: root.vertical ? size : thickness
property int size: 1// root.iconSize
property int size: 1
property int thickness: 64
//border.width: 1
//border.color: "green"

View File

@ -36,7 +36,7 @@ Item{
if (!root.vertical)
return 0;
else
return (root.iconSize + root.widthMargins + root.screenEdgeMargin);
return (containment.iconSize + root.widthMargins + root.screenEdgeMargin);
}
if (taskItem.isStartup && root.durationTime !==0 ) {
@ -54,7 +54,7 @@ Item{
if (root.vertical)
return 0;
else
return (root.iconSize + root.heightMargins + root.screenEdgeMargin);
return (containment.iconSize + root.heightMargins + root.screenEdgeMargin);
}
if (taskItem.isStartup && root.durationTime !==0){
@ -64,8 +64,8 @@ Item{
}
}
property int maxThickness: !root.vertical ? root.zoomFactor*(root.iconSize+root.heightMargins)
: root.zoomFactor*(root.iconSize+root.widthMargins)
property int maxThickness: !root.vertical ? root.zoomFactor*(containment.iconSize+root.heightMargins)
: root.zoomFactor*(containment.iconSize+root.widthMargins)
property real showDelegateWidth: basicScalingWidth
property real showDelegateHeight: basicScalingHeight
@ -81,17 +81,17 @@ Item{
property real scaleWidth: (inTempScaling == true) ? tempScaleWidth : mScale
property real scaleHeight: (inTempScaling == true) ? tempScaleHeight : mScale
property real cleanScalingWidth: (root.iconSize + root.widthMargins) * mScale
property real cleanScalingHeight: (root.iconSize + root.heightMargins) * mScale
property real cleanScalingWidth: (containment.iconSize + root.widthMargins) * mScale
property real cleanScalingHeight: (containment.iconSize + root.heightMargins) * mScale
property real basicScalingWidth : (inTempScaling == true) ? ((root.iconSize + root.widthMargins) * scaleWidth) : cleanScalingWidth
property real basicScalingHeight : (inTempScaling == true) ? ((root.iconSize + root.heightMargins) * scaleHeight) : cleanScalingHeight
property real basicScalingWidth : (inTempScaling == true) ? ((containment.iconSize + root.widthMargins) * scaleWidth) : cleanScalingWidth
property real basicScalingHeight : (inTempScaling == true) ? ((containment.iconSize + root.heightMargins) * scaleHeight) : cleanScalingHeight
property real regulatorWidth: taskItem.isSeparator ? width : basicScalingWidth;
property real regulatorHeight: taskItem.isSeparator ? height : basicScalingHeight;
property real visualScaledWidth: (root.iconSize + root.internalWidthMargins) * mScale
property real visualScaledHeight: (root.iconSize + root.internalHeightMargins) * mScale
property real visualScaledWidth: (containment.iconSize + root.internalWidthMargins) * mScale
property real visualScaledHeight: (containment.iconSize + root.internalHeightMargins) * mScale
/// end of Scalers///////
//property int curIndex: icList.hoveredIndex

View File

@ -150,10 +150,10 @@ Item{
if( (root.location === PlasmaCore.Types.BottomEdge) ||
(root.location === PlasmaCore.Types.RightEdge) ){
componentRemoveAnimation.toPoint = tempPoint + root.iconSize;
componentRemoveAnimation.toPoint = tempPoint + containment.iconSize;
}
else{
componentRemoveAnimation.toPoint = tempPoint - root.iconSize;
componentRemoveAnimation.toPoint = tempPoint - containment.iconSize;
}
visible = true;

View File

@ -61,8 +61,8 @@ Item {
readonly property int windowsCount: taskIsValid ? taskItem.windowsCount : 0
readonly property int windowsMinimizedCount: taskIsValid ? taskItem.windowsMinimizedCount : 0
readonly property int currentIconSize: root.iconSize
readonly property int maxIconSize: root.maxIconSize
readonly property int currentIconSize: containment.iconSize
readonly property int maxIconSize: containment.maxIconSize
readonly property real scaleFactor: taskIsValid ? taskItem.wrapperAlias.mScale : 1
readonly property real panelOpacity: root.currentPanelOpacity
readonly property color shadowColor: root.appShadowColorSolid

View File

@ -60,8 +60,8 @@ Loader {
readonly property bool locked: inAttentionAnimation || inNewWindowAnimation || inBouncingAnimation
property real visualLockedWidth: root.vertical ? root.screenEdgeMargin + root.iconSize + root.internalWidthMargins : root.iconSize + root.internalWidthMargins
property real visualLockedHeight: !root.vertical ? root.screenEdgeMargin + root.iconSize + root.internalHeightMargins : root.iconSize + root.internalHeightMargins
property real visualLockedWidth: root.vertical ? root.screenEdgeMargin + containment.iconSize + root.internalWidthMargins : containment.iconSize + root.internalWidthMargins
property real visualLockedHeight: !root.vertical ? root.screenEdgeMargin + containment.iconSize + root.internalHeightMargins : containment.iconSize + root.internalHeightMargins
//! Connections !//

View File

@ -26,8 +26,8 @@ Item {
id: shadowsContainer
opacity: 0.4
readonly property int gradientLength: root.iconSize / 3
readonly property int thickness: latteView ? latteView.realPanelSize : root.iconSize + root.thickMargins
readonly property int gradientLength: containment.iconSize / 3
readonly property int thickness: latteView ? latteView.realPanelSize : containment.iconSize + root.thickMargins
readonly property color appliedColor: root.appShadowColorSolid
property Item flickable

View File

@ -24,7 +24,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
Item {
readonly property int gradientLength: root.iconSize / 3
readonly property int gradientLength: containment.iconSize / 3
LinearGradient {
id: firstGradient

View File

@ -56,10 +56,10 @@ Flickable{
readonly property int scrollFirstPos: 0
readonly property int scrollLastPos: contentsExtraSpace
readonly property int scrollStep: root.iconSize * 1.5
readonly property int scrollStep: containment.iconSize * 1.5
readonly property int currentPos: !root.vertical ? contentX : contentY
readonly property int autoScrollTriggerLength: root.iconSize + root.lengthMargins/2
readonly property int autoScrollTriggerLength: containment.iconSize + root.lengthMargins/2
readonly property int alignment: {
if (root.location === PlasmaCore.Types.LeftEdge) {
@ -140,18 +140,18 @@ Flickable{
if (!root.vertical) {
if (cP.x < 0) {
distance = Math.abs(cP.x - root.iconSize);
distance = Math.abs(cP.x - containment.iconSize);
decreasePosWithStep(distance);
} else if ((cP.x+task.width) > scrollableList.width) {
distance = Math.abs(cP.x - scrollableList.width + task.width + root.iconSize);
distance = Math.abs(cP.x - scrollableList.width + task.width + containment.iconSize);
increasePosWithStep(distance);
}
} else {
if (cP.y < 0) {
distance = Math.abs(cP.y - root.iconSize);
distance = Math.abs(cP.y - containment.iconSize);
decreasePosWithStep(distance);
} else if ((cP.y+task.height) > scrollableList.height) {
distance = Math.abs(cP.y - scrollableList.height + task.height + root.iconSize);
distance = Math.abs(cP.y - scrollableList.height + task.height + containment.iconSize);
increasePosWithStep(distance);
}
}
@ -176,15 +176,15 @@ Flickable{
if (!root.vertical) {
if (currentPos !== scrollFirstPos && cP.x < autoScrollTriggerLength) {
decreasePosWithStep(root.iconSize*1.5);
decreasePosWithStep(containment.iconSize*1.5);
} else if (currentPos !== scrollLastPos && (cP.x+task.width > (scrollableList.width-autoScrollTriggerLength))) {
increasePosWithStep(root.iconSize*1.5);
increasePosWithStep(containment.iconSize*1.5);
}
} else {
if (currentPos !== scrollFirstPos && cP.y < autoScrollTriggerLength) {
decreasePosWithStep(root.iconSize*1.5);
decreasePosWithStep(containment.iconSize*1.5);
} else if (currentPos !== scrollLastPos && (cP.y+task.height > (scrollableList.height-autoScrollTriggerLength))) {
increasePosWithStep(root.iconSize*1.5);
increasePosWithStep(containment.iconSize*1.5);
}
}