Commit Graph

38 Commits

Author SHA1 Message Date
Allen Winter
a2f4c972a6 update copyright year 2021-01-02 09:27:50 -05:00
Sergio Martins
dc13665566 Fix forward declaration 2020-11-23 16:53:52 +00:00
Sergio Martins
1d032abb72 Fix some doxygen bugs 2020-07-30 16:15:25 +01:00
Allen Winter
fc633f2547 various minor documentation fixes for doxygen 2020-07-29 18:58:17 -04:00
Allen Winter
b4f49895c2 clarify: licensing is GPL2 or GPL3 or commercial licensed
follow the REUSE specs
2020-07-24 18:16:13 -04:00
Sergio Martins
6bbcb8f8f2 Rename LayoutSaver::MultiSplitterLayout to LayoutSaver::MultiSplitter 2020-06-11 17:00: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
8a3e784ae2 Make layout saver create the main window if it's missing
and we have a factory. The same way it happens for dock widgets.
2020-05-20 19:19:07 +01:00
Sergio Martins
2b6b6e2ba5 Disable copy for LayoutSaver, it has a dtor, but no copy-ctor 2020-05-17 19:07:26 +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
9904d847f2 LayoutSaver now can save/restore a sub-set of windows
Each subset is identified by its "affinity name".
See DockWidget/MainWindow setAffinityName property.

Patch contributed by Andras Mantia, I've changed it to deal in
terms of affinity names instead of unique names.
2020-03-01 14:25:31 +00:00
Sergio Martins
ee786f57c5 LayoutSaver: Fix rounding errors when doing a relative restore
After a restore with relative sizes the items might not be on a pixel
perfect position regarding to their anchors. Make sure they are after
the restore is complete.
2020-02-25 23:24:39 +00:00
Sergio Martins
ca211f2494 LayoutSaver: Add an option to restore in relative sizes
and not touching the main window geometry.

The option is not exposed yet, there's a layouting bug to fix first.
2020-02-25 19:06:43 +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
b0525ed1f1 LayoutSaver: Save the list of screens and their properties
So we can be smarter when restoring on different screen setups
2020-02-20 17:50:28 +00:00
Sergio Martins
e7661cca91 LayoutSaver: serialize/deserialize the screenSize and layoutSize too 2020-02-20 15:41:00 +00:00
Sergio Martins
2458b1c0f8 Add a way for the intermediate format to know it's version
It's a pain to pass the Layout or the version all the way
down the chain, so just add a static method
2020-02-20 14:56:51 +00:00
Allen Winter
df692686e7 various - update copyright year 2020-01-07 11:36:56 -05:00
Sergio Martins
945dbc1f27 Fix build with namespaced Qt
Fixes #18
2019-11-27 16:17:48 +00:00
Sergio Martins
b5fad9a601 docs++ 2019-10-05 12:54:25 +01:00
Sergio Martins
eb96288534 docs: Improved @file docs 2019-10-04 17:33:42 +01:00
Sergio Martins
c80a16d2c1 Also use the intermediate representation when serializing 2019-09-21 15:15:44 +01:00
Sergio Martins
65c9693a62 Restoring now reads from the intermediate representation
Only the intermediate representation is filled in from the stream
now. TODO: GUI->intermediate.
2019-09-20 17:24:22 +01:00
Sergio Martins
5448c9655e Introduce an intermediate serialization format for save/restore
QDataStream is opaque and is not good for validation.
With this intermediate format we'll be able to:
- manipulate stuff
- validate that the saved layout is correct, before restoring it
- decide about some restore heuristics which would have been impossible
because before we needed to restore as we read the stream, now we can
look at the state before restoring it

LayoutSaver isn't using the new format yet, but the LayoutSaver::Layout
is already useful to debug some bogus saved states
2019-09-10 16:24:14 +01:00
Sergio Martins
46a5a580bc Add LayoutSaver::restoredDockWidgets()
Implemented as a property it's better that the LayoutSaver
doesn't carry state about this. Then we would need to remove dock
widgets from the list if they are deleted. Also not a important
enough feature to be on the DockWidget public interface.
2019-08-28 17:56:18 +01:00
Sergio Martins
10c2b0fa77 Reenable layout storing 2019-07-23 17:08:54 +01:00
Sergio Martins
38d97ef00b Comment out dead code
Just there for reference, but will be removed soon
2019-07-21 23:27:30 +01:00
Sergio Martins
dfc53795b7 Start implementing global save/restore
The difference is that now ach class will encapsulate serialization/deserialization
of its own properties, and we'll get rid of the *State classes
2019-07-21 19:08:35 +01:00
Sergio Martins
f8560c18ca Comment out LauoutSaver public api for now
Still working on it
2019-07-21 18:25:30 +01:00
Sergio Martins
f5c005d412 LayoutSaver: Prevent Anchors from resizing items while constructing
the layout is still incomplete so don't resize anything. Instead, serialize
the geometry too, and set that when restoring.
2019-07-18 21:12:56 +01:00
Sergio Martins
21e54d0827 LayoutSaver: Make some methods private 2019-07-18 20:52:35 +01:00
Sergio Martins
525d72b1c9 docs++
Just @file for now
2019-06-18 14:44:33 +01:00
Laurent Montel
b06a9c8d60 Fix forward declaration. Remove not necessary includes
Change-Id: If2dc2c52fa8dbabd9aeca03ba96e01c1c6bce37d
Reviewed-on: https://codereview.kdab.com/68186
Reviewed-by: Sérgio Martins <sergio@kdab.com>
2019-05-15 16:36:42 +02:00
Allen Winter
7241bf6794 various - move Author to its own line 2019-04-24 13:02:32 -04:00
Allen Winter
6ef9f83b3f various - cleaning up include guards 2019-04-24 12:51:22 -04:00
Allen Winter
1574986a1b various - update copyright year
also run dos2unix on a few files with CRLFs
2019-04-24 11:13:38 -04:00
Sergio Martins
87f2325c71 Fix copyrights 2019-04-24 15:27:04 +01:00
Sergio Martins
e43b673858 Initial commit 2019-04-24 14:49:01 +01:00