fixes for justify alignment arrangement

work/spdx
Michail Vourlakos 4 years ago
parent 2e7dcb5428
commit 2fd5f51e8d

@ -665,6 +665,7 @@ void ContainmentInterface::moveAppletsInJustifyAlignment(QQuickItem *start, QQui
if (issplitter) { if (issplitter) {
secondSplitterFound = true; secondSplitterFound = true;
splitter2 = i; splitter2 = i;
appletlist[i]->setParentItem(end);
} else { } else {
appletlist[i]->setParentItem(main); appletlist[i]->setParentItem(main);
} }
@ -673,11 +674,13 @@ void ContainmentInterface::moveAppletsInJustifyAlignment(QQuickItem *start, QQui
} }
} }
if (splitter1>0) { for(int i=0; i<appletlist.count()-2; ++i) {
appletlist[splitter1]->stackAfter(appletlist[splitter1 - 1]); QQuickItem *before = appletlist[i];
QQuickItem *after = appletlist[i+1];
if (before->parentItem() == after->parentItem()) {
before->stackBefore(after);
} }
if (splitter2>0 && splitter2<appletlist.count()-1) {
appletlist[splitter2]->stackBefore(appletlist[splitter2 + 1]);
} }
} }

@ -112,7 +112,7 @@ function restore() {
inRestore = false; inRestore = false;
if (plasmoid.configuration.alignment === 10/*Justify*/) { if (plasmoid.configuration.alignment === 10/*Justify*/) {
root.splitMainLayoutToLayouts(); root.moveAppletsBasedOnJustifyAlignment();
root.updateIndexes(); root.updateIndexes();
} }
} }

@ -219,7 +219,7 @@ DragDrop.DropArea {
dndSpacer.opacity = 0; dndSpacer.opacity = 0;
if (dragInfo.isPlasmoid && root.panelAlignment === LatteCore.Types.Justify) { if (dragInfo.isPlasmoid && root.panelAlignment === LatteCore.Types.Justify) {
root.layoutManagerMoveAppletsBasedOnJustifyAlignment(); root.moveAppletsBasedOnJustifyAlignment();
} }
} }
} }

@ -249,7 +249,7 @@ MouseArea {
// handle.width = currentApplet.width; // handle.width = currentApplet.width;
// handle.height = currentApplet.height; // handle.height = currentApplet.height;
root.layoutManagerSave(); root.layoutManagerSave();
root.layoutManagerMoveAppletsBasedOnJustifyAlignment(); root.moveAppletsBasedOnJustifyAlignment();
root.layouter.appletsInParentChange = false; root.layouter.appletsInParentChange = false;
layouter.updateSizeForAppletsInFill(); layouter.updateSizeForAppletsInFill();
} }

@ -515,7 +515,7 @@ Item {
if (root.editMode){ if (root.editMode){
if (panelAlignment===LatteCore.Types.Justify) { if (panelAlignment===LatteCore.Types.Justify) {
addInternalViewSplittersInMainLayout(); addInternalViewSplittersInMainLayout();
splitMainLayoutToLayouts(); moveAppletsBasedOnJustifyAlignment();
} else { } else {
joinLayoutsToMainLayout(); joinLayoutsToMainLayout();
root.destroyInternalViewSplitters(); root.destroyInternalViewSplitters();
@ -975,10 +975,8 @@ Item {
} }
} }
function layoutManagerMoveAppletsBasedOnJustifyAlignment() { function moveAppletsBasedOnJustifyAlignment() {
if (plasmoid.configuration.alignment !== 10) { layouter.appletsInParentChange = true;
return;
}
if (latteView) { if (latteView) {
latteView.extendedInterface.moveAppletsInJustifyAlignment(layoutsContainer.startLayout, latteView.extendedInterface.moveAppletsInJustifyAlignment(layoutsContainer.startLayout,
@ -989,50 +987,6 @@ Item {
layouter.appletsInParentChange = false; layouter.appletsInParentChange = false;
} }
function splitMainLayoutToLayouts() {
if (internalViewSplittersCount() === 2) {
layouter.appletsInParentChange = true;
console.log("LAYOUTS: Moving applets from MAIN to THREE Layouts mode...");
var splitter = -1;
var splitter2 = -1;
var totalChildren = layoutsContainer.mainLayout.children.length;
for (var i=0; i<totalChildren; ++i) {
var item = layoutsContainer.mainLayout.children[i];
if(item.isInternalViewSplitter && splitter === -1) {
splitter = i;
} else if (item.isInternalViewSplitter && splitter>=0 && splitter2 === -1) {
splitter2 = i;
}
}
// console.log("update layouts 1:"+splitter + " - "+splitter2);
if (splitter > 0) {
for (var i=0; i<=splitter; ++i){
var item = layoutsContainer.mainLayout.children[0];
item.parent = layoutsContainer.startLayout;
}
}
if (splitter2 > 0) {
splitter2 = splitter2 - splitter - 1;
// console.log("update layouts 2:"+splitter + " - "+splitter2);
totalChildren = layoutsContainer.mainLayout.children.length;
for (var i=totalChildren-1; i>=splitter2; --i){
var item = layoutsContainer.mainLayout.children[i];
LayoutManager.insertAtIndex(layoutsContainer.endLayout, item, 0);
}
}
layouter.appletsInParentChange = false;
}
}
function joinLayoutsToMainLayout() { function joinLayoutsToMainLayout() {
layouter.appletsInParentChange = true; layouter.appletsInParentChange = true;

Loading…
Cancel
Save