Sergio Martins
9ad6eefa7a
Add Layouting::Config
...
To host many of the scatered static member variables which
held some settings that rarely change
2020-05-23 18:40:20 +01:00
Sergio Martins
2527b39368
Moved the multisplitter wrapper outside of multisplitter/
...
As it depends on kddw framework, while multisplitter/ is the
agnostic layouting engine
2020-05-23 17:01:20 +01:00
Sergio Martins
71c7a7c9a9
Move more ItemContainer members to private
2020-05-23 16:46:43 +01:00
Sergio Martins
6d44362991
DockWidget::setFloating(true): restore to previous floating position
...
When floating a dock widget we restore it to the last known floating
position now
2020-05-22 11:12:12 +01:00
Sergio Martins
ce7c913f8c
Move the last floating geometry 1 level up
...
So it's not overwritten.
Added a unit-test for testing that floating geometry doesn't break
2020-05-21 19:32:18 +01:00
Sergio Martins
b4526b007c
Make LastPositions::lastPosition private
...
Need to control how the setters are messing with it, to add more
of them
2020-05-21 18:56:44 +01:00
Sergio Martins
9779b8edc3
Deal in terms of LastPositions instead of the individual position
...
Just a refactoring to add more encapsulation
2020-05-21 17:43:51 +01:00
Sergio Martins
50934ae56d
Use a shared_ptr for Position, so we can pass LastPositions by value
2020-05-21 17:19:54 +01:00
Sergio Martins
f260a76f8b
Rename LastPosition to Position
...
so we can have a list of them, the dock widget might have been
in several main windows
2020-05-21 14:49:49 +01:00
Sergio Martins
6de5860e9a
Don't allow to drop to itself when having mainwindow inside dock widget
2020-05-20 16:33:48 +01:00
Sergio Martins
af22e3e12d
Fix tst_raise on XCB
2020-05-19 13:44:01 +01:00
Sergio Martins
9e198917f0
Try to recover from loading an invalid layout
2020-05-19 12:35:33 +01:00
Sergio Martins
4647814aae
Fix tests with Qt 5.9
...
QTabWidget is a bit flaky and changes min width at unexpected times.
Which is fine but we can't compare against the expected min size
since it changes. So just check sanity of the restored layout
2020-05-17 17:12:31 +01:00
Sergio Martins
d0b36cf932
add ctest to tst_multisplitter too
...
moved up otherwise the multisplitter one was being generated in
a different folder
2020-05-14 22:29:19 +01:00
Sergio Martins
d44a6f78b8
Fix build with older Qt
2020-05-14 21:10:46 +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
550d84ab11
Rename for readability
2020-05-10 22:26:40 +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
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
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
535a0c943c
Remove some cruft, bunch of unused methods from old layouting engine
2020-05-04 23:37:04 +01:00
Sergio Martins
e298667351
Remove dead code about static separators
...
Before we had separators on the left,top,bottom,right margins
with 0 width. Now we don't have this concept anymore
2020-05-04 14:28:59 +01:00
Sergio Martins
0595448bba
Replace Anchor with Separator
...
We don't have the concept of Anchors anymore. Code is now simpler
2020-05-04 13:10:38 +01:00
Sergio Martins
97c1ca30fd
Layouting engine rewrite
...
The layouting was becoming too complex to maintain and to introduce
new features. Was even buggy, the fuzzer was constantly finding
bugs, which took hours to workaround.
Problem with the old layout engine is that there was a catch 22, between
Items driving the separators, and separators driving the anchors.
The new layout is much simpler, both in implementation and conceptually.
There's simply a recursive hierarchy of Item elements. An Item can either
have a QWidget to show, or be a ItemContainer, which contains Item children,
and so forth. Each ItemContainer is either vertical or horizontal. That's enough
to represent the "nested multi-splitter" concept which KDDW uses.
After each item insertion/deletion/resize, the separators are regenerated. They
are essentially dumb now.
TODO:
- Separators are drawn, but are not interactive yet
- There's 5 tests failing
- LayoutSaver scalling functionality
2020-05-04 00:02:03 +01:00
Sergio Martins
86d1a52bbf
Fix unit-test
...
Was leaving window leftovers behind.
Delete them.
2020-05-03 16:41:52 +01:00
Colin Ogilvie
e383bc797e
Run tests with ctest
2020-04-30 18:12:35 +01:00
Colin Ogilvie
43a25ef93b
Add test for foating action
2020-04-30 16:56:13 +01:00
Sergio Martins
225aa6a098
Add unit-test for DockWidget::raise()
...
and make it pass on offscreen platform too, as that QPA plugin
fails to keep z-order between order.
2020-03-24 22:36:21 +00:00
Sergio Martins
afb3edfd1d
unit-tests++
2020-03-24 13:33:51 +00:00
Sergio Martins
fc63f843b7
Workaround QTBUG-83030
...
Fixes a case where the floating window wouldn't disappear.
This is deep in Qt. Got it down to a minimal test-case and reported it.
Probably won't get fixed ever.
2020-03-24 10:58:31 +00:00
Sergio Martins
cc1e1eaa51
Don't flicker when showing a floating dock widget
...
Create the FloatingWindow directly, instead of creating the DockWidget
then reparenting it
2020-03-07 21:15:44 +00:00
Sergio Martins
eabcdfb945
Add unit-test for affinity
2020-03-01 15:03:29 +00:00
Sergio Martins
63e662323f
Added unit-test for Flag_DoubleClickMaximizes
2020-02-27 15:13:01 +00:00
Sergio Martins
6fb0694aab
LayoutSaver: Replace saveToDisk() with saveToFile(jsonFilename)
...
Same for restore.
This is better API as LayoutSaver shouldn't be concerned about
QSettings. It also assumed the user only had a single layout, which
is normally not the case.
And finally, storing escaped json in .ini files is not very elegant.
2020-02-24 15:10:12 +00:00
Sergio Martins
579b222418
Make AddingOption_StartHidden also work for tabs
...
You can now pass that option to DockWidget::addDockWidgetAsTab().
2020-02-19 16:36:50 +00:00
Sergio Martins
7a2aa43b2d
Fuzzer: Add SaveLayout and RestoreLayout operations too
2020-02-19 14:12:44 +00:00
Sergio Martins
aded290573
Don't save last position if the window was hidden already
...
Bug was happening when calling close() an closed dock widget, it
would then save the position of the invisible window. Next time it
was open it would appear in a bogus location. 0,0 in my case.
2020-02-06 15:01:58 +00:00
Sergio Martins
52e53c4fd9
fuzzer: Trim the failing test
2020-01-29 15:04:51 +00:00