Technically it pops up a message if the live preview does not end in
a success, even though the message says "crashed"... I think that is
fine: We also want reports on the live preview going into an error mode.
Simplify style selection, now that we are "always up": All we need to do
is change the style when the configuration changes. That is a part
of the initial state request we send when the preview starts up, so we set
the style properly and then we do not need to do anything anymore till
somebody configures a new style.
Start the live preview in a separate process. This simplifies
a couple of things:
* Starting the UI
* UI state handling
* Threading setup
* "Quitting" the preview on Mac
... and many more :-)
.. to clean up `preview.rs` a bit.
The functionality is generic and could be used in both LSP
and preview, so common with the other helper code seems
appropriate.
This is a hacky approach, but does help a lot with the tedious fixes.
See https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_map_or
```
__CARGO_FIX_YOLO=1 cargo clippy --fix --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::unnecessary_map_or
cargo fmt --all
```
This means that, when the parent is not a layout, the widgets are
always dropped in the middle of the parent, and then one can place
place it to the right position.
In particular, for widget that expaneds to the size of their parent by
default, this does the right thing
Fixes#6098
I got carried away, I replaced `u32` with `TextSize` in one place
because that's what I got and I did not want to convert... and
then I fixed the fallout.
No functional change is intended in any of this.
FIXUP
Now that the properties are only used in the live preview,
we can simplify the code a bit.
This gets rid of some sanity checks in the code path as well,
which in turn should fix#5696.
Fixes: #5696
These commands are not needed anymore since we integrated
the property editor into the live preview.
Move the properties code out of `common` and into `preview`
for good measure.
... when deciding whether or not we are dropping into a layout or not.
Components that take @children (like a GroupBox) were misrecognized before.
This is a bit tricky as the optimized Elements do not allow to find out whether
something had a child insertion point. So I need to convert over to the
unoptimized Element found in my `document_cache`.
Unfortunately there the lowering pass for the layouts has not been done yet,
so my "normal" approach to figuring out whether something is a layout or not
does not work anymore:-/
I ended up duplicating the logic of the layout lowering step: Match specific
type names for Builtin types. That's not nice and should be cleaned up at
some point.
Compile test the result of an element move in the `can_move` function
to catch all cases where the move would be problematic.
Shuffle some test code around to allow for testing this new
functionality.
Use this snapshot to keep a unoptimized typeloader around, so that the preview
does not need to do another parsing run.
Move the document cache in the preview over to use the snapshot.
The Document cache is a specialized typeloader now, make it provide the
necessary APIs directly, so that we can be sure nobody will do anything
that breaks the data:-)