Sergio Martins
5346f808f9
qml: Don't include the widgets MainWindow in LayoutSaver
2020-07-27 10:51:03 +01: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
84b0b8f6ad
Fix serializing floating window affinity
2020-07-02 17:44:16 +01:00
Sergio Martins
6bbcb8f8f2
Rename LayoutSaver::MultiSplitterLayout to LayoutSaver::MultiSplitter
2020-06-11 17:00:54 +01:00
Sergio Martins
05f93a98f0
LayoutSaver: Only close dock widgets that would be restored
...
It can happen that the JSON layout knew about less dock widgets
than there are, as there can be new ones now
2020-05-26 19:49:02 +01:00
Sergio Martins
c9fa637ae7
Add some helper methods to LayoutSaver::Layout
...
To retrieve the list of main windows and dock widgets present
in the loaded layout
2020-05-26 18:29:30 +01:00
Sergio Martins
d94263fce5
Allow each dock widget and main window to support multiple affinities
2020-05-25 14:14:17 +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
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
8477fdc7e1
Fix detachments
2020-05-17 19:14:50 +01:00
Sergio Martins
d1d1c983f1
Remove "using namespace Layouting" out of the layouting lib
...
Fixes windows build due to ambiguous symbols
2020-05-14 22:02:27 +01:00
Sergio Martins
addf436fd0
LayoutSaver: Don't load old serialization versions
2020-05-08 19:30:41 +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
b236d744e3
Fix calculating main window scale
2020-03-25 15:56:19 +00:00
Sergio Martins
dbd90b8a02
LayoutSaver: Clear by affinity too
...
When restoring windows of the specified affinity clear only
the ones of that affinity
2020-03-01 15:02:22 +00: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
dedda6cb14
LayoutSaver: Also store the affinity in the JSON
2020-03-01 14:13:02 +00:00
Sergio Martins
af5bb4a3e4
Also store the percentage position in the json
...
just for checking that the restore is sane, even though
that property is calculated at runtime
2020-02-26 22:45:40 +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
1d7c0316ab
LayoutSaver: Fix applying factor to position
...
Was adding instead of multiplying, typo...
2020-02-25 21:18:36 +00:00
Sergio Martins
564a7091e1
LayoutSaver: Fix off-by-ones case with relative-restoring
...
If the window didn't change size nothing should happen
2020-02-25 20:00:46 +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
bab0ff085e
LayoutSaver now saves/loads in JSON format
...
This makes it easier to extend the format without being worried
about adding version checks all over the code
2020-02-24 14:57:03 +00:00
Sergio Martins
5b0eb93cda
LayoutSaver: Add a json to/from methods
...
Still not being used by public api though.
2020-02-24 14:45:06 +00:00
Sergio Martins
758b4de5cc
LayoutSaver: Fix serializing QSize and QRect to json
...
Failed silently to null instead
2020-02-24 14:40:38 +00:00
Sergio Martins
b78becfc01
Fix typo in json serialization
2020-02-24 13:39:48 +00:00
Sergio Martins
15d9f074fa
Fix converting Item to json
2020-02-24 13:38:54 +00:00
Sergio Martins
fdb95e344a
Fix converting Placeholder to json
...
Only dump the floating window index if we're in a floating window
2020-02-24 13:31:38 +00:00
Sergio Martins
69ada1bdad
LayoutSaver: Add to/from variant map methods
...
To make it easy to use json instead of QDataStream
2020-02-23 22:55:30 +00:00
Sergio Martins
21660d9fc5
Remove unused method
2020-02-20 18:19:41 +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
Sergio Martins
27e53ca68d
Add missing reserve
2020-02-20 13:39:25 +00:00
Sergio Martins
63da84e343
LayoutSaver: Accept serialization formats with lower version
2020-02-20 13:36:10 +00:00
Sergio Martins
59bb0d8e71
FloatingWindow now receives MainWindow as argument
...
Instead of a generic QWidget. Only works with main window so
let's just use the right type
2020-02-09 18:24:37 +00:00
Sergio Martins
6da1a65591
Fix build with gcc -Werror=type-limits
2020-01-29 15:27:11 +00:00
Sergio Martins
cfa1cc47b6
Rephrase the warning about the insane layout
2020-01-13 12:50:45 +00:00
Allen Winter
df692686e7
various - update copyright year
2020-01-07 11:36:56 -05:00
Sergio Martins
21579f2743
Minor method renames
2019-10-07 00:16:16 +01:00
Albert Astals Cid
262d57b890
Add a few const &
...
as suggested by clang-tidy
2019-09-30 15:57:03 +02:00
Sergio Martins
68a536bb67
Minor renaming, deserialize() no matches serialized()
2019-09-21 16:18:19 +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
cde4bd9bbd
LayoutSaver: Add more validation
2019-09-10 19:19:22 +01:00
Sergio Martins
5a3727deae
LayoutSaver: Also validate anchors upper bound
2019-09-10 19:03:49 +01:00
Sergio Martins
4261e831d6
Fix build
2019-09-10 18:55:14 +01:00
Sergio Martins
a348274bc4
Add LayoutSaver::Layout::isValid()
2019-09-10 18:52:33 +01:00
Sergio Martins
21afb04555
Use LayoutSaver::DockWidget by pointer
...
As we're changing it's shared and we're changing its members.
This way the members changes everywhere, as there's only 1 instance
of each dock widget
2019-09-10 17:21:09 +01:00