Commit Graph

1157 Commits

Author SHA1 Message Date
Sergio Martins
b743565ea3 Fix Item::suggestedRect() when the parentContainer() wasn't root 2020-05-13 22:35:02 +01:00
Sergio Martins
be1a2a3878 Fix build on Windows 2020-05-13 20:04:48 +01:00
Sergio Martins
b7cb6afa49 Item: Also position the opposite position, not just the length
Fixes fuzzer test 20.json
2020-05-13 19:39:30 +01:00
Sergio Martins
0db40953ac fuzzer: don't dump invalid operations to the JSON 2020-05-13 19:37:47 +01:00
Sergio Martins
137cf017c4 fuzzer: add a nice place to set a breakpoint 2020-05-13 19:37:47 +01:00
Sergio Martins
68acdaeb9a Fix Items not being connected to their parent after a restore
Missing connectToParent() calls.
2020-05-13 12:24:46 +01:00
Sergio Martins
4dea453e7c fuzzer: Trim failling test 2020-05-11 00:25:09 +01:00
Sergio Martins
ca52d6f760 fuzzer: Add a failing test 2020-05-11 00:05:00 +01:00
Sergio Martins
5eff4f8df8 fuzzer: fix dumping to JSON skipping some operations
Operations that don't have any parameters werent being saved
2020-05-11 00:04:26 +01:00
Sergio Martins
cc2aa13eb7 fuzzer: Fix dockByName() returning nullptr
dockStr() is just for printing purposes
2020-05-10 23:44:48 +01:00
Sergio Martins
c4241b92f1 Item: When restoring, only shrink the immediate neighbours
So it matches the behaviour of closing an item, where only immediate
neighbours grow.

Now, pressing the float button multiple times will always put the
item on the same place, and not disturb non-immediate neighbours
2020-05-10 23:24:18 +01:00
Sergio Martins
1a0299d758 Simplify the NeighbourSqueezeStrategy enum
And make it agnostic to how separators work, so it can shrinkNeighbours()
can be reused in other contexts.
2020-05-10 22:44:53 +01:00
Sergio Martins
550d84ab11 Rename for readability 2020-05-10 22:26:40 +01:00
Sergio Martins
2450f9b39f Minor rename for readability 2020-05-10 22:23:36 +01:00
Sergio Martins
f6f70f26e4 Item: Also pass the neighbour shrink strategy all along
So we can choose another one when restoring a child
2020-05-10 22:17:59 +01:00
Sergio Martins
c4df3600af tst_docks|fuzzer: Use offscreen QPA by default too 2020-05-10 21:26:52 +01:00
Sergio Martins
0f0209ddf3 tst_multisplitter: Use offscreen QPA by default
It's less anoying as it doesn't show a window
2020-05-10 21:21:20 +01:00
Sergio Martins
0dac5eed68 Item: Add DefaultSizeMode enum
To control how we calculate the item's initial size when
we add it
2020-05-10 21:20:31 +01:00
Sergio Martins
11576c5455 ECM: Only set the sanitizers for DEBUG config
ECMEnableSanitizers isn't being friendly of multi generators, like
-G "Ninja Multi-Config" and is messing with global flags which is a no-no.
Instead it should be using a dedicated custom config IMHO.

With this change only debug will get the sanitizers, so you can for instance
build with -DCMAKE_CONFIGURATION_TYPES=Debug;RelWithDebInfo and have Debug
hardeneded with the sanitizers while the RelWithDebInfo without sanitizers,
ideal for profiling.
2020-05-10 17:49:20 +01:00
Sergio Martins
93c471623b Silence -Wmaybe-uninitialized false-positive 2020-05-10 15:20:59 +01:00
Sergio Martins
925df72c0f Fix propagation of resize when dragging a separator
It was ok but was resizing children via the "percentage method",
and we only want to resize the children next to the separator.
2020-05-10 15:07:42 +01:00
Sergio Martins
babed642eb Fix warning saying item size being too small
If the widget's size is smaller than hardcodedMinimumSize then
it would be violating the min-size constraint
2020-05-10 12:45:58 +01:00
Sergio Martins
fd9bcdeabe Fix crash if root() is nullptr when printing a warning 2020-05-09 18:37:35 +01:00
Sergio Martins
2fe1e22076 Remove OPTION_SANITIZER_SUPPORT
We have ECM inside the repo now, so no point in guarding the include
2020-05-09 17:55:22 +01:00
Sergio Martins
a9d0ec3fdd Use a better strategy for size propagation when resizing via separator
Behaves like old kddockwidgets now.
When dragging a separator, only the immediate neighbours are resized.
Only when min-sizes are violated that it propagates.
2020-05-09 17:42:55 +01:00
Sergio Martins
ed6d5134b0 Implement Side1 and Side2 resizing strategies
to be used when dragging separators when mouse, as we don't want
a recursive resize dealing with percentages, as it doesn't need to be fair.
Items near the mouse/separator will suffer/benetif more from there resize.
Resize only propagates further when size-constraints come into action
2020-05-09 13:28:59 +01:00
Sergio Martins
1f2bdaf188 Factor out children resize logic into Item::resizeChildren()
as we'll have other stragies for resizing children
2020-05-09 12:49:03 +01:00
Sergio Martins
a9be454604 Item: Rename resize to setSize_recursive() 2020-05-09 12:14:08 +01:00
Sergio Martins
7c85c1eb0f Resize the layout after restoring
After restoring, we need to put the layout at the same size
as its widget. Most of the times this happens since we also restore
the widget's geometry. But really make sure, as something might happen
to the window geometry, like for example using RestoreOption_RelativeToMainWindow
which doesn't restore the main window geometries
2020-05-09 00:46:30 +01:00
Sergio Martins
addf436fd0 LayoutSaver: Don't load old serialization versions 2020-05-08 19:30:41 +01:00
Sergio Martins
ff6260a4dc tests: Add a failling test tst_invalidLayoutAfterRestore
And a JSON file that makes it fail
2020-05-08 18:40:23 +01:00
Sergio Martins
48f872f696 Remove extra semi 2020-05-08 18:01:28 +01:00
Sergio Martins
e3e31ca5ca Ensure kddockwidgets_layouting is STATIC
Otherwise we get errors as only kddockwidgets is exported. It's
not public API for now
2020-05-08 18:00:42 +01:00
Sergio Martins
4b05d4ddd7 Remove unused Item_p.h include 2020-05-08 17:02:58 +01:00
Sergio Martins
e6e63806f8 MultiSplitterLayout_p.h: Forward declare Frame and Item 2020-05-08 17:01:07 +01:00
Sergio Martins
d267b0e0dd LastPosition: Forward declare Layouting::Item 2020-05-08 16:46:42 +01:00
Sergio Martins
96ee076e9a Add pimpl to Separator 2020-05-08 16:43:03 +01:00
Sergio Martins
7e86a32a23 Readability++
let the reader know position isn't imported at this stage
2020-05-07 23:34:57 +01:00
Sergio Martins
09026fd312 Uncomment assert 2020-05-07 23:05:59 +01:00
Sergio Martins
d2dca56ce6 Implement lazy resize in the new engine
We're almost feature complete
2020-05-07 19:35:05 +01:00
Sergio Martins
3742e5ef9a example: No persistent central frame by default
This is old style, which we don't use anymore by default
2020-05-07 19:32:32 +01:00
Sergio Martins
7ed54631ac Item: unit-tests++ 2020-05-07 18:49:18 +01:00
Sergio Martins
3c1ab0126d Item: Clear and honour a bunch of TODOs 2020-05-07 18:49:00 +01:00
Sergio Martins
0df9943aa5 Fix fuzzer test 11.json and other tests that worked by luck
mapFrom/toRoot were wrong
2020-05-07 16:30:45 +01:00
Sergio Martins
d4cc9e85eb Add more sanity checks to Item
Checks that the parentContainer and hostWidget are correct
for each separator
2020-05-07 12:35:58 +01:00
Sergio Martins
5f7899f265 Item: Remove unused methods 2020-05-07 00:08:04 +01:00
Sergio Martins
61bedce278 Separators now are able to be moved by the user with mouse 2020-05-06 22:52:36 +01:00
Sergio Martins
cd053d0cc4 Unit-tests++ 2020-05-06 00:01:46 +01:00
Sergio Martins
06a7346281 Introduce ItemContainer::availableOnSide_recursive()
and use it for calculating the min/max position of a separator

The min/max position of a separator isn't local to its container,
but is recursive upwards until root
2020-05-05 23:16:57 +01:00
Sergio Martins
535a0c943c Remove some cruft, bunch of unused methods from old layouting engine 2020-05-04 23:37:04 +01:00