Commit graph

889 commits

Author SHA1 Message Date
Olivier Goffart
d8b0737b1d Translations: disable gettext by default for C++ and the viewer
Can cause problem when compiling on windows or mac
2023-06-08 16:56:10 +02:00
Simon Hausmann
fb1d37286f Clean up the Skia renderer API
Accept display and window handles with life time, instead of &dyn
HasRaw*Handle.
2023-06-07 12:20:57 +02:00
Olivier Goffart
12e6b34e2d Translations: support for plurals 2023-06-07 10:34:34 +02:00
Olivier Goffart
723a4477d6 C++: prospective fix for warning in CI on windows 2023-06-06 14:23:02 +02:00
Olivier Goffart
6b262e120d Translations in C++ 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
cf746ddf8d WIP: formatting implementation of translate in rust and C++ 2023-06-05 16:34:59 +02:00
Simon Hausmann
29aea9a04c Remove workaround for running tests on Linux
With the latest Corrosion update test binaries don’t depend on libslint_cpp.so with path anymore that contains a slash. Therefore rpath kicks in and this workaround should not be needed anymore.

Plus, this gives us test coverage for rpath.
2023-06-03 15:48:51 +02:00
Simon Hausmann
7485fd6f70
janitor: Update to Corrosion 0.4.1 release (#2807) 2023-06-03 12:39:38 +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
Olivier Goffart
f7e61fdd37 Fix transparentize to multiply by 1-factor
Also add `[[nodicard]]` in C++
2023-06-02 17:02:08 +02:00
Olivier Goffart
5599bd44e0 Remove Color::opaque
It is not a right name and i don't think it is a so common operation
2023-06-02 17:02:08 +02:00
Olivier Goffart
4845241ebf Rename translucent to transparentize and mixed to mix 2023-06-02 17:02:08 +02:00
Arthur Araruna
64ad1ce357 Add some color and brush manipulation funcs (#2565)
The added functions enable mixing colors and manipulating the opacity
of colors and brushes.

They enable the behavior of some of the available functions from SASS and are
added for future use for adding the Adwaita style (future PR).
2023-06-02 17:02:08 +02:00
Simon Hausmann
c428601370
Add support for select-all(), cut(), copy() and paste() functions on text input elements (#2804)
In the compiler this is still very primitive, but an attempt to start a
generic interface. The basic assumption is that all item functions will
eventually need access to the window adapter and itemrc. Support for
additional arguments is still missing.

Also missing is support for the function access via rtti in the
interpreter, hence the hardcoding at the moment.
2023-06-01 16:04:53 +02:00
Simon Hausmann
e7320607a3 Remove BorrowedOpenGLTexture from the public API again and just provide a factory function in slint::Image 2023-06-01 15:56:55 +02:00
Simon Hausmann
084ff70079 C++: Improve reliability of comparison operator of slint::Image
Call into the Rust implementation, so that we have to maintain only one
implementation.
2023-06-01 15:56:55 +02:00
Simon Hausmann
f51ca82f10 Add C++ API and example for borrowing OpenGL textures 2023-06-01 15:56:55 +02:00
Olivier Goffart
b634b1fa7f corrosion: update to beta2 2023-06-01 09:34:19 +02:00
Olivier Goffart
1036c0d082 c++: remove IMPORTED_NO_SONAME as corrosion sets it now 2023-06-01 09:34:19 +02:00
Olivier Goffart
9a103b9c37 Test beta version of corrosion 2023-06-01 09:34:19 +02:00
Florian Blasius
b4472b9118
Added switch widget (#2798)
* Add material Switch

* Add fluent switch

* Add native Switch and cleanup

* Rebase fix

* Update internal/compiler/widgets/fluent-base/std-widgets-impl.slint

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

* Code review

* Update docs/language/src/builtins/widgets.md

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

* Update docs/language/src/builtins/widgets.md

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

* Code review

* Update docs/language/src/builtins/widgets.md

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

* Update examples/gallery/ui/pages/controls_page.slint

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

* Code review tweak on gallery layout

* Code review tweak on gallery layout

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-05-31 14:57:23 +02:00
Simon Hausmann
590b011d0b Fix build with new cbindgen
Unfortunately the latest cbindgen release added private field to a
public struct, breaking our build. Work around this until
https://github.com/mozilla/cbindgen/issues/841 is fixed.
2023-05-31 13:35:03 +02:00
Florian Blasius
9e267bcc94
Add ProgressIndicator widgets (#2792)
* Add material ProgressIndicator and documentation

* Add fluent ProgressIndicator

* Add native ProgressIndicator

* Update docs/language/src/builtins/widgets.md

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

* Update docs/language/src/builtins/widgets.md

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

* Update docs/language/src/builtins/widgets.md

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

* Update docs/language/src/builtins/widgets.md

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

* Code review

* Update internal/compiler/widgets/fluent-base/std-widgets-base.slint

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

* Update changelog

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-05-31 09:57:12 +02:00
Simon Hausmann
599d86e4e1 Simplify Skia renderer API
Remove the size argument from render().
2023-05-26 10:46:59 +02:00
Simon Hausmann
dd61890e23 Fix rendering of the Qt platform example with high-dpi
- Provide a C++ platform event for the scale factor change and send it
- Report the correct logical and physical sizes to Slint
2023-05-25 05:29:52 +02:00
Simon Hausmann
dd04e044d0 Fix build of C++ OpenGL underlay example
Test for the right feature flag and fix the compatibility feature names.
2023-05-23 17:26:45 +02:00
Simon Hausmann
ef4074b041 Further simplify renderer storage in C++ platform API
Using an std::optional is even simpler and avoids a malloc.
2023-05-21 14:40:43 +02:00
Simon Hausmann
b47936d4cd Make AbstractRenderer functions private in the sub-class 2023-05-21 14:40:43 +02:00
Simon Hausmann
289883ccc0 Replace access to raw WindowAdapterRcOpaque with friend declarations 2023-05-21 14:40:43 +02:00
Simon Hausmann
baba30370a Simplify C++ WindowAdapter <> Renderer interface further
Instead of the WindowAdapter being a template for a concept, let's just
use an abstract base class for the renderer. Since we provide the
renderers, this simplifies two things:

- Ownership becomes clear to the user by creating the renderer instance
in a field of theirs.
- All template use goes away on the user side.
2023-05-21 14:40:43 +02:00
Simon Hausmann
fe4a434ce4 Remove the WindowAdapter from the renderer constructor
This allows disentangling the native window creation from the renderer
creation, which is rather ugly and complicated on the C++ side.
2023-05-21 14:40:43 +02:00
Olivier Goffart
dd5ef9993f
Platform: Add a Resized event and use that to convey the changes in size (#2759) 2023-05-21 12:12:30 +02:00
Simon Hausmann
3db5b97790 Fix the Qt native platform example
Fix regression introduced with commit d0cdc462c7:
The window surface must exists before querying for the window handles.
2023-05-17 14:59:16 +02:00
Simon Hausmann
d9bc7a08f9 Fix crash when using experimental C++ SkiaRenderer API
Don't box the Result<Renderer, Error>, but box just the renderer.
Otherwhise the cast to the renderer pointer is nonsense.
2023-05-17 14:33:39 +02:00
Simon Hausmann
b27163954a Fix build of experimental C++ platform API on Linux 2023-05-17 12:41:37 +02:00
Olivier Goffart
422bcc3a4a C++: optimize SharedVector's iterator constructor
Don't detach for every element.

Closes #2737
2023-05-17 09:23:17 +02:00
Simon Hausmann
db07384e9f Remove stray outdated comment 2023-05-11 10:42:09 +02:00
Simon Hausmann
185334d5e7 Fix doc comment 2023-05-11 10:42:09 +02:00
Simon Hausmann
3340c31249 Clean up C++ experimental native window handle API
- Use explicit constructor functions
- Box the implementation
2023-05-11 10:42:09 +02:00
Simon Hausmann
0475b91daf skia: Simplify renderer API
Remove the generic window handle owner part of the API. Instead assume
that the caller provides safety for the given window handles, like we do
for FemtoVG and like softbuffer does it in its public API.
2023-05-11 10:42:09 +02:00
Simon Hausmann
d0cdc462c7 Simplify Skia Renderer
Allocate the renderer's surface type in the constructor.

This also changes the C++ API to match this, which complicates some code
a little bit.
2023-05-11 10:42:09 +02:00
Simon Hausmann
77645d9908 C++: Warn when the return value of slint::Image::load_from_path is not used
Somebody recently accidentally wrote this code:

```cpp
slint::Image image;
image.load_from_path(...);
```

and that should have produced a warning.
2023-05-10 11:46:00 +02:00
Simon Hausmann
481288d489 Initial support for rendering with Skia and Vulkan
Closes #1546
2023-05-09 08:58:35 +02:00
Olivier Goffart
f9e5559eeb C++ test with an example of using the Windows API directly to create a slint platform 2023-05-05 19:53:37 +02:00
Olivier Goffart
76356c181b Tests: look at _all_ markdown files for slint snippets
We were missing some which had errors

Fixes #2689
(Although the error for 2689 was in C++ and would not have been
discovered by the test, better to have it parsed anyway)
2023-05-05 08:50:37 +02:00
Olivier Goffart
65e879e55f
Document how anonymous objects are mapped to native code
As discussed in https://github.com/slint-ui/slint/discussions/2650
2023-04-28 09:30:23 +02:00
ogoffart
dfd5fc38b3 Bump version number to 1.0.3 2023-04-26 14:04:08 +00:00
ogoffart
53cce5bf44 Bump version number to 1.0.2 2023-04-26 11:33:16 +02:00
Simon Hausmann
c6c6564537 Fix C++ formatting 2023-04-24 18:02:55 +02:00