improve LayoutManager qml references

pull/4/head
Michail Vourlakos 6 years ago
parent e81ef199b3
commit 81335bc92f

@ -96,9 +96,9 @@ MouseArea {
if ((plasmoid.formFactor === PlasmaCore.Types.Vertical && posInItem.y < item.height/2) || if ((plasmoid.formFactor === PlasmaCore.Types.Vertical && posInItem.y < item.height/2) ||
(plasmoid.formFactor !== PlasmaCore.Types.Vertical && posInItem.x < item.width/2)) { (plasmoid.formFactor !== PlasmaCore.Types.Vertical && posInItem.x < item.width/2)) {
root.layoutManager.insertBefore(item, placeHolder); root.layoutManagerInsertBefore(item, placeHolder);
} else { } else {
root.layoutManager.insertAfter(item, placeHolder); root.layoutManagerInsertAfter(item, placeHolder);
} }
} }
@ -198,7 +198,7 @@ MouseArea {
placeHolder.height = currentApplet.height; placeHolder.height = currentApplet.height;
handle.width = currentApplet.width; handle.width = currentApplet.width;
handle.height = currentApplet.height; handle.height = currentApplet.height;
root.layoutManager.insertBefore(currentApplet, placeHolder); root.layoutManagerInsertBefore(currentApplet, placeHolder);
currentApplet.parent = root; currentApplet.parent = root;
currentApplet.x = lastX-appletX; currentApplet.x = lastX-appletX;
currentApplet.y = lastY-appletY; currentApplet.y = lastY-appletY;
@ -221,7 +221,7 @@ MouseArea {
configurationArea.isResizingLeft = false; configurationArea.isResizingLeft = false;
configurationArea.isResizingRight = false; configurationArea.isResizingRight = false;
root.layoutManager.insertBefore(placeHolder, currentApplet); root.layoutManagerInsertBefore(placeHolder, currentApplet);
placeHolder.parent = configurationArea; placeHolder.parent = configurationArea;
currentApplet.z = 1; currentApplet.z = 1;
@ -231,7 +231,7 @@ MouseArea {
handle.y = relevantLayout.y + currentApplet.y; handle.y = relevantLayout.y + currentApplet.y;
// handle.width = currentApplet.width; // handle.width = currentApplet.width;
// handle.height = currentApplet.height; // handle.height = currentApplet.height;
root.layoutManager.save(); root.layoutManagerSave();
} }
onWheel: { onWheel: {
@ -489,7 +489,7 @@ MouseArea {
onCheckedChanged: { onCheckedChanged: {
currentApplet.lockZoom = checked; currentApplet.lockZoom = checked;
root.layoutManager.saveLocks(); root.layoutManagerSaveLocks();
} }
} }

@ -51,7 +51,7 @@ Item{
property rect efGeometry property rect efGeometry
property string layoutColor: root.latteViewManagedLayout ? root.latteViewManagedLayout.color : "blue" property string layoutColor: latteView && latteView.managedLayout ? latteView.managedLayout.color : "blue"
Item{ Item{

@ -193,7 +193,7 @@ Item{
Connections{ Connections{
target: universalLayoutManager target: universalLayoutManager
onCurrentLayoutIsSwitching: { onCurrentLayoutIsSwitching: {
if (Latte.WindowSystem.compositingActive && root.latteViewManagedLayout && root.latteViewManagedLayout.name === layoutName) { if (Latte.WindowSystem.compositingActive && latteView && latteView.managedLayout && latteView.managedLayout.name === layoutName) {
manager.inTempHiding = true; manager.inTempHiding = true;
manager.inForceHiding = true; manager.inForceHiding = true;
root.clearZoom(); root.clearZoom();

@ -338,7 +338,6 @@ DragDrop.DropArea {
} }
property var iconsArray: [16, 22, 32, 48, 64, 96, 128, 256] property var iconsArray: [16, 22, 32, 48, 64, 96, 128, 256]
property var layoutManager: LayoutManager
property Item dragOverlay property Item dragOverlay
property Item toolBox property Item toolBox
@ -717,7 +716,7 @@ DragDrop.DropArea {
LayoutManager.root = root; LayoutManager.root = root;
LayoutManager.layout = layoutsContainer.mainLayout; LayoutManager.layout = layoutsContainer.mainLayout;
LayoutManager.layoutS = layoutsContainer.startLayout; LayoutManager.layoutS = layoutsContainer.startLayout;
layoutManager.layoutE = layoutsContainer.endLayout; LayoutManager.layoutE = layoutsContainer.endLayout;
LayoutManager.lastSpacer = lastSpacer; LayoutManager.lastSpacer = lastSpacer;
LayoutManager.restore(); LayoutManager.restore();
plasmoid.action("configure").visible = !plasmoid.immutable; plasmoid.action("configure").visible = !plasmoid.immutable;
@ -947,12 +946,12 @@ DragDrop.DropArea {
container.visible = true; container.visible = true;
if(pos>=0 ){ if(pos>=0 ){
layoutManager.insertAtIndex(container, pos); LayoutManager.insertAtIndex(container, pos);
} else { } else {
layoutManager.insertAtIndex(container, Math.floor(layoutsContainer.mainLayout.count / 2)); LayoutManager.insertAtIndex(container, Math.floor(layoutsContainer.mainLayout.count / 2));
} }
layoutManager.save(); LayoutManager.save();
} }
} }
@ -1071,6 +1070,22 @@ DragDrop.DropArea {
} }
} }
function layoutManagerInsertBefore(place, item) {
LayoutManager.insertBefore(place, item);
}
function layoutManagerInsertAfter(place, item) {
LayoutManager.insertAfter(place, item);
}
function layoutManagerSave() {
LayoutManager.save();
}
function layoutManagerSaveLocks() {
LayoutManager.saveLocks();
}
function mouseInCanBeHoveredApplet(){ function mouseInCanBeHoveredApplet(){
if (latteApplet && latteApplet.containsMouse()) if (latteApplet && latteApplet.containsMouse())
return true; return true;
@ -1120,7 +1135,7 @@ DragDrop.DropArea {
item.destroy(); item.destroy();
} }
layoutManager.save(); LayoutManager.save();
} }
function setHoveredIndex(ind) { function setHoveredIndex(ind) {

Loading…
Cancel
Save