The alignment of a HashMap within a Struct is 8 bytes because of the
RandomState.
This is important because the C++ allocated `interpreter::Struct` could
be mis-aligned
The main change is that the window adapter is not copied into
sub-components anymore - instead it is accessed through the root. This
is especially important for globals.
In order to add the root, a little extra dance had to be performance on
instantiation: The self_rc/self_weak is created first and the
ComponentExtraData's fields are populated via once_cells.
Several tests rely on the testing backend being in place, as it starts
out with a scale factor of 1. The nodejs crate can't depend on the
unpublished testing backend to achieve that, so instead the selector's
backend is used. If that's Qt, then the scale factor is one. If it's
winit, it might be different. To override that, set
`SLINT_SCALE_FACTOR=1` for the nodejs process.
Consume the Rc in the function signature where the implementation would clone it anyway.
This is also needed in preparation for InstanceRef::window_adapter()
walking up the tree of components,
by which it's not possible to return a reference anymore as
parent_instance() returns a new lifetime that's shorter than &self
inside window_adapter().
Replace all call sites that call unwrap() on window_adapter_ref() with a call
that returns a &Rc<dyn WindowAdapter> and use an Option variant for register/unregister component.
For the former, in the future, we want to create the adapter if it doesn't exist.
For the latter we don't want to do that.
Replace `fn window_ref(component) -> Option<& WindowInner)` with
`component.access_window(cb: impl FnOnce(&WindowInner))` as
all call sites unconditionally called unwrap() on them and by using the
pattern with a closure, we can in the future get the WindowInner from an
Rc<dyn Adapter> instead of an &Rc<dyn WindowAdapter>.
This will be needed for embedding - to avoid creating two window
adapters - and it will be needed for the API to allow creating a
component from an existing window.
It only suggest the transformation for string that are directly within
an expression, so that's only string literals. (Not import, not image
macro, not already translated strings)
Drive by fix: fix the code action for showing the preview that was
broken because confusion between path and URL
Note, this goes against the gettext documentation's recommendation:
https://www.gnu.org/software/gettext/manual/gettext.html#Contexts
> Finding a canonical msgctxt string that doesn’t change over time can be hard.
> But you shouldn’t use the file name or class name containing the pgettext
> call – because it is a common development task to rename a file or a class,
> and it shouldn’t cause translator work.
Provide an intro that outlines the overall steps, and then go into
details in each of them.
The C++ bit is marked with TODO, as I think we still have to sort out
some details there.
This includes slint-viewer, slint-interpreter (when loading path, not
string), slint-compiler.
(This would also include internal things such as
`import { Xxx } from "foo.rs"`, if we didn't check for .slint or .60
extension before)
But that doesn't include anything that's not opening the source by path
(so not the lsp which use its own representation coming from the editor,
or varius tools like the updater and fmt which also open the files
themselves)
- in SetRenderingNotifierError using a rustdoc link breaks the C++ docs. Using a qualified backtick'ed slint::Window works perfect with both.
- In TimerMode, the same track unfortunately doesn't work with a function,
but we can use [`Foo::bar()`] to make the link work with rustdoc and myst-parser.
The look isn't perfect in C++, the square brackets are visible.