Introduce ContainmentLayoutManager QML plugin
ClosedPublic

Authored by mart on Jun 23 2019, 11:24 AM.

Details

Summary

This QML plugin offers a reusable, C++ based framework to manage layout
of items (mainly plasmoids but other stuff too) inside Plasma Containments
This will replace the Javascript based plasmoid layout manager inside the
FolderView and Desktop containments (is planned also forPlasma mobile homescreen)
This makes folderview code simpler and layouting more reliable.
Relayouting behavior after screen resolution change improved too, making easier to
keep a similar looking layout

Test Plan

Tested on FolderView, a minimal containment using it may be shipped on the store
if we don't feel to ship the folderview port immediately

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mart created this revision.Jun 23 2019, 11:24 AM
Restricted Application added a project: Plasma. · View Herald TranscriptJun 23 2019, 11:24 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart requested review of this revision.Jun 23 2019, 11:24 AM
ngraham retitled this revision from Introcuce ContainmentLayoutManager QML plugin to Introduce ContainmentLayoutManager QML plugin.Jun 23 2019, 9:31 PM
mart updated this revision to Diff 61576.Jul 11 2019, 10:39 AM
  • allow a limited auto expanding for applets
  • click on empty areas always closes edit mode
  • wire up maximum size
  • start on a new logic for default sizes
  • event comppress sizehints
  • take minimum size into account
  • new behavior for resize handles
mart updated this revision to Diff 61642.Jul 12 2019, 11:37 AM
  • manage differently screen resize and other kind of resizes
  • fix snapping on RTL and BTT positioning
mart updated this revision to Diff 61786.Jul 15 2019, 12:06 PM
  • never auto resize while on edit mode
  • try to restore size as soon as possible
davidedmundson added a subscriber: davidedmundson.EditedJul 17 2019, 4:04 PM

Concept makes sense. I mostly like the layering and architecture, except for all the cases where we end up searching up the hierarchy to find objects. That doesn't seem like the best approach...not that I have anything much better.

I'm not finished, it's a big patch - but I thought I should submit what I have for now.

components/containmentlayoutmanager/abstractlayoutmanager.cpp
111

setPosition

setSize

components/containmentlayoutmanager/abstractlayoutmanager.h
45

I don't fully understand the split between AbstractLayoutManager and GridLayoutManager when AbstractLayoutManager effectively enforces a grid by having cell sizes.

components/containmentlayoutmanager/appletcontainer.cpp
33

How do we know this happens after the busy component is set?

components/containmentlayoutmanager/itemcontainer.cpp
365

scope this in the loop

371

why?

376

no point just wishing, we need to open a bug report at least

439

why?

We're above the minimum size, the user could have resized it smaller than this

components/containmentlayoutmanager/qml/private/BasicResizeHandle.qml
27

ResizeHandle2?

components/containmentlayoutmanager/resizehandle.cpp
43

we monitor the direct parent, but ConfigOverlay could be anywhere on the ancestory tree.

mart updated this revision to Diff 61966.Jul 18 2019, 10:10 AM
mart marked 5 inline comments as done.
  • singal when can't resize
  • make resize work with items that update hints while resizing
  • use setPosition and setSize where possible
  • make sure to connect to busy indicator
  • don't try to assign space when the layout has an invalid size
  • adress some comments
mart added inline comments.Jul 18 2019, 10:11 AM
components/containmentlayoutmanager/abstractlayoutmanager.h
45

in the end it needed cell sizes to be directly exposed to qml.
tough the idea was to leave space for eventual future different layouts like linear, or still grid but with a different strategy and so on

components/containmentlayoutmanager/itemcontainer.cpp
371

I may be wrong but I think if one would do
AppletsLayout {

QtObject {}

}

that internal object wouldn't be parented and stay dangling otherwise?

439

This may be not necessary, depends the behavior we want.
The test i did was with the system monitor, having it auto resize when one adds a sensor seemed to look better...
It depends from usability pov, if instead by design we say the size the user manually put is more important and should be maintained if possible, then this part would go.

components/containmentlayoutmanager/qml/private/BasicResizeHandle.qml
27

dead code of old prototypes

components/containmentlayoutmanager/resizehandle.cpp
43

This will catch it if the overlay is an ancestor..
what it doesn't support is dynamic parent changes somewhere in the tree higher than direct parent.

monitoring every parent of parents and dynamically rebuilding the connection chain when one of them change, seems a bit.. overkill?
not sure how to do this in another way...

components/containmentlayoutmanager/itemcontainer.cpp
371

AFAIK, QML created objects don't use QObject parent.

Instead there's a ref counting thing in the JS engine.

439

If we want to use this in the panel/wherever we need ItemContainer to forward the full min/preferred/max sizes (with margins added) and have the LayoutManager be the one that takes this information and resizes the container.

IMHO it shouldn't resize itself, it should just emit sizeHintChanged

Then in AbstractLayoutManager we have a connect that does the current:

releaseSpace(item)
resizeFromSizeHints(item)
positionItem(item)

It then gives full absolute control to the manager, rather than it doing part and then the item doing part.

mart updated this revision to Diff 61973.Jul 18 2019, 12:15 PM
  • better manage locked plasmoid logic
mart updated this revision to Diff 61976.Jul 18 2019, 1:08 PM
mart marked 3 inline comments as done.
  • no manual parenting
  • move the reaction to size hints in layoutmanager
mart marked an inline comment as done.Jul 18 2019, 1:09 PM
mart added inline comments.
components/containmentlayoutmanager/itemcontainer.cpp
439

same code now moved in the layoutmanager

davidedmundson added inline comments.Jul 18 2019, 2:22 PM
components/containmentlayoutmanager/configoverlay.h
68

Given ItemContainer instantiates this object (or a subclass therefore) can we make this public and call it from ItemContainer::setConfigOverlayVisible

Then we get rid of one of the two searches through parents.

mart updated this revision to Diff 61987.Jul 18 2019, 3:53 PM
mart marked an inline comment as done.
  • set the item container directly
mart marked an inline comment as done.Jul 18 2019, 3:53 PM
davidedmundson accepted this revision.Jul 19 2019, 9:16 AM
This revision is now accepted and ready to land.Jul 19 2019, 9:16 AM
This revision was automatically updated to reflect the committed changes.