Commit graph

889 commits

Author SHA1 Message Date
Simon Hausmann
0ba6ef1c24 Fix build against macOS deployment target 10.10
- std::optional<T>::value() is not available, use operator * instead
- alignment allocation is also only available in 10.14 or newer
2023-04-24 18:02:55 +02:00
Olivier Goffart
4076df928d Fix panic when getting the line, column of diagnostic with invalid span
Introduced in cbc0c790a3
2023-04-19 12:35:17 +02:00
ogoffart
bd63218412 Bump version number to 1.0.1 2023-04-18 14:56:40 +00:00
Simon Hausmann
7e08231650 C++: Enable /bigobj by default when building with MSVC
Large C++ files generated from .slint files can cause link problems with MSVC.
When that happens, MSVC itself suggests /bigobj as remedy.

It's not apparent that there's a downside to using this option, apart from
backwaords binary compatibility - which is not a concern for us.

The discussion at https://developercommunity.visualstudio.com/t/Enable-bigobj-by-default/1031214 suggests that perhaps this
will become the default one day.

To simplify our examples and avoid users running into this, let's enable it by default.
2023-04-14 13:13:03 +02:00
Simon Hausmann
db29d01892 C++ docs: Fix red warning in generated HTML for file and namespace listings
The Furo theme by default generates a "on this page" contents list in
the right column. The breathe output for C++ namespace and file pages
also includes a ::contents:: RST directive, to summarize the available
headings. The duplication of these two is warned about by furo with a
big fat red warning.

Solve this by not making breathe generate the contents directive
anymore. According to

    https://exhale.readthedocs.io/en/latest/reference/configs.html?highlight=contentsspecifier#exhale.configs.kindsWithContentsDirectives

it's by default used for files and namespace, so make it empty in our
config.

Fixes #2505
2023-04-14 11:46:53 +02:00
Simon Hausmann
4d502a9f96 Add a C++ version of the Virtual Keyboard example 2023-04-14 11:39:02 +02:00
Simon Hausmann
004dce6c0b
Fix memory corruption when loading encoded embedded images in C++ (#2542)
The ImageCacheKey enum has a gap when not targeting wasm:

```
pub enum ImageCacheKey {
    /// This variant indicates that no image cache key can be created for the image.
    /// For example this is the case for programmatically created images.
    Invalid,
    /// The image is identified by its path on the file system.
    Path(SharedString),
    /// The image is identified by a URL.
    #[cfg(target_arch = "wasm32")]
    URL(SharedString),
    /// The image is identified by the static address of its encoded data.
    EmbeddedData(usize),
}
```

In the C++ generated header, that cfg was not mapped, and thus the URL
variant was always there, while in a regular slint-cpp build it's not.
Consequently tag value 2 in Rust was used to represent the EmbeddedData
variant, while in the C++ generated code that become variant 3 and 2 was
interpreted as a URL. So the receiving code in C++ tried to interpret
the cache key as URL variant, while Rust created it as EmbeddedData.

Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
2023-04-12 16:43:37 +02:00
Olivier Goffart
a57c7eb6bc Added TextInputInterface.text-input-focused 2023-04-12 14:49:08 +02:00
Simon Hausmann
a5bea16596
Add Ninja to the list of required tools (#2498)
We have plenty of command lines that explicitly use `-GNinja`, so let's
make Ninja a tool that is required. That's easier than changing all the
command lines to have two variants (use XX or YY if you have Ninja
installed), and we know that the dependency handling works best with
Ninja.

Fixes #2495

Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
2023-04-11 16:35:28 +02:00
Olivier Goffart
fd3f974d7e Don't use old syntax in docs 2023-04-06 17:06:46 +02:00
Simon Hausmann
08c0f1b34e Clean up hack to detect if we're doing a top-level build
... by introducing an explicit variable.

cc #2075
2023-04-04 09:06:38 +02:00
Simon Hausmann
13a5d3c5cd Fix builds of applications using Slint via FetchContent (part 2)
Amend 8406e1050d by fixing the condition
to apply the install_name when the cache variable used to detect package
builds is defined, not _not_ defined.

cc #2075
2023-04-03 17:36:34 +02:00
Simon Hausmann
8406e1050d Fix builds of applications using Slint via FetchContent
Set install_name to include rpath as per commit
916b927f4f only when doing top-level
builds that are meant to be installed via "make install".

cc #2075
2023-04-03 17:01:47 +02:00
Simon Hausmann
916b927f4f macOS: Fix installed libslint_cpp.dylib containing references to the build directory
Thanks to @jschwe, there's a way to instruct corrosion to supply link
flags that set the install name and work around cargo/rustc behavior.

In exchange, now that we're using rpath, to be able to continue to run
the tests and examples against a build tree, we need to set
CMAKE_BUILD_RPATH.

Fixes #2075
2023-04-03 15:59:01 +02:00
Tobias Hunger
64022bf0bd docs: Document release tags for use in cmake 2023-04-01 23:21:31 +02:00
Olivier Goffart
45c19d6154
C++ docs: fix the dir that should be passed to CMAKE_PREFIX_PATH 2023-03-31 11:25:42 +02:00
Simon Hausmann
714a91e928 cmake: Add the SLINT_FEATURE_RENDERER_WINIT_SOFTWARE option to enable the software renderer 2023-03-31 08:58:04 +02:00
Olivier Goffart
cdaf2abb47
C++: sort the member of a struct in the same order as in the .slint file 2023-03-29 19:11:33 +02:00
Tobias Hunger
6934b7b779 cmake: Fix SLINT_EMBED_RESOURCES
* Do not use the initialize_from feature introduced in cmake 3.23
2023-03-27 16:18:05 +02:00
Tobias Hunger
e5c44ad5a1 Update api/cpp/docs/cmake.md
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2023-03-27 09:27:44 +02:00
Tobias Hunger
c5ecade881 Rename embed-resources parameters fro the Slint compiler 2023-03-27 09:27:44 +02:00
Tobias Hunger
bad588e1e4 cmake: Document resource embedding 2023-03-27 09:27:44 +02:00
Tobias Hunger
5915f73918 cmake: Add support for SLINT_EMBED_RESOURCES as a target property 2023-03-27 09:27:44 +02:00
Tobias Hunger
52a70b7d89 cmake: Bump minimal cmake version to 3.23 2023-03-27 09:27:44 +02:00
Simon Hausmann
e3800fd3c3
Fix incorrectly rendered C++ docs code fence 2023-03-24 20:39:27 +01:00
Olivier Goffart
476ab383ea software_renderer: return the modified region from the render call
Closes #2389
2023-03-24 17:29:01 +01:00
Simon Hausmann
8ffb5131c7
Introduce error handling in the FemtoVG and Skia renderers (#2402)
Avoid unwrap() and expect() and instead propagate errors all the way
down to run_event_loop(), show(), and hide() in the Slint AIP.
2023-03-24 14:18:11 +01:00
Simon Hausmann
3839033300 Make it possible to use more than png and jpeg with Slint C++
Enable all the image formats the image-rs crate enables by default.
2023-03-23 13:28:39 +01:00
Olivier Goffart
88f9d0aed5 Slint docs style cleanups
- refresh copyright
 - link to slint-ui.com
 - add footer icons
2023-03-23 12:23:31 +01:00
Tobias Hunger
da95051db1
docs: Fix dead links between docs
... and add in text that went missing in the Globals section of the rust
docs.
2023-03-23 11:22:51 +01:00
Simon Hausmann
4af7ea8ab7 Switch to the Furo theme for the Slint Language and C++ documentation 2023-03-23 09:34:16 +01:00
Olivier Goffart
c82bb1515e C++ image: add some docs
Note: Don't use cbindgen to generate `operator==` for public types.
Because it doesn't have docs and the documentation show warnings
otherwise
2023-03-20 17:22:56 +01:00
Olivier Goffart
ef7fb6422a C++ Image API: introduce the SharedPixelBuffer 2023-03-20 17:22:56 +01:00
Olivier Goffart
be47c8464c C++: implement creation of image from raw data
Issue #616
2023-03-20 17:22:56 +01:00
Jyotirmoy Roy
f376741167
Rename BUILD_TESTING cache variable to SLINT_BUILD_TESTING #2362 (#2364)
Rename BUILD_TESTING cache variable to SLINT_BUILD_TESTING

Fixes #2362
2023-03-12 10:33:44 +01:00
Olivier Goffart
4df25b7f15 Janitor: upgrade corrosion 2023-03-09 09:14:34 +01:00
Tobias Hunger
9af756bf3f
cpp: Do not produce warnings when using the UIntModel 2023-03-06 17:03:20 +01:00
Tobias Hunger
1f877887cd docs: Remove builtin_ prefix from files in builtins dir 2023-02-24 12:04:22 +01:00
Simon Hausmann
ecb7819e9b doc: Fix links from C++ docs to the Slint Language Documentation
Fix paths and use HTML anchors, as the markdown links won't turn into
links as the files don't exist yet in that location.
2023-02-23 15:21:04 +01:00
Simon Hausmann
7e843a30d8 doc: Move the recipes into the Slint Language Documentation 2023-02-23 14:20:10 +01:00
Tobias Hunger
39d215bee0 docs: Rename "Slint language Reference" to "Slint Language Documentation" 2023-02-22 21:13:47 +01:00
Tobias Hunger
78892cdf1f docs: Fix broken links in our docs. 2023-02-22 17:08:30 +01:00
Tobias Hunger
96f75bdd0c
docs: Rework the rust part of the documentation (#2240)
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2023-02-20 21:06:05 +01:00
Simon Hausmann
2d878de7ac Bump corrosion
Fixes #2245
2023-02-17 16:46:49 +01:00
Olivier Goffart
81cb89d374 C++: fix including the generated file in several translation units 2023-02-17 16:42:40 +01:00
Simon Hausmann
aba5797eaa C++ docs: Elaborate a little on the argument to Window::set_rendering_notifier 2023-02-17 11:12:54 +01:00
Simon Hausmann
aee97b475e janitor: remove dead CMake code 2023-02-16 13:53:20 +01:00
Olivier Goffart
8450e01a3f
Change the name of the compat feature (#2230)
And remove the compat-0-2-0 and compat-0-3-0 features
2023-02-16 09:40:44 +01:00
Olivier Goffart
fd6c80a590 Set MSRV to 1.66 2023-02-16 09:03:22 +01:00
Tobias Hunger
1a31c9a50b
docs: Polish the C++ docs (#2229) 2023-02-15 15:47:45 +01:00