Commit graph

871 commits

Author SHA1 Message Date
Olivier Goffart
6a15a1d69a Janitor: upgrade corrosion 2024-05-02 18:43:47 +02:00
Olivier Goffart
12d904a71c
Fix compiler panic with init in a component inlined into a repeater
The problem was that the code from #4322 inlined the init code in the
parent Component as at that point, the per-repeater component don't
exist yet.
Fix it by removing the workaround from #4322, but changing the order of
the passes so that the init code are already proccessed before any
inlining. This required to change the order of a bunch of passes.

Fixes #5146

As a drive-by, also add the missing C++ implementation of set_animated_value
for Brush that was discovered by the test. (Code wouldn't compile)
2024-04-29 15:34:12 +02:00
Olivier Goffart
15f09c9224 Testing: expose the description and the checked accessible property
also rename default_action to accessible_default_action
2024-04-26 15:09:37 +02:00
Olivier Goffart
5955d19706 Expose the individual rectangle in the dirty region 2024-04-26 14:45:23 +02:00
Simon Hausmann
31767eb6ab Add a clear-focus()function on all elements that have a focus() function
This is the counter-part, which removes focus from the element if it's currently focused. The window - if focused - may still be focused towards the windowing system.
2024-04-26 11:09:11 +02:00
Simon Hausmann
7683f805a5 janitor: Remove dead code
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2024-04-24 10:39:03 +02:00
Simon Hausmann
d8c1096149 Testing: Change ElementReference to be weak
We don't want testing variables to affect the life-cycle of elements in the UI.
2024-04-24 10:39:03 +02:00
Olivier Goffart
7c3f8683b7 C++: Move internal testing function to the internal namespace
Remove send_keyboard_char as it doesn't appear to be used
(while send_keyboard_string_sequence is used in a single test)
2024-04-23 11:19:14 +02:00
Olivier Goffart
4856f387ee C++ Todo example: add test 2024-04-22 13:54:28 +02:00
Olivier Goffart
5a4713aa17 C++: add #pragma once to generated file 2024-04-22 13:06:05 +02:00
Olivier Goffart
475ced0a62 C++ testing API: Intreoduce the ElementHandle 2024-04-22 11:28:12 +02:00
Olivier Goffart
13fe59cc2e C++: Move the internal test helper in the private_api namespace
in a different file
2024-04-22 11:28:12 +02:00
Olivier Goffart
808b1ef946 Add a function to mark translated strings as dirty 2024-04-18 19:23:57 +02:00
Olivier Goffart
d4741efac0 testing: rename the init function 2024-04-18 18:45:31 +02:00
Olivier Goffart
8030732f46 Refactor the testing backend
Move code around and gate the internal functions used in our own tests
so we can make the testing backend public
2024-04-18 18:45:31 +02:00
Simon Hausmann
98a34e5d9b Fix Windows C++ binary package file name (attempt 4)
CPACK_SYSTEM_NAME is not defined until including CPack.cmake, which
has to happen last. So do it by hand.
2024-04-17 07:16:44 +02:00
Simon Hausmann
35605af303 Fix Windows C++ binary package file name (attempt 3)
CPACK_SYSTEM_NAME is what we used before, and that has the win64 suffix
that the prepare_release job in nightly_snapshot.yaml expects. Also
fixed the docs to add the missing MSVC suffix that's new.
2024-04-16 17:50:59 +02:00
Simon Hausmann
20431b41bb C++: Fix build with nightly Rust
Cargo disallows dashes in library target names (lib.name in Cargo.toml), but when not set it uses
the package name. That meant that dashes snuck in and https://github.com/rust-lang/cargo/pull/12783 fixes that.

The targets Corrosion creates correspond to the library name, so after that change it's slint_cpp.

To make this work with stable cargo, explicitly switch lib.name to slint_cpp.
2024-04-16 15:59:43 +02:00
Olivier Goffart
13127dc71c Accessibility: Add support for accessibility-action-* callback (#5073)
Merge branch 'feature/accessibility'

 Conflicts:
	internal/compiler/widgets/cosmic-base/button.slint
	internal/compiler/widgets/cupertino-base/button.slint
	internal/compiler/widgets/fluent-base/button.slint
	internal/compiler/widgets/material-base/button.slint

Also updated license header in actions.slint
2024-04-16 15:02:25 +02:00
Olivier Goffart
8f0d62dc21 Fix calling the NativeSpintBox::edited callback from C++
The "IntArg" was not expose properly
2024-04-16 12:58:31 +02:00
Simon Hausmann
613eb90029 Windows: Fix package generation
The version number is not set, so the package name would end up as
Slint-cpp---MSVC.exe. Instead, just append the MSVC suffix, as
suggested by Olivier.

Amends cacc13343f
2024-04-16 10:02:09 +02:00
Olivier Goffart
0f05089d5e Polish the C++ and Rust HSV API 2024-04-15 18:18:00 +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
Olivier Goffart
1d2201a7ce Janitor: Update the image crate
Note: this could be a breaking change if someone did

```
image = { version = "0.24", features = [...] }
```

To enable more features decoder of the image to support more file format
in slint
2024-04-15 12:11:54 +02:00
Simon Hausmann
a61ca93cd1 doc: Attempt to clarify how the factor of color's mix() function is applied 2024-04-15 09:05:54 +02:00
Simon Hausmann
cacc13343f
Clarify the Windows C++ package compiler dependency (#5053)
Add a -MSVC suffix to our binary package (and prepare for future MinGW build)

cc #5052
2024-04-15 08:28:19 +02:00
Russell Greene
5c6e3bab04 rerun-if-env-changed=SLINT_GENERATED_INCLUDE_DIR
cargo currently doesn't know that we read this env var, which can lead to caching issues
2024-04-12 11:47:23 +02:00
Olivier Goffart
36669e8df7 esp-idf: redirect debug_log! to esp-println 2024-04-05 15:24:52 +02:00
Olivier Goffart
e2bfb9a513 esp-idf: fix gating of experimental feature
Commit 31219223e5 removed the optional,
but didn't remove the default argument
2024-04-04 15:43:34 +02:00
Olivier Goffart
80b59653a2 Janitor: Fix warnings with no_std and nightly rust 2024-04-04 14:03:36 +02:00
Chris Chinchilla
7afa34a7e1
Rename tutorial to quickstart (#4941) 2024-04-04 13:26:24 +02:00
Olivier Goffart
31219223e5 C++: Gate the line by line rendering behind experimental flag 2024-04-04 10:23:00 +02:00
Olivier Goffart
48d1b96441 esp-idf: cleanup the line_by_line rendering 2024-04-04 10:23:00 +02:00
Simon Hausmann
042bde7883 esp-idf: Add support for line-by-line rendering
Rendering by line into a line buffer that's in IRAM can be faster than accessing framebuffers in slower PSRAM, so offer this by allowing users
to omit even the initial framebuffer.
2024-04-04 10:23:00 +02:00
Francesco Cusolito
e8ce0cb5e5
C++: FilterModel with deferred filtering (#4984)
Avoids to invoke filtering function until FilterModel is completely constructed, deferring it to first model usage.
2024-04-02 09:03:07 +02:00
Olivier Goffart
523e1a161c WIP: More on support for accessibility actions
Continue with the core library support and the compiler support.

This hasn't been tested yet and is missing implementation in the
backends
2024-03-28 11:28:56 +01:00
Olivier Goffart
fe38a1e97d C++: Fix and test the reset function on model adapter
They were causing infinite recursion because they were calling
themselves.

Also add the missing MapModel::reset

Yet another motivation for https://github.com/slint-ui/slint/issues/3888
as the code was mixing the `reset` function on the adapter meaning
"please re-apply the adapter filter/map/sort function" with the `reset`
function on Model which means "the subclass has changed and we should
notify listeners".

Fixes #4968
2024-03-28 11:11:57 +01:00
Olivier Goffart
fd4dcfc128
Update MSRV to 1.73
A MSRV update is required to update the image crate to 0.25, otherwise
we get link error that are ficed in newer version.
Also other dependency update such as env_logger needs a newer MSRV.

Update to 1.73 because it has functions like `with_borrow` on thread
storage which we already actually use in some platform.

This is also the last release before the the drop of macOs < 10.12
in Rust 1.74
2024-03-27 09:04:31 +01:00
ogoffart
6bf40989d9 Bump version number to 1.6.0 2024-03-27 07:49:22 +00:00
Simon Hausmann
68083243b2
Add an in-out boolean color-scheme property to Palette (#4701)
This allows applications to force dark/light mode, as well as determine
which mode is active.
2024-03-26 15:44:22 +01:00
Simon Hausmann
b988d6d198 esp-idf: poll for touch events if there's no touch interrupt assigned 2024-03-20 13:01:45 +01:00
ogoffart
20c570ab1d Bump version number to 1.5.1 2024-03-18 08:55:01 +00:00
Simon Hausmann
b1f408f683 Fix build of generated C++ code when using transitions on int properties with esp-idf
The energy monitor declares a transition on an animated int property,
for which Property<int>::set_animated_binding_for_transition is called,
which in turn calls slint_property_set_animated_binding_helper. The
latter is overloaded for various property types, such as float, Color,
or Brush, and then calls specialized functions from ffi, such as

slint_property_set_animated_binding_(int|float|etc.).

slint_property_set_animated_binding_int uses i32 in Rust, which cbindgen
maps to int32_t, so the
slint_property_set_animated_binding_helper overload also uses int32_t.

Unfortunately, with esp-idf, int32_t is a distinct type from int, and
the overload resolution fails.

As remedy, this change uses c_int instead of i32 in the Rust ffi, which
maps to int.

This seems easier than changing Property<int> to Property<int32_t> :-)
2024-03-12 20:25:00 +01:00
Simon Hausmann
76ac137438 Fix build against esp32-p4
- Bump esp-backtrace for esp32-p4 support, which removes the uart feature and delegates to esp-println
- Added esp-println dependency
- Add mapping for ESP32P4 and other risc-v esp-idf targets to the corresponding rust target triplet.
  Unfortunately there's no generic pattern like for xtensa, as can be seen on
  https://github.com/esp-rs/esp-idf-sys?tab=readme-ov-file#examples
2024-03-11 17:49:15 +01:00
Simon Hausmann
e541053c6c Fix build against current esp-idf git
It looks like the esp_lcd_rgb_panel.h header file is not unconditionally
available anymore. Guard it with the same #ifdef that's surrounding the
calls to esp_lcd_rgb_panel_* and include the header that provides it.
2024-03-11 17:49:15 +01:00
Simon Hausmann
efb626a54a
C++: Fix incorrectly documented minimum supported Rust version 2024-03-08 15:20:53 +01:00
Simon Hausmann
77f0cd9eac Fix license header check for Pipfiles 2024-03-07 10:08:12 +01:00
Wilston Oreo
bef532b5fc
Optional C++ namespaces (#4759)
Co-authored-by: Michael Winkelmann <michael@winkelmann.site>
2024-03-06 19:43:11 +01:00
Simon Hausmann
fa2cf8c28a C++ Interpreter: Add support for setting the translation domain
This maps straight to the Rust API.
2024-02-22 16:58:38 +01:00
Olivier Goffart
9f0c3c94a9 C++: minimize/maximize/fullscreen API on Window 2024-02-22 13:17:50 +01:00