Commit graph

477 commits

Author SHA1 Message Date
Simon Hausmann
c8f1f4354b Port to resvg 0.33 2023-06-18 08:58:09 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Tobias Hunger
04d1229685 Fix licnese information using xtask 2023-06-16 09:14:20 +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
18ba3c2ae2 Slint enums in Rust and C++ 2023-06-12 13:02:14 +02:00
Tobias Hunger
9c50da9bde
janitor: Fix a few typos 2023-06-08 18:12:52 +02:00
Olivier Goffart
95abde86e6 Translation: Use the (normalized) component name as context when none is provided
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.
2023-06-08 16:55:52 +02:00
Olivier Goffart
12e6b34e2d Translations: support for plurals 2023-06-07 10:34:34 +02:00
Olivier Goffart
e97a2e8229 Translations: support context 2023-06-06 14:48:48 +02:00
Simon Hausmann
1bf05eae7c
Add support for absolute-x and absolute-y properties on any element (#2823)
Fixes #1691
2023-06-06 14:37:53 +02:00
Olivier Goffart
9b3ccd3dc3 Check validity of the format string at compile time 2023-06-05 16:34:59 +02:00
Olivier Goffart
ce25fb65a6 Pass the translation domain to the runtime
For rust, it uses the crate name, for others, it needs to be passed in
the comment line
2023-06-05 16:34:59 +02:00
Olivier Goffart
a3855f1bcb WIP: add a formatting function that works in the interpreter 2023-06-05 16:34:59 +02:00
Olivier Goffart
dcd8450dfa WIP: start working on translations: @tr()
This commit just do the parsing of the @tr macro.
2023-06-05 16:34:59 +02:00
Amirhossein Akhlaghpour
3a4f3c61d5
Add @rust-attr on scturct (#2785)
Fixes: #2660
2023-06-05 16:29:55 +02:00
Simon Hausmann
cad884ff1f Remove unnecessary property declaration in PopupWindow's internal type
We don't need to materialize this property because we only support
constant bindings at the moment.
2023-06-05 13:47:57 +02:00
Simon Hausmann
0f54b9599b Add support for manually closing PopupWindows
This patch adds a `close()` function that can be called to close a popup
window, and a `close-to-click` boolean that can be set to false to
disable the default behavior.
2023-06-02 18:07:49 +02:00
Simon Hausmann
a0a5294e49 Fix init callbacks not being invoked for PopupWindow 2023-06-02 18:07:49 +02:00
Olivier Goffart
f7e61fdd37 Fix transparentize to multiply by 1-factor
Also add `[[nodicard]]` in C++
2023-06-02 17:02:08 +02:00
Simon Hausmann
6b8214c3f9 Add support for italic and bold text in the software renderer's bitmap font path
In the screenshot tests this works by setting SLINT_DEFAULT_FONT to
pointer to a directory, instead of a file. We then load all fonts in
that directory and consider their families the default unless a family
is specified. This way for "Noto Sans" a regular as well as an italic
version is registered in fontdb and returned in the list of font
fallback ids. embed_glyphs in the compiler then embeds those variants
and we find them at run-time.
2023-05-31 18:47:39 +02:00
Tobias Hunger
1eb8d2875b
Fix warnings in cargo doc output 2023-05-30 10:08:44 +02:00
Florian Blasius
edc60c8ece Add password char to embeded_glpyhs 2023-05-30 09:03:25 +02:00
Simon Hausmann
ed287c55fe Use shared fontdb in the compiler
This eliminates the copy of the fontconfig handling code.
2023-05-23 08:26:03 +02:00
Olivier Goffart
6111b17a7c Proper error when wrong type used in an unary operation
Fixes #2669
2023-05-02 17:41:36 +02:00
Cole Lawrence
26fbef9cc0 collect_structs: visit function args and returns
Prevent compilation error in the generated code when dealing with
structs only referenced by public functions.

Fixes #2655
2023-04-29 08:24:17 +02:00
Olivier Goffart
ae1fb4c7cf Handle complex forward-focus loops 2023-04-24 18:03:33 +02:00
Olivier Goffart
7e7b9176a7 Don't infinite loop when forwarding focus to self 2023-04-24 18:03:33 +02:00
Olivier Goffart
b9d139fd6e Fix focussing element whose base is focusable
Fixes #2622
2023-04-24 18:03:33 +02:00
Simon Hausmann
6c8fa5f215
Fix duplicated loading/embedding of images (#2612)
For .slint files that are included, we canonicalize the path before
adding it into the import stack, to avoid duplicates. We didn't do that
for images in the global_embedded_resources.

Ensure this by canonicalizing as early as possible.

Fixes #2608
2023-04-21 13:15:22 +02:00
Olivier Goffart
1d3d19536e Use the dlopen feature for fontconfig
closes #2376
2023-04-19 17:25:02 +02:00
Olivier Goffart
a1ea00553f Compiler: hint when an id has the same name as a property or enum value 2023-04-18 16:16:31 +02:00
Olivier Goffart
946552b0c5 Fixes access to unset layout property
The previous code was only re-creating the layout properties for these
that had a binding, but that wasn't done if the property was just read,
leading to access to non-existing properties later.

Fixes #2483
2023-04-14 13:51:57 +02:00
Olivier Goffart
a57c7eb6bc Added TextInputInterface.text-input-focused 2023-04-12 14:49:08 +02:00
Olivier Goffart
6d0d6911f4 Fix visitation of init code
This patch merges the changes from #2344 and #2491 and do some cleanup

In particular, this visit the init code expression when visiting the
root element expression

Closes #2344
Closes #2491
Fixes #2487
2023-04-11 21:30:01 +02:00
Simon Hausmann
d87af7e917 Fix panic when binding Path's commands property to a model entry's field
Fixes #2466
2023-04-03 15:25:13 +02:00
Olivier Goffart
538dddf953 Update fontdb since resvg depends on the newer one 2023-03-28 15:55:27 +02:00
Olivier Goffart
977b1cc23a Update resvg dependency
Don't import all the dependent crate, use the re-export

And use a workspace dependency
2023-03-28 15:55:27 +02:00
Olivier Goffart
7652097582 Better error message when trying to use private property in native code
If one declare a `property <int> foo;` in Slint, it will be private by
default, and the getter/setter won't be generated, and it may be
confusing as to why

With this change, it still generate private getter and setter so this
gives a better hint to the developer what the problem is.

Replaces #2170
2023-03-27 17:49:07 +02:00
Olivier Goffart
3267d68541 Turn warning about non-existing image into error
This is only an error if we embedd recources.
(When using absolute path it is not an error/warning)
2023-03-27 11:14:25 +02:00
Olivier Goffart
cdcb1e55bc Turn warnings about invalid SLINT_DEFAULT_FONT into errors 2023-03-27 11:14:25 +02:00
Olivier Goffart
1089d29ebb Make Empty not fill the parent by default
Unless `preferred-*:100%` is set

Part of #2284
2023-03-24 11:15:05 +01:00
Olivier Goffart
b180661ff6 const propagation: simplyfy struct access
so that `{ min: 10px, max: 20px }.min`  get optimized
2023-03-24 11:15:05 +01:00
Tobias Hunger
3ac01c3f07 clippy: Fix clippy warnings 2023-03-09 09:35:29 +01:00
Olivier Goffart
8934bf3bf5 Layouting: When propagating constraint to parent, use the explicit constraints...
in addition to the implicit constraints

Finishes #783
2023-02-15 17:07:33 +01:00
Olivier Goffart
03e9edee64 Fix compiler panic when an component's base is not inlined
An element with children must be fully inlined or the children array
can't be easily computed.
But the code wouldn't work if the base of a component was not inlined
2023-02-15 09:20:12 +01:00
Olivier Goffart
41157b9984 Fix visible property on the root of a component
Just like opacity and other properties, it needs to prevent inlining.

And also add the same warning as for opacity if it is used on the root
(the Window)
2023-02-14 13:28:54 +01:00
Simon Hausmann
e09943ead5
Improve error message when trying to create a two-way binding to model data
Closes #2186
2023-02-10 13:13:15 +01:00
Simon Hausmann
02694f4992 Replace unwraps in compiler glyph embedding with diagnostics
As discussed with Olivier, fatal diagnostics are better than a panicing
compiler.
2023-02-09 18:16:29 +01:00
Simon Hausmann
047ab1d419 Fix run-time panic when combining forward-focus with text rendering in no_std environments
As outlined in #2199, there may be ways to trigger text layout code
through forward-focus before embedded fonts are registered. To fix this,
this patch replaces the init_code vector, which had the SetFocusItem
code before the font registration, with three explicit vectors for focus
setup code, code from init callbacks, and initial focus, and defines the
order in one central place in the copmiler (iter()).

Fixes #2199
2023-02-08 15:41:35 +01:00
Simon Hausmann
860f318f7c
Bump femtovg, rustybuzz, ttf-parser, and fontdb dependencies (#2191)
Mostly bugfix changes upstream with some minor API changes. FemtoVG is
no more limited to 24 gradient stops for the paint.
2023-02-08 09:56:53 +01:00