mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 01:33:50 +03:00
update view alignment to new architecture
--view alignment can now be updated either by editdock window or through views dialog in settings window
This commit is contained in:
parent
15039f7b8b
commit
b235e6cc96
@ -1499,7 +1499,7 @@ void GenericLayout::updateView(const Latte::Data::View &viewData)
|
||||
}
|
||||
|
||||
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) {
|
||||
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_repositionFromViewSettingsWindow = m_view->settingsWindowIsShown();
|
||||
|
||||
|
@ -1654,6 +1654,7 @@ void View::restoreConfig()
|
||||
|
||||
auto config = this->containment()->config();
|
||||
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_isPreferredForShortcuts = config.readEntry("isPreferredForShortcuts", false);
|
||||
m_name = config.readEntry("name", QString());
|
||||
|
@ -398,7 +398,7 @@ Item{
|
||||
onXChanged: updateMaskArea();
|
||||
onYChanged: updateMaskArea()
|
||||
onWidthChanged: updateMaskArea();
|
||||
onHeightChanged: updateMaskArea();
|
||||
onHeightChanged: updateMaskArea();
|
||||
}
|
||||
|
||||
Connections{
|
||||
|
@ -92,7 +92,6 @@ AbilityHost.MyView {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function decimalToHex(d, padding) {
|
||||
var hex = Number(d).toString(16);
|
||||
padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding;
|
||||
|
@ -334,7 +334,7 @@ Item{
|
||||
}
|
||||
|
||||
transitions: Transition {
|
||||
enabled: root.editMode
|
||||
enabled: !visibilityManager.inRelocationAnimation && !root.inStartup
|
||||
AnchorAnimation {
|
||||
duration: 0.8 * animations.duration.proposed
|
||||
easing.type: Easing.OutCubic
|
||||
|
@ -451,30 +451,30 @@ Item {
|
||||
updateIndexes();
|
||||
}
|
||||
|
||||
//! It is used only when the user chooses different alignment types
|
||||
//! and not during startup
|
||||
//! It is used only when the user chooses different alignment types and not during startup
|
||||
Connections {
|
||||
target: myView
|
||||
target: latteView ? latteView : null
|
||||
onAlignmentChanged: {
|
||||
if (!root.editMode) {
|
||||
if (latteView.alignment === LatteCore.Types.NoneAlignment) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (root.editMode){
|
||||
if (root.myView.alignment===LatteCore.Types.Justify) {
|
||||
layouter.appletsInParentChange = true;
|
||||
fastLayoutManager.addJustifySplittersInMainLayout();
|
||||
console.log("LAYOUTS: Moving applets from MAIN to THREE Layouts mode...");
|
||||
fastLayoutManager.moveAppletsBasedOnJustifyAlignment();
|
||||
layouter.appletsInParentChange = false;
|
||||
} else {
|
||||
layouter.appletsInParentChange = true;
|
||||
console.log("LAYOUTS: Moving applets from THREE to MAIN Layout mode...");
|
||||
fastLayoutManager.joinLayoutsToMainLayout();
|
||||
layouter.appletsInParentChange = false;
|
||||
}
|
||||
var previousalignment = plasmoid.configuration.alignment;
|
||||
|
||||
if (latteView.alignment===LatteCore.Types.Justify && previousalignment!==LatteCore.Types.Justify) { // main -> justify
|
||||
layouter.appletsInParentChange = true;
|
||||
fastLayoutManager.addJustifySplittersInMainLayout();
|
||||
console.log("LAYOUTS: Moving applets from MAIN to THREE Layouts mode...");
|
||||
fastLayoutManager.moveAppletsBasedOnJustifyAlignment();
|
||||
layouter.appletsInParentChange = false;
|
||||
} else if (latteView.alignment!==LatteCore.Types.Justify && previousalignment===LatteCore.Types.Justify ) { // justify ->main
|
||||
layouter.appletsInParentChange = true;
|
||||
console.log("LAYOUTS: Moving applets from THREE to MAIN Layout mode...");
|
||||
fastLayoutManager.joinLayoutsToMainLayout();
|
||||
layouter.appletsInParentChange = false;
|
||||
}
|
||||
|
||||
plasmoid.configuration.alignment = latteView.alignment;
|
||||
fastLayoutManager.save();
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ PlasmaComponents.Page {
|
||||
|
||||
onPressedChanged: {
|
||||
if (pressed) {
|
||||
plasmoid.configuration.alignment = alignment
|
||||
latteView.positioner.setNextLocation("", "", PlasmaCore.Types.Floating, alignment);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -317,7 +317,7 @@ PlasmaComponents.Page {
|
||||
|
||||
onPressedChanged: {
|
||||
if (pressed) {
|
||||
plasmoid.configuration.alignment = alignment
|
||||
latteView.positioner.setNextLocation("", "", PlasmaCore.Types.Floating, alignment);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -334,7 +334,7 @@ PlasmaComponents.Page {
|
||||
|
||||
onPressedChanged: {
|
||||
if (pressed) {
|
||||
plasmoid.configuration.alignment = alignment
|
||||
latteView.positioner.setNextLocation("", "", PlasmaCore.Types.Floating, alignment);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -352,7 +352,7 @@ PlasmaComponents.Page {
|
||||
|
||||
onPressedChanged: {
|
||||
if (pressed) {
|
||||
plasmoid.configuration.alignment = alignment
|
||||
latteView.positioner.setNextLocation("", "", PlasmaCore.Types.Floating, alignment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user