Commit graph

556 commits

Author SHA1 Message Date
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
Simon Hausmann
1bf05eae7c
Add support for absolute-x and absolute-y properties on any element (#2823)
Fixes #1691
2023-06-06 14:37:53 +02:00
Simon Hausmann
3961b44c3f Fix rendering of LineEdit's placeholder text
Use the same font attributes as for the inner `TextInput`.

Fixes #2829
2023-06-06 09:17:49 +02:00
Olivier Goffart
9b3ccd3dc3 Check validity of the format string at compile time 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
Olivier Goffart
a3855f1bcb WIP: add a formatting function that works in the interpreter 2023-06-05 16:34:59 +02:00
Olivier Goffart
dcd8450dfa WIP: start working on translations: @tr()
This commit just do the parsing of the @tr macro.
2023-06-05 16:34:59 +02:00
Amirhossein Akhlaghpour
3a4f3c61d5
Add @rust-attr on scturct (#2785)
Fixes: #2660
2023-06-05 16:29:55 +02:00
Olivier Goffart
7a062d23cf Fixup previous commit 2023-06-05 14:14:22 +02:00
don bright
a255aaf8d4 add list of Valid Units to the Invalid Unit error message (#2701) 2023-06-05 14:14:22 +02:00
Simon Hausmann
cad884ff1f Remove unnecessary property declaration in PopupWindow's internal type
We don't need to materialize this property because we only support
constant bindings at the moment.
2023-06-05 13:47:57 +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
Simon Hausmann
a0a5294e49 Fix init callbacks not being invoked for PopupWindow 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
Florian Blasius
0755af3b6d Change progress property of ProgressIndicator from in-out to out 2023-06-01 12:19:43 +02:00
Florian Blasius
69a0d7e219 Fix some issues with material widgets in horizontal layouts 2023-05-31 20:13:38 +02:00
Simon Hausmann
6b8214c3f9 Add support for italic and bold text in the software renderer's bitmap font path
In the screenshot tests this works by setting SLINT_DEFAULT_FONT to
pointer to a directory, instead of a file. We then load all fonts in
that directory and consider their families the default unless a family
is specified. This way for "Noto Sans" a regular as well as an italic
version is registered in fontdb and returned in the list of font
fallback ids. embed_glyphs in the compiler then embeds those variants
and we find them at run-time.
2023-05-31 18:47:39 +02:00
Simon Hausmann
3cf1b38a48 Add basic support for italic font face selection to Text and TextInput
This is implemented for FemtoVG, Skia, and Qt.
2023-05-31 18:47:39 +02:00
Florian Blasius
52c4f2add9 Fix layout for material switch 2023-05-31 16:13:40 +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
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
Tobias Hunger
1eb8d2875b
Fix warnings in cargo doc output 2023-05-30 10:08:44 +02:00
Florian Blasius
edc60c8ece Add password char to embeded_glpyhs 2023-05-30 09:03:25 +02:00
Simon Hausmann
ed287c55fe Use shared fontdb in the compiler
This eliminates the copy of the fontconfig handling code.
2023-05-23 08:26:03 +02:00
Simon Hausmann
aa005e76ec Unify fontdb versioning across all crates 2023-05-19 10:40:51 +02:00
Florian Blasius
abe558313d
material: improve groupbox visual (#2749) 2023-05-17 17:19:08 +02:00
Olivier Goffart
b847faa027 Typeloader: In case of load error, don't keep invalid files as currently loading
Because we `return None` in case of error before we remove the file from `currently_loading`
we would then await forever next time we try to load that file.

This will cause a deadlock that can be causing #2709
2023-05-15 16:10:35 +02:00
Olivier Goffart
eb88a9ac9c Adjust sizing of the AboutSlint widget 2023-05-09 12:19:18 +02:00
Olivier Goffart
6441968a43 Janitor: Remove trailing spaces in most files 2023-05-04 08:14:28 +02:00
Olivier Goffart
b098234ad4 consistent_styles test: Ignore TabWidgetImpl
We already ignore other internal stuff
2023-05-04 08:01:48 +02:00
Olivier Goffart
df2f76a65b Make the non-native TabWidget fill the parent size when not in layout
Fix #2683
2023-05-04 07:23:04 +02:00
Olivier Goffart
5c4a1746d4 LSP: fix completion of callback arguments 2023-05-03 09:09:01 +02:00
Olivier Goffart
6111b17a7c Proper error when wrong type used in an unary operation
Fixes #2669
2023-05-02 17:41:36 +02:00