|
|
|
@ -23,6 +23,8 @@ import QtQuick 2.1
|
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
|
|
|
|
|
|
import org.kde.latte 0.1 as Latte
|
|
|
|
|
|
|
|
|
|
Image{
|
|
|
|
|
id: editVisual
|
|
|
|
|
width: root.isHorizontal ? root.maxLength : visibilityManager.thicknessNormalOriginalValue
|
|
|
|
@ -67,6 +69,7 @@ Image{
|
|
|
|
|
Connections{
|
|
|
|
|
target: root
|
|
|
|
|
onIconSizeChanged: initializeEditPosition();
|
|
|
|
|
onPanelAlignmentChanged: initializeEditPosition();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onRootThicknessChanged: {
|
|
|
|
@ -95,34 +98,70 @@ Image{
|
|
|
|
|
|
|
|
|
|
function initializeNormalPosition() {
|
|
|
|
|
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
|
|
|
|
|
x = root.width/2 - root.maxLength/2;
|
|
|
|
|
y = rootThickness;
|
|
|
|
|
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
|
|
|
|
|
x = rootThickness;
|
|
|
|
|
y = 0;
|
|
|
|
|
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
|
|
|
|
|
x = -editVisual.thickness;
|
|
|
|
|
y = 0;
|
|
|
|
|
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
|
|
|
|
|
x = root.width/2 - root.maxLength/2;
|
|
|
|
|
y = -editVisual.thickness;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (root.isHorizontal) {
|
|
|
|
|
if (plasmoid.configuration.panelPosition === Latte.Dock.Justify) {
|
|
|
|
|
x = root.width/2 - root.maxLength/2;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Left) {
|
|
|
|
|
x = 0;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Center) {
|
|
|
|
|
x = root.width/2 - root.maxLength/2;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Right) {
|
|
|
|
|
x = root.width - root.maxLength;
|
|
|
|
|
}
|
|
|
|
|
} else if (root.isVertical) {
|
|
|
|
|
if (plasmoid.configuration.panelPosition === Latte.Dock.Justify) {
|
|
|
|
|
y = root.height/2 - root.maxLength/2;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Top) {
|
|
|
|
|
y = 0;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Center) {
|
|
|
|
|
y = root.height/2 - root.maxLength/2;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Bottom) {
|
|
|
|
|
y = root.height - root.maxLength;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function initializeEditPosition() {
|
|
|
|
|
if (root.editMode) {
|
|
|
|
|
if (plasmoid.location === PlasmaCore.Types.LeftEdge){
|
|
|
|
|
x = 0;
|
|
|
|
|
y = root.height/2 - editVisual.height/2;
|
|
|
|
|
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
|
|
|
|
|
x = root.width/2 - editVisual.width/2;
|
|
|
|
|
y = 0;
|
|
|
|
|
} else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
|
|
|
|
|
x = root.width/2 - editVisual.width/2;
|
|
|
|
|
y = rootThickness - thickness + shadowSize;
|
|
|
|
|
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
|
|
|
|
|
x = rootThickness - thickness + shadowSize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (root.isHorizontal) {
|
|
|
|
|
if (plasmoid.configuration.panelPosition === Latte.Dock.Justify) {
|
|
|
|
|
x = root.width/2 - editVisual.width/2;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Left) {
|
|
|
|
|
x = 0;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Center) {
|
|
|
|
|
x = root.width/2 - editVisual.width/2;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Right) {
|
|
|
|
|
x = root.width - editVisual.width;
|
|
|
|
|
}
|
|
|
|
|
} else if (root.isVertical) {
|
|
|
|
|
if (plasmoid.configuration.panelPosition === Latte.Dock.Justify) {
|
|
|
|
|
y = root.height/2 - editVisual.height/2;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Top) {
|
|
|
|
|
y = 0;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Center) {
|
|
|
|
|
y = root.height/2 - editVisual.height/2;
|
|
|
|
|
} else if (root.panelAlignment === Latte.Dock.Bottom) {
|
|
|
|
|
y = root.height - editVisual.height;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|