update view alignment to new architecture

--view alignment can now be updated either by
editdock window or through views dialog in
settings window
work/spdx
Michail Vourlakos 4 years ago
parent 15039f7b8b
commit b235e6cc96

@ -1499,7 +1499,7 @@ void GenericLayout::updateView(const Latte::Data::View &viewData)
} }
view->setName(viewData.name); view->setName(viewData.name);
view->positioner()->setNextLocation("", scrName, viewData.edge, Latte::Types::NoneAlignment); view->positioner()->setNextLocation("", scrName, viewData.edge, viewData.alignment);
} }
} }

@ -971,6 +971,12 @@ void Positioner::initSignalingForLocationChangeSliding()
if (m_nextScreenEdge != Plasma::Types::Floating) { if (m_nextScreenEdge != Plasma::Types::Floating) {
m_view->setLocation(m_nextScreenEdge); m_view->setLocation(m_nextScreenEdge);
} }
//! ALIGNMENT
if (m_nextAlignment != Latte::Types::NoneAlignment && m_nextAlignment != m_view->alignment()) {
m_view->setAlignment(m_nextAlignment);
m_nextAlignment = Latte::Types::NoneAlignment;
}
}); });
} }
@ -1120,6 +1126,12 @@ void Positioner::setNextLocation(const QString layoutName, const QString screenN
} }
} }
//! ALIGNMENT
if (alignment != Latte::Types::NoneAlignment && m_view->alignment() != alignment) {
m_nextAlignment = static_cast<Latte::Types::Alignment>(alignment);
haschanges = true;
}
m_repositionIsAnimated = isanimated; m_repositionIsAnimated = isanimated;
m_repositionFromViewSettingsWindow = m_view->settingsWindowIsShown(); m_repositionFromViewSettingsWindow = m_view->settingsWindowIsShown();

@ -1654,6 +1654,7 @@ void View::restoreConfig()
auto config = this->containment()->config(); auto config = this->containment()->config();
m_onPrimary = config.readEntry("onPrimary", true); m_onPrimary = config.readEntry("onPrimary", true);
m_alignment = static_cast<Latte::Types::Alignment>(config.group("General").readEntry("alignment", (int)Latte::Types::Center));
m_byPassWM = config.readEntry("byPassWM", false); m_byPassWM = config.readEntry("byPassWM", false);
m_isPreferredForShortcuts = config.readEntry("isPreferredForShortcuts", false); m_isPreferredForShortcuts = config.readEntry("isPreferredForShortcuts", false);
m_name = config.readEntry("name", QString()); m_name = config.readEntry("name", QString());

@ -92,7 +92,6 @@ AbilityHost.MyView {
} }
} }
function decimalToHex(d, padding) { function decimalToHex(d, padding) {
var hex = Number(d).toString(16); var hex = Number(d).toString(16);
padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding; padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding;

@ -334,7 +334,7 @@ Item{
} }
transitions: Transition { transitions: Transition {
enabled: root.editMode enabled: !visibilityManager.inRelocationAnimation && !root.inStartup
AnchorAnimation { AnchorAnimation {
duration: 0.8 * animations.duration.proposed duration: 0.8 * animations.duration.proposed
easing.type: Easing.OutCubic easing.type: Easing.OutCubic

@ -451,30 +451,30 @@ Item {
updateIndexes(); updateIndexes();
} }
//! It is used only when the user chooses different alignment types //! It is used only when the user chooses different alignment types and not during startup
//! and not during startup
Connections { Connections {
target: myView target: latteView ? latteView : null
onAlignmentChanged: { onAlignmentChanged: {
if (!root.editMode) { if (latteView.alignment === LatteCore.Types.NoneAlignment) {
return; return;
} }
if (root.editMode){ var previousalignment = plasmoid.configuration.alignment;
if (root.myView.alignment===LatteCore.Types.Justify) {
layouter.appletsInParentChange = true; if (latteView.alignment===LatteCore.Types.Justify && previousalignment!==LatteCore.Types.Justify) { // main -> justify
fastLayoutManager.addJustifySplittersInMainLayout(); layouter.appletsInParentChange = true;
console.log("LAYOUTS: Moving applets from MAIN to THREE Layouts mode..."); fastLayoutManager.addJustifySplittersInMainLayout();
fastLayoutManager.moveAppletsBasedOnJustifyAlignment(); console.log("LAYOUTS: Moving applets from MAIN to THREE Layouts mode...");
layouter.appletsInParentChange = false; fastLayoutManager.moveAppletsBasedOnJustifyAlignment();
} else { layouter.appletsInParentChange = false;
layouter.appletsInParentChange = true; } else if (latteView.alignment!==LatteCore.Types.Justify && previousalignment===LatteCore.Types.Justify ) { // justify ->main
console.log("LAYOUTS: Moving applets from THREE to MAIN Layout mode..."); layouter.appletsInParentChange = true;
fastLayoutManager.joinLayoutsToMainLayout(); console.log("LAYOUTS: Moving applets from THREE to MAIN Layout mode...");
layouter.appletsInParentChange = false; fastLayoutManager.joinLayoutsToMainLayout();
} layouter.appletsInParentChange = false;
} }
plasmoid.configuration.alignment = latteView.alignment;
fastLayoutManager.save(); fastLayoutManager.save();
} }
} }

@ -300,7 +300,7 @@ PlasmaComponents.Page {
onPressedChanged: { onPressedChanged: {
if (pressed) { if (pressed) {
plasmoid.configuration.alignment = alignment latteView.positioner.setNextLocation("", "", PlasmaCore.Types.Floating, alignment);
} }
} }
} }
@ -317,7 +317,7 @@ PlasmaComponents.Page {
onPressedChanged: { onPressedChanged: {
if (pressed) { if (pressed) {
plasmoid.configuration.alignment = alignment latteView.positioner.setNextLocation("", "", PlasmaCore.Types.Floating, alignment);
} }
} }
} }
@ -334,7 +334,7 @@ PlasmaComponents.Page {
onPressedChanged: { onPressedChanged: {
if (pressed) { if (pressed) {
plasmoid.configuration.alignment = alignment latteView.positioner.setNextLocation("", "", PlasmaCore.Types.Floating, alignment);
} }
} }
} }
@ -352,7 +352,7 @@ PlasmaComponents.Page {
onPressedChanged: { onPressedChanged: {
if (pressed) { if (pressed) {
plasmoid.configuration.alignment = alignment latteView.positioner.setNextLocation("", "", PlasmaCore.Types.Floating, alignment);
} }
} }
} }

Loading…
Cancel
Save