Commit graph

593 commits

Author SHA1 Message Date
Tobias Hunger
e02c360000 Clippy polish 2023-06-28 14:22:30 +02:00
Tobias Hunger
8345c6cd79 Do automatic clippy fixes 2023-06-28 14:22:30 +02:00
Olivier Goffart
331e5713c2 C++: Use a static_assert to detect Slint version mismatch
cc #2909 , #223

New message:
```
/home/olivier/slint/build2/examples/gallery/gallery.h:6:73: error: static assertion failed: This file was generated with Slint compiler version 1.1.1, but the Slint library used is 1.1.0. The version numbers must match exactly.
    6 | static_assert(1 == SLINT_VERSION_MAJOR && 1 == SLINT_VERSION_MINOR && 1 == SLINT_VERSION_PATCH, "This file was generated with Slint compiler version 1.1.1, but the Slint library used is " SLINT_VERSION_STRING ". The version numbers must match exactly.");
/home/olivier/slint/build2/examples/gallery/gallery.h:6:73: note: the comparison reduces to ‘(1 == 0)’
```

Previous message:
```
/home/olivier/slint/build2/examples/printerdemo/cpp/printerdemo.h:12218:161: error: conversion from ‘VersionCheckHelper<[...],[...],0>’ to non-scalar type ‘VersionCheckHelper<[...],[...],1>’ requested
12218 | [[maybe_unused]] constexpr slint::private_api::VersionCheckHelper<1, 1, 1> THE_SAME_VERSION_MUST_BE_USED_FOR_THE_COMPILER_AND_THE_RUNTIME = slint::private_api::VersionCheckHelper<SLINT_VERSION_MAJOR, SLINT_VERSION_MINOR, SLINT_VERSION_PATCH>();
      |                                                                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/olivier/slint/build2/examples/printerdemo/cpp/printerdemo.h:12218:161: error: could not convert ‘slint::private_api::VersionCheckHelper<1, 1, 0>()’ from ‘VersionCheckHelper<[...],[...],0>’ to ‘VersionCheckHelper<[...],[...],1>’
12218 | [[maybe_unused]] constexpr slint::private_api::VersionCheckHelper<1, 1, 1> THE_SAME_VERSION_MUST_BE_USED_FOR_THE_COMPILER_AND_THE_RUNTIME = slint::private_api::VersionCheckHelper<SLINT_VERSION_MAJOR, SLINT_VERSION_MINOR, SLINT_VERSION_PATCH>();
      |                                                                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                                                                                 |
      |                                                                                                                                                                 VersionCheckHelper<[...],[...],0>
```
2023-06-28 14:16:52 +02:00
Olivier Goffart
f0a1ef7194 Fix getting type of more complex expressions in model
Fixes #2977

The problem is that expressions such as "foo * foo" can be optimized by
optimization pass to only query the property once, and this is
transformed in a Expression::CodeBlock and is no longer a
Expression::Cast(Model)
So we need to introspect the expression more.
2023-06-27 10:06:20 +02:00
Olivier Goffart
a709402bf9 LSP: auto-complete relative to CARGO_MANIFEST_DIR in slint! macro 2023-06-26 18:44:34 +02:00
Olivier Goffart
56a58f704b Compiler: load import and other files relative to the CARGO_TARGET_DIR for .rs files 2023-06-26 18:44:34 +02:00
ogoffart
c8c9496722 Bump version number to 1.1.1 2023-06-26 12:50:02 +00:00
Olivier Goffart
9b59036816 Add licenses symlinks 2023-06-26 13:12:29 +02:00
Olivier Goffart
1b9e245b4e Remove the NativeSwitch
It is identical to the NativeCheckBox  (Qt don't have a switch widget)
2023-06-23 11:02:46 +02:00
Olivier Goffart
c260210d6d Janitor: update itertools 2023-06-22 15:03:10 +02:00
Aurindam Jana
78679030f9 Update About Slint widget 2023-06-22 12:55:45 +02:00
Olivier Goffart
31fc7cdd08 Janitor: Some dependencies update 2023-06-21 17:24:57 +02:00
Florian Blasius
82cc0683e8
Switched to relative-font-size for fluent. (#2951) 2023-06-21 15:37:42 +02:00
Florian Blasius
e3486542d8
Polish fluent design refresh (#2950) 2023-06-21 11:46:47 +02:00
Simon Hausmann
016d776b7d Simplify implementation of absolute-position
Since we materialize only one point property, we don't need to cache the
parent position in a separate property, but we can just store that in
the binding.
2023-06-21 10:02:04 +02:00
Simon Hausmann
ab0e38c76d
Merge absolute-x and absolute-y "virtual" properties into absolute-position (#2942)
The type of thep property is `Point`, which existed before. It was
mapped to `slint::private_unstable_api::re_exports::Point` (euclid) and
is now mapped to slint::LogicalPosition (also in C++).
2023-06-21 08:17:57 +02:00
Olivier Goffart
f1bc0eb4d3 Native LineEdit: use same min size as the other styles 2023-06-21 06:37:34 +02:00
Florian Blasius
18d56800c8
Adjusted structure of material widgets. (#2941) 2023-06-20 14:54:10 +02:00
Florian Blasius
2656dfad7d
Refactor ProgressIndicator api according to api review. (#2937)
* Refactor ProgressIndicator api according to api review.

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

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

* Capping progress also for native.

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-06-20 12:27:48 +02:00
Olivier Goffart
fdec5960bd Support for @rust-attr on enums 2023-06-19 22:40:49 +02:00
Florian Blasius
7784e37928
Fluent widgets refresh (#2928) 2023-06-19 17:04:56 +02:00
Simon Hausmann
653b63a35e Port to resvg 0.34 2023-06-18 08:58:09 +02:00
Simon Hausmann
c8f1f4354b Port to resvg 0.33 2023-06-18 08:58:09 +02:00
Olivier Goffart
300cb06ac8 Make sure we don't load internal files 2023-06-16 22:03:45 +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
ogoffart
641cab0e75 Bump version number to 1.1.0 2023-06-15 16:01:28 +00:00
Olivier Goffart
033263127b
Qt Combobox: make it look proper when the style show the comobox in popup mode
As discusseed in https://github.com/slint-ui/slint/discussions/2893

Also initialize the current item the same way as fluent and material
2023-06-15 17:14:28 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Tobias Hunger
0f4ed1ee35
janitor: Fix typo and whitelist some valid words 2023-06-14 18:44:32 +02:00
Tobias Hunger
99ea465734 c++: use unsigned integers for the index in visit_dynamic_children
This is what rust does, too, and prevents errors when the indices
get big.
2023-06-14 16:24:36 +02:00
Olivier Goffart
0e31f097a4 Un-seal the WindowAdapter trait 2023-06-13 17:44:04 +02:00
Simon Hausmann
cd9994306e Create the window adapter lazily in C++ 2023-06-13 15:13:42 +02:00
Olivier Goffart
af604a29b4 Ensure there are no duplicated enum values 2023-06-12 13:02:14 +02:00
Olivier Goffart
d989aebdaa Exports of enum between files 2023-06-12 13:02:14 +02:00
Olivier Goffart
d540c63d21 LSP: support for enum in the outline and in the goto definition 2023-06-12 13:02:14 +02:00
Olivier Goffart
72de76b71a Documentation for enums 2023-06-12 13:02:14 +02:00
Olivier Goffart
18ba3c2ae2 Slint enums in Rust and C++ 2023-06-12 13:02:14 +02:00
Olivier Goffart
ac6f473a64 WIP: support for enum in slint
Parser and interpreter part
2023-06-12 13:02:14 +02:00
Simon Hausmann
e663282c65 Fix support for High-DPI with Qt
Preserve the early backend initialization of commit
f0b047057b
2023-06-10 11:41:04 +02:00
Simon Hausmann
01b00d26eb Rust: Allocate the window adapter lazily
This will be needed for embedding - to avoid creating two window
adapters - and it will be needed for the API to allow creating a
component from an existing window.
2023-06-10 11:41:04 +02:00
Tobias Hunger
ea8b5d3117
janitor: Another comment fix 2023-06-08 19:13:35 +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
cb840660aa Make the extraction of slint! macro as part of the compiler core
This includes slint-viewer, slint-interpreter (when loading path, not
string), slint-compiler.

(This would also include internal things such as
`import { Xxx } from "foo.rs"`, if we didn't check for .slint or .60
extension before)

But that doesn't include anything that's not opening the source by path
(so not the lsp which use its own representation coming from the editor,
or varius tools like the updater and fmt which also open the files
themselves)
2023-06-08 11:26:17 +02:00
Olivier Goffart
1e80f010ea
Refactoring: Move the code to locate slint! macro to i-slint-compiler 2023-06-07 17:15:34 +02:00
Olivier Goffart
12e6b34e2d Translations: support for plurals 2023-06-07 10:34:34 +02:00
Florian Blasius
3ff8d072fb
Added current-row to StandardTableView (#2831)
* Update docs/language/src/builtins/widgets.md

Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>

---------

Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
2023-06-07 07:34:29 +02:00
Florian Blasius
94a0327af6
Add primary flag toButton (#2820)
* Add default flag to button

* Code review feedback

* Update CHANGELOG.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 feedback

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-06-06 15:41:23 +02:00
Olivier Goffart
e97a2e8229 Translations: support context 2023-06-06 14:48:48 +02:00