Commit graph

30 commits

Author SHA1 Message Date
Tobias Hunger
93f72b8c99 core: Fix the component container
Some checks are pending
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.82) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
This fixes the contents of the `n`-th repeater inside the
`ComponentContainer` to also show up in the `n`-th repeater *after*
the `ComponentContainer`.

The ComponentContainer is lowered to a Comonent Container and a
dynamic tree node. The tree node is managed manually and I messed
up the repeater indices since there were no entries in the repeater
array for the embedded components. That mad things hard to keep
consistent as components get merged.

This chnages that: It lowers a Component Container to Something like this:

```slint
    ComponentContainer {
        if false: Emtpy {}
    }
```

This way the standard mechanismns make sure we have something to put into
the repeater list and that unscrews the indices, saving a bit of code along
the way.

The inserted repeated node is still marked as `is_component_placeholder`, so
that we can wire it up as needed.
2025-06-05 13:48:16 +02:00
Yuri Astrakhan
bcb2953f00 Auto-fixed clippy::unnecessary_map_or
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
```
2025-02-07 09:02:31 +01:00
Yuri Astrakhan
61de4d56b0 Fix all format arg inlining
Ran this command:

```shell
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2025-02-06 10:16:20 +01:00
Olivier Goffart
73b549a42c bundled translation: Better error reporting
forward the error up the stack instead of panicking while producing the llr
2024-11-19 21:34:42 +01:00
Milian Wolff
f6da161dbb
Reduce SmolStr <-> &str conversions and copies (#6688)
SmolStr has an Arc internally for large strings. This allows
cheap copies of large strings, but we lose that ability
when we convert the SmolStr to a &str and then reconstruct a
SmolStr from that slice.

I was hoping for some larger gains here, considering the impact
of this code change, but it only removes ~50k allocations,
while the impact on the runtime is not noticeable at all.

Still, I believe this is the right thing to do.

Before:
```
        allocations:            2338981

  Time (mean ± σ):     988.3 ms ±  17.9 ms    [User: 690.2 ms, System: 206.4 ms]
  Range (min … max):   956.4 ms … 1016.3 ms    10 runs
```

After:
```
        allocations:            2287723

  Time (mean ± σ):     989.8 ms ±  23.2 ms    [User: 699.2 ms, System: 197.6 ms]
  Range (min … max):   945.3 ms … 1021.4 ms    10 runs
```
2024-11-19 10:07:16 +01:00
Milian Wolff
69c68b22b2 Also wrap langtype::Type::Struct in an Rc
This makes copying such types much cheaper and will allow us to
intern common struct types in the future too. This further
drops the sample cost for langtype.rs from ~6.6% down to 4.0%.

We are now also able to share/intern common struct types.

Before:
```
  Time (mean ± σ):      1.073 s ±  0.021 s    [User: 0.759 s, System: 0.215 s]
  Range (min … max):    1.034 s …  1.105 s    10 runs

        allocations:            3074261
```

After:
```
  Time (mean ± σ):      1.034 s ±  0.026 s    [User: 0.733 s, System: 0.201 s]
  Range (min … max):    1.000 s …  1.078 s    10 runs

        allocations:            2917476
```
2024-10-28 09:39:54 +01:00
Simon Hausmann
c25a03d6f7 C++: Make it possible to split up the C++ code generated for a .slint file
Add a COMPILATION_UNITS argument to slint_target_sources that defines into how many .cpp files to split up a .slint file. The new default is now one.
2024-08-20 15:53:24 +02:00
Tobias Hunger
cd3b60c889 janitor: Fix clippy "creates a reference which is immediately dereferenced" 2024-06-24 14:59:47 +02:00
Olivier Goffart
3764312561
Generate multiple components in Rust and C++ (#5449)
When lowering to the LLR, generate one PulbicComponent for each exported
component in the main file

Closes #784
2024-06-24 10:03:19 +02:00
Olivier Goffart
d0ed0438ce
LLR: peliminary support for multiple public components
There currently still can only be one because the passes expect that,
but now the LLR and generator should be ready to accept multiple public
component later
2024-06-15 14:44:11 +02:00
Simon Hausmann
a52fe6bbfc Make element debug information configurable
The `SLINT_EMIT_DEBUG_INFO` environment variable needs to be set for Rust and C++ builds. For the interpreter it's always enabled, since ... we have it.
2024-06-05 01:29:58 -07:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Wilston Oreo
bef532b5fc
Optional C++ namespaces (#4759)
Co-authored-by: Michael Winkelmann <michael@winkelmann.site>
2024-03-06 19:43:11 +01:00
Tobias Hunger
382b5486ca
Component container subcomponent (#4355)
This changes the component containers away from using a "MAGIC" index in the
placeholder dynamic item tree node it creates. These are hard to
integrate across sub-components.

Use index numbers right after the index numbers used by repeaters and
"extend" the repeater offset by the number of component containers in
the sub-component. This way we can piggy-back on the forwarding of
repeaters.

This has one annoying side-effect: We do have indices in our item tree
that are out of range for a repeater. But I think that is acceptable
considering that we never materialize that array anyway.
2024-01-17 11:26:08 +01:00
Olivier Goffart
0345c9bc48 Debug: use pretty-print to dump the LLR
the Debug trait for the LLR isn't that usefull
2023-08-22 16:20:13 +02:00
Tobias Hunger
5db78b6dd2 Implement LLR code lowering for ComponentContainer 2023-07-27 12:04:16 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Tobias Hunger
e02c360000 Clippy polish 2023-06-28 14:22:30 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Tobias Hunger
0f4ed1ee35
janitor: Fix typo and whitelist some valid words 2023-06-14 18:44:32 +02:00
Olivier Goffart
a89c5db8db Fix crash when a state condition is detected as constant
States are never constant because the generated state binding depend on
the time as it register the time it was set for the pottential animation

Also adjust the assert so it assert correctly which the right message

Fixes: #2274
2023-02-24 16:43:48 +01:00
Olivier Goffart
28ae8f7bc4 Refactoring: split ElementType away from the types used as property type
These are two different concept, and it is confusing to keep them in the
same enum

We want to support component without any base element, and Void is
already used for global component, so do this refactoring before
2022-10-26 14:50:44 +02:00
Olivier Goffart
ac4f3e97ad Change slint enum values to be PascalCase in rust
... while still being kebab-case in .slint

Some enums might become public API and we want to have them as
PascalCase to respect the rust conventions
2022-07-22 12:23:52 +02:00
Olivier Goffart
ea4f27992e Mark constant properties of parent native type as such 2022-02-18 17:40:17 +01:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Tobias Hunger
0d358251c9 Janitor: More clippy stuff 2022-01-31 20:59:45 +01:00
Tobias Hunger
e6b24bceec [reorg]: Set up and populate the internal directory
Move "internal" crates into the `internal` directory. This first batch
includes most of sixtyfps_runtime but leaves the rendering backends
alone for now.

pre-commit applied some cleanups to the moved files:
 - Consistent newline at end of file policy
 - trimming trailing whitespace
 - Formatting Cargo.toml files.
2022-01-31 16:00:50 +01:00
Renamed from sixtyfps_compiler/generator.rs (Browse further)