Commit graph

38 commits

Author SHA1 Message Date
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
aedd04a3d8 Parser: skip UTF-8 BOM
Skip the byte order mark.
BOM is also allowed in .rs or Cargo.toml file.

Fixes #7291
2025-01-07 12:34:08 +01:00
Olivier Goffart
6c81d5069e Fix parsing of unfinished import statement
Fix #6588

Note for the test: parse error at the end of the file are actually
reported at offset 0. Use a trick to add more `^` at the beginning to
mean that.
(Offset 0 is actually offset 1 as the column starts at 1)
2024-10-22 09:35:46 +02:00
Tobias Hunger
45c24803f2 compiler: Remove version info from SourceFile again
... and fix the fallout of that change.
2024-08-21 16:55:13 +02:00
Olivier Goffart
5dfa8d56dc API review of the slint interpreter Compiler api
Closes #5466
2024-07-05 17:20:08 +02:00
Olivier Goffart
f93729ffe2 Port LSP to slint_interpreter::Compiler
Add a feature to only generate a specified component.
2024-07-03 11:51:23 +02:00
Olivier Goffart
42a2c6a569
Only generate code for the exported Window
Have a warning when a component is exported from the main file and
doesn't inherit Window.
Unless it's the last component, for compatibility with Slint 1.6

Also don't warn in the interpreter
2024-06-25 15:13:06 +02:00
Olivier Goffart
2fd8744cfc compiler: Move embedded_file_resources from the root Component to the Document 2024-06-20 12:03:38 +02: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
Olivier Goffart
c5f857ffc9 Change callback: gate behind experimental flag 2024-05-02 22:25:53 +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
Tobias Hunger
06b04e71b5 compiler: Return the TypeLoader from compile_syntax_node 2024-02-29 19:35:52 +01:00
Olivier Goffart
5aa6b424e3 Janitor: Optimize usage of is_dir/is_file
As suggested in https://github.com/slint-ui/slint/issues/4219

Closes #4219
2023-12-27 10:36:25 +01:00
Tobias Hunger
d785f2d5df compiler: Store an optional version number with the document
A None value means the file on disk is the golden version.

We have an editor, the LSP and the preview that all need to at least
notice when they have newer data then their peers. So IMHO it makes
sense to have an optional document version around.

The language server protocol makes use of a version number already. This
patch moves that code into the compiler so that it is stored with the
actual data getting versioned.
2023-12-18 14:21:50 +01:00
Tobias Hunger
0ff8e2cdb6 compiler: Rework path handling
Add some code to do platform-independent path processing.

This is necessary aas WASM does e.g. not have any absolute paths and
such and the compiler tended to produce wrong results in that case.

Side-effect: We no longer need to depend on `dunce`
2023-10-10 20:04:47 +02:00
Tobias Hunger
b55cdb9cf4 Make ComponentContainer a compiler configuration feature
Require `SLINT_EXPERIMENTAL_FEATURES` to be set in the environment to
enable `ComponentContainer` and `component-factory`.
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
8345c6cd79 Do automatic clippy fixes 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
Olivier Goffart
cbc0c790a3 Make Disagnostice::line_colunm 1 based
Commit 893983e8d3 "fixed" it to be 0 based as it was
documented. But that's a change of behavior so restore the previous behavior and
document it properly
2023-04-19 11:02:33 +02:00
Tobias Hunger
893983e8d3
Slintpad: Add picker mode where you can click on something in the preview and the editor focuses on that (#2567)
* compiler: Make mapping from source offset to line/column more reusable
* compiler: Improve mapping of offset to line/column
* Fix unit tests after line mapping update
* interpreter: Add code to have a element picker mode
* slintpad: Add picker mode to the preview
* slintpad: Do not try to highlight "empty" highlight requests
* Slintpad: Cycle through all the possible elements in design mode
* Slintpad: Ignore builtins and eat less clicks
* Slintpad: Highlight the element selected in design mode
* Slintpad: Do not use static mut variable in design mode
* slintpad: Rename `set_current_element_information_callback`
* Interpreter: Do not use unsafe in design mode code

Done with: @ogoffart and @tronical
2023-04-18 23:11:08 +02:00
Olivier Goffart
4f00f268a5 Make the old syntax a warning 2023-02-14 12:38:39 +01:00
Simon Hausmann
24dcef5fed
First stage of cleaning up the export handling of the slint root component (#2095)
We implicitly export the last component of a .slint file to the generator.
Issue a warning when that happens and suggest to export it explicitly.
2023-01-23 15:19:49 +01:00
Olivier Goffart
a0d057b8b8 Enable the new syntax by default 2023-01-07 14:18:10 +01:00
Olivier Goffart
c1c52a2b86 Make the test pass without defining the SLINT_EXPERIMENTAL_SYNTAX env variable 2022-11-21 22:01:52 +01:00
Simon Hausmann
3498ccbc91 Speed up compiler syntax tests
Use rayon to run the compiler syntax tests in parallel. On my machine
that reduces the time from 11 seconds to 1.5 seconds.
2022-11-14 13:03:55 +01:00
Olivier Goffart
3240fd8bf9 Test: fix the parser tests when running without SLINT_EXPERIMENTAL_SYNTAX defined
Ignore the error mentioning the new syntax
2022-10-27 13:06:40 +02:00
Olivier Goffart
9eb8518278 Add a warning when setting a two way binding for which the rhs does not declare a default value
Because of issue #1394 and because the semantic are not properly defined
currently, we decided that future version of slint should always and only
take the binding from the right hand side, even if it has no bindings.

Since we can't change the behavior in 0.2, just add a warning instead for now.
The warning can be silenced by setting a default binding for the property on the rhs.

Ignoring the warning can still lead to panic (the one in #1394)
2022-07-08 19:05:54 +02: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
de4e195280
Rename internal crates and add a README.md to them
The README.md contains the warning that used to be in lib.rs.

Add README.md files to all internal crates

... pointing to the official public crate to use instead.

Rename internal crates

fixup: README files

fixup rename
2022-02-07 13:12:48 +01:00
Olivier Goffart
7a5330ac52 Re-enable and fix the tests driver after the .slint change 2022-02-02 10:20:12 +01:00
Olivier Goffart
03534039d6 Replace more .60 by .slint
Mainly an automated change with
    git grep -O"sed -i 's/\.60/.slint/g'" -w "\.60"

and some manual checks
2022-02-02 10:12:31 +01:00
Olivier Goffart
0308f86cd4 Rename sixtyfps_widgets.60 to std-widgets.slint 2022-02-01 18:58:54 +01:00
Simon Hausmann
cab22f8355 Rename the sixtyfps-compilerlib crate 2022-02-01 18:08:18 +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/tests/syntax_tests.rs (Browse further)