Commit graph

889 commits

Author SHA1 Message Date
Simon Hausmann
67940f8ff9 Fix cross-compilation of slint-compiler in Yocto environments (or when CC, etc. are set)
Don't enable jemalloc when cross-compiling.

Fixes #7463
2025-01-29 09:05:56 +01:00
Olivier Goffart
62e9111842 Fix C++ slint_register_font_from_* functions regarding to the error string
The C++ code already instentiate a `SharedString` on the stack, we are
not supposed to ptr::write into it.
Lickyly this didn't have any effect because the default constructed
string can be leaked without problem, but better be correct.

Also aboud temporary String allocation
2025-01-27 19:22:00 +01:00
Olivier Goffart
c98d234b9e Janitor: Always use `#![no_std] for runtime lib
And call `extern crate std` when the feature is enabled.
I've read this is the good practice on how to do it.
So that the std prelude is no longer included automatically.
There is then less difference between std and and no-std build which
should avoid surprises in the CI when we use things from the prelude.

The downside is that there is a bit of churn in the tests
2025-01-27 19:22:00 +01:00
Olivier Goffart
3d664578dd Fix ListView implementation in C++
Regressed in commit 4da79ac69a
2025-01-22 19:52:02 +01:00
Olivier Goffart
7e37f19e2c ListView: fix continuous redraw with fluent style
Because we set the viewport-width several time to different value during
the layouting of the ListView, it will cause this property to always be
dirty. In particular, this causes permanent restart of the fluent's
scrollbar animation on the size of the handle, causing continous
repaints.
2025-01-21 14:31:55 +01:00
Olivier Goffart
4da79ac69a Fix layouting of huge ListView with millions of items
The problem is that the precision of f32 for coordinate wouldn't be
accurate enough with such big viewport to put the elements so that they
are next to eachother.
So put the elements relative to the Flickable instead of relative to the
created moving viewport Rectangle.

Fixes #3700

Note that the ListView still use f32 for the scrollbar value, meaning
that at some point, the wheel stops working as the wheel increment is
smaller than the f32 increment, and scrolling becomes somehow fuzzy.
But this only happens after one more billions pixels now, so one can
have more than 50 millions of elements without much problems
2025-01-20 17:41:38 +01:00
Simon Hausmann
8e6d2c80e5 Use unicode-segmentation from the Cargo workspace 2025-01-14 19:31:34 +01:00
Tasuku Suzuki
68b9dfc247 String: Add .is-empty and .character-count properties
Introduce two new properties for string in .slint:
- .is-empty: Checks if a string is empty.
- .character-count: Retrieves the number of grapheme clusters
  https://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries

These additions enhance functionality and improve convenience when working with string properties.
2025-01-14 19:29:05 +01:00
Olivier Goffart
8a5df27469
Update to Image 0.25 (#7365)
Added image-default-formats with all the format supported by image by
default, and enable that feature by default.
Also put that feature in compat-1-2 for compatibility with user that
have used image 0.24 with enabled features.
Make a new compat-1-10 feature that does not enable default format by
default

ChangeLog: upgraded image crate to 0.25, added a new cargo feature
to enable all image formats. (that feature is enabled by default with
compat-1-2, added compat-1-10 to disable it

Fixes https://github.com/slint-ui/slint/issues/7251
2025-01-14 16:31:05 +01:00
Olivier Goffart
5c6ddfdda9 C++ tests: disable false positive warning on more recent version of GCC
CC #7358

(Test for version 14 because that is what i have installed and haven't
tested any other versions)
2025-01-14 09:54:51 +01:00
Simon Hausmann
43db58aaf5 Bump MSRV to 1.82
Fixes #7254
2025-01-14 08:33:21 +01:00
ogoffart
c83af3ca5c Bump version number to 1.10.0 2025-01-13 13:38:41 +00:00
Simon Hausmann
6e81f90d33 esp-idf: Remove unecessary template parameter from EspWindowAdapter 2025-01-13 14:27:37 +01:00
Simon Hausmann
f5909807ea esp-idf: Rename SlintPlatformConfiguration's color_swap to byte_swap and deprecate color_swap_16 2025-01-13 14:27:37 +01:00
Simon Hausmann
287bd922a4 Apply Olivier's suggestion for the byte_swap field's behaviour for RGB8 displays. 2025-01-13 14:27:37 +01:00
Simon Hausmann
1f205dffe7 esp-idf: Document SlintPlatformConfiguration's PixelType parameter 2025-01-13 14:27:37 +01:00
Simon Hausmann
5ef3fb8b26 esp-idf: Implement color_swap for RGB8 pixels
Use Olivier's great trick to rename color_swap_16 to color_swap via
union.
2025-01-13 14:27:37 +01:00
Simon Hausmann
8903124239 esp-idf: Add support for RGB8 rendering
... by making SlintPlatformConfiguration a template and using a deduction guide to make it source compatible (Olivier's magic :)
2025-01-13 14:27:37 +01:00
Olivier Goffart
87d86ae7d2 Only re-create elements if the model actually changed
Being dirty is not enough

Fixes #7245

ChangeLog: Elements of a `for` now only get re-created if the model is
changed, not if it is only dirty
2025-01-13 12:11:21 +01:00
Tasuku Suzuki
346d1c2df3 Fix typos
Ran `typos .` and fixed all typos that do make sense.
https://crates.io/crates/typos
2025-01-13 08:35:20 +01:00
Olivier Goffart
3e94bd2167 Janitor: Remove trailing whitespaces from all files
`git grep -I -l -O'sed -i "s/[[:space:]]*$//"' -e ''`
2025-01-10 13:23:22 +01:00
Simon Hausmann
1a49798180 Include a third-party license attribution in the binary C++ packages
Generate a top-level licenses/ folder and include it in the CPack archive.
2025-01-08 21:43:30 +01:00
Olivier Goffart
6b4c822a4a MenuBar: C++/Rust native menubar implementation
introduce a SetupMenuBar builtin function to ease C++/Rust lowering
2025-01-08 21:16:17 +01:00
Olivier Goffart
846664ad45 WIP: native menubar using muda
Only the interpreter is implemented so far

MacOs won't work yet because we don't disable the default winit menubar

The viewer don't support removing the MenuBar yet
2025-01-08 14:05:35 +01:00
Simon Hausmann
6458393bb8 Fix C++ package names for Linux ARM packages
They're built inside an x86-64 docker container, but they're targeting
ARMv7/ARMv8. So stick to the CMake/CPack default (Linux-Arm, etc.) and
use Slint-cpp-$rust_target only for MCU (freestanding) builds that don't
target an OS (known to CMake).
2025-01-06 16:38:53 +01:00
ogoffart
f309a551b5 Bump version number to 1.9.2 2024-12-30 10:18:16 +00:00
Olivier Goffart
194c841df1
Update corrosion 2024-12-30 11:00:53 +01:00
aurindam
dc3f29b6da Bump version number to 1.9.1 2024-12-19 12:57:19 +00:00
Nigel Breslaw
3fae8b2a9a
Docs tests: remove leading slash (#7170)
* Docs tests: remove leading slash

* Fix slash handling in link-data.json for the C++ docs

* Fix trailing slash handling for link-data.json for the Rust API docs

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-12-19 14:01:49 +02:00
Simon Hausmann
b4b878d71e Introduce link-data.json in the C++ docs to reduce risk of dead links 2024-12-17 16:20:47 +01:00
Simon Hausmann
913362a303 Fix license header check 2024-12-16 21:54:37 +01:00
Simon Hausmann
a7f965c941 Include list of third-party licenses in the C++ docs
This isn't very pretty, but I think it does the job.

cc #6634
2024-12-16 21:54:37 +01:00
Simon Hausmann
8d85c54a6f Fix up Window::take_snapshot docs
Clarify the "performance" as discussed in the API review.
2024-12-11 17:07:23 +01:00
Olivier Goffart
e03e812984 Fix Focus in PopupWindow
Fix https://github.com/slint-ui/slint/issues/2911
2024-12-09 15:58:16 +01:00
Olivier Goffart
917b0c88f7 C++: set_xdg_app_id: use std::string_view in the API 2024-12-07 09:34:34 +01:00
Olivier Goffart
44df136c4f Translation API: a few renaming for API review 2024-12-07 09:33:58 +01:00
Olivier Goffart
3b0ddbfa75 C++: Use size_t instead of uintptr_t for the index and count
Same as row_count
2024-12-07 08:25:42 +01:00
Olivier Goffart
a3dad45f0b Accessibility: rename a few properties after API review:
- Rename `accessible-selectable` and `accessible-selected` to `accessible-item-{selectable,selected}`.
   Because the property is for items in list rather than eg Text
 - Rename `accessible-position-in-set` to `accessible-item-index`.
 - Rename `accessible-size-of-set` to `accessible-item-count` and move
   the property to the container element rather than the item itself
2024-12-07 08:25:42 +01:00
Nigel Breslaw
92534a8a27
1.9 Organise docs folder. (#7005)
Move astro files to docs/astro
2024-12-05 15:40:04 +02:00
Simon Hausmann
1888e58735 Add API to set the XDG app id
ChangeLog: Added function to set the XDG app id on Wayland/X11. This needs to be added with respective function names in the language sections.

Fixes #1332
2024-11-22 11:24:06 +01:00
FloVanGH
6ebce7e5f4
cpp: added to_lowercase and to_uppercase to SharedString (#6869)
* cpp: added to_lowercase and to_uppercase to SharedString

* Update api/cpp/include/slint_string.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update api/cpp/include/slint_string.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update api/cpp/include/slint_string.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update api/cpp/include/slint_string.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/core/string.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/core/string.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/core/string.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/core/string.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* code review feedback

* Update api/cpp/tests/datastructures.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* code review feedback

* Update api/cpp/include/slint_string.h

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Update api/cpp/include/slint_string.h

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-11-21 18:53:02 +00:00
Olivier Goffart
5bd20def0e Experimental support for MenuBar
Introduces `MenuBar{ ... }` that can be put in a Window
2024-11-20 09:25:37 +01:00
Olivier Goffart
014b58c81a
C++: allow to configure bundled translation 2024-11-18 15:57:08 +01:00
Olivier Goffart
d68b84a3f1
Change API to set the language with bundle translation
* Change API to set the language with bundle translation

Part of #6793
2024-11-17 11:40:02 +01:00
Nigel Breslaw
08d90a5f13
Next gen docs for 1.9 (#6766)
Co-authored-by: Aurindam Jana <aurindam.jana@slint.dev>
Co-authored-by: Tobias Hunger <tobias.hunger@slint.dev>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-11-14 15:52:35 +01:00
Simon Hausmann
a7a3b3f9ee Changelog: C++: Add slint::Window::take_snapshot()
Corresponds to the Rust API.
2024-11-13 12:38:36 +01:00
Brandon Fowler
6da0f55b05
Associate PopupWindows with an ID for their active popup (#6693)
Popups are stored in a HashMap and are assigned an ID so popup.close(); closes the correct popup and so a single PopupWindow cannot be opened multiple times
2024-11-04 09:17:55 +01:00
Olivier Goffart
875ca075fb esp-idf: Fix vsync locking 2024-11-01 18:49:11 +01:00
Olivier Goffart
0f8e3b84b7 Janitor: fix doc comment 2024-10-30 10:43:40 +01:00
Arnold Loubriat
97219c21bf Add the accessible-size-of-set property 2024-10-30 15:54:01 +08:00