Commit graph

5155 commits

Author SHA1 Message Date
Tobias Hunger
b5e0d919f1 Janitor: Fix clippy::single_match 2021-07-30 09:27:48 +02:00
Tobias Hunger
539e155061 Janitor: Fix clippy::for_kv_map 2021-07-30 09:27:48 +02:00
Simon Hausmann
b3529d1b75 Rust: Speed up compilation times of generated code
The binding setup functions (set_binding, set_animated_binding, etc.)
are taking the binding basically as an `impl Fn() -> T`, which means
each call site creates a new copy. The bodies of these can be quite big.
Since most of our uses follow the pattern of just capturing the
samereduce the number of copies needed parameter, we can reduce the
number of copies needed by providing wrappers.

With rustc 1.54.0 on my mbp and debug, the build time of

    touch ../ui/printerdemo.60
    cargo rustc

goes from 1m:15s down to 42s, and total llvm lines goes from
2079842 down to 1134237.
2021-07-30 09:22:20 +02:00
Simon Hausmann
3f716ae558 Reduce clippy warnings in generated code even more
... by ignoring all style and complexity related lints, since humans don't typically consume the generated code.

Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-07-30 09:20:01 +02:00
Simon Hausmann
3aa0b7bb8d clippy: ignore warning about ref-deref for field-offset access
As per commit f7248a4863 this *is* a necessary thing for us to do.
2021-07-30 09:20:01 +02:00
Simon Hausmann
a2e800abac clippy: ignore single binding in match warning in generated visit_dynamic
This is a harmless warning affecting only readability, so apply it
to the whole module.
2021-07-30 09:20:01 +02:00
Simon Hausmann
11bc09f153 clippy: don't covert self_rc into... the same type in the new() function of generated code 2021-07-30 09:20:01 +02:00
Olivier Goffart
f38ce3c090 Fix the tests 2021-07-29 18:25:23 +02:00
Olivier Goffart
188806ef89 An empty sixtyfps! macro should compile 2021-07-29 17:50:57 +02:00
Olivier Goffart
6a32a8b37a Don't error on empty documents 2021-07-29 17:40:20 +02:00
Olivier Goffart
b0b3912c27 Add support for the visible property 2021-07-29 15:02:25 +02:00
Olivier Goffart
bd52f4d444 Allow the clip property to be a dynamic property 2021-07-29 15:02:25 +02:00
Olivier Goffart
09c36ae965 Test for commit e0fad7fbdf 2021-07-29 13:25:47 +02:00
Benoit Canet
f1f9ff63cf importer: Fix build compilation errors.
A crate that disapeared was probably providing the
used trait.

Switch the transparency comparison code to use:
https://docs.rs/float-cmp/0.9.0/float_cmp/.

Given I a not a graphic programmer the patch uses
value that seems meaningfull according to the doc
of the float_cmp crate.

Excerpt from the documentation:

"""For most cases, I recommend you use a smallish
integer for the ulps parameter (1 to 5 or so),
and a similar small multiple of the floating point’s
EPSILON constant (1.0 to 5.0 or so), but there are
plenty of cases where this is insufficient."""

Signed-off-by: Benoît Canet <benoit@nodalink.com>
2021-07-29 08:08:09 +02:00
Benoit Canet
b45aa8dcf6 importer: Remove spurious semicolumns.
These extras semicolumns were triggering
compiler warnings; get rid of them.

Signed-off-by: Benoît Canet <benoit@nodalink.com>
2021-07-29 08:08:09 +02:00
Simon Hausmann
2b5badcae2 Fix cargo fmt 2021-07-28 17:08:27 +02:00
Simon Hausmann
fd26dd4944 Fix expected error messages
Amends a3652e6823
2021-07-28 17:08:27 +02:00
Simon Hausmann
be05b54fa1 Tweak error message for conditionals/for in grid
Will adapt the tests in the next commit

Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-07-28 17:08:27 +02:00
Simon Hausmann
e8727e98c5 Produce an error message when using if or for in grid layouts
An early error is better than a build error at compile time of generated code.
2021-07-28 17:08:27 +02:00
Olivier Goffart
c11d880424 Rerun the build scripts that compile .60 if the default style might have changed 2021-07-28 16:57:09 +02:00
Olivier Goffart
43e07320a5 Fix comments and naming found in review in #355 2021-07-28 16:57:09 +02:00
Olivier Goffart
7821926002 Rust: defaults to the native style when Qt is available
This requires some gymnastics to get right as the information
need to be passed to the compiler despite having no direct dependency
between the compiler and the runtime or backends.
So use a file in the build directory to tell the default style

cc: #83
2021-07-28 16:57:09 +02:00
Simon Hausmann
3d1c71b762 Fix formatting (cargo fmt)
Amends f75745ea30
2021-07-27 19:37:06 +02:00
Simon Hausmann
aacb47dfaf qt native button: Apply suggestions from code review
Add the icon type explicitly to make it easier to do "eye" based type matching with the cpp! macro.

Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-07-27 19:37:06 +02:00
Simon Hausmann
14c6819791 Add support for icons in the Button widget
The icon in the gallery example was generated via https://emoji.aranja.com
2021-07-27 19:37:06 +02:00
Olivier Goffart
e0fad7fbdf Proper .60 compilation error when changing a property linked with a two way binding in a state
Instead of generating wrong code or panic
2021-07-27 10:18:24 +02:00
Olivier Goffart
f544e67fa1 Fix panic or invalid code caused by invalid expression in the tree
When there is an animaiton but no expression, the binding is
left with an invalid expression.
State was keeping that invalid expression as part of sub expression
this is a regression since commit ba32777cab
2021-07-27 09:10:33 +02:00
Olivier Goffart
9ffcd34d1b Test for angle in the C++ interpreter API 2021-07-26 17:36:02 +02:00
Olivier Goffart
be37a9f69a Allow angle and duration in the public API snce we document it 2021-07-26 17:36:02 +02:00
Olivier Goffart
7f611d21e3 Fix Angles conversion 2021-07-26 17:36:02 +02:00
Olivier Goffart
fae6e0b52d Document that angles are represented in degrees at run-time 2021-07-26 17:36:02 +02:00
Simon Hausmann
dbdd8d8cb3 cspell: silence in fonts.rs 2021-07-26 14:37:40 +02:00
Simon Hausmann
40e7d45e2d Tweak manual font fallbacks on Linux
Add the noto color emoji font that's default on Ubuntu at least

(until we can use fontconfig proper)
2021-07-26 14:37:24 +02:00
Olivier Goffart
07bf0974d7 C++: Expose conversion betwen Value and Image
Closes #350
2021-07-26 14:12:32 +02:00
Olivier Goffart
74bc9521b9 Fix the scope while resolving a model expression
The `self` was always referring to the `root` instead of the enclosing
element.
2021-07-26 11:08:46 +02:00
Tobias Hunger
d34fd5add2 Fix float comparison in qt_window.rs
Amends 02bdcbf6ff
2021-07-24 22:53:52 +02:00
Olivier Goffart
ac751c1052 Re-arrenge a match
looks prettier this way
2021-07-23 17:11:54 +02:00
Olivier Goffart
ae210e79ec Properly handle self assignment on non-float types 2021-07-23 16:33:50 +02:00
Olivier Goffart
807377ed40 fix warnings 2021-07-23 15:40:11 +02:00
Olivier Goffart
01f11695a7 Properly merge the animation when inlining and removing aliases
Fix #193
Fix #345
2021-07-23 15:25:53 +02:00
Olivier Goffart
ba32777cab Refactoring: move the animation in the PropertyBinding struct
Since they always belong together.

This will help for issue #193
2021-07-23 15:25:53 +02:00
Simon Hausmann
530d47ff1a printer demo: minor tweak
Like with regular check boxes, allow clicking on the text to also toggle
2021-07-23 14:33:13 +02:00
Simon Hausmann
235ce85edd Fix warning about unused import
Accidentally missed in #347, amends 742c1eddfd
2021-07-23 13:57:55 +02:00
Simon Hausmann
e4dcb2757b cspell drive-by: ignore the codemap crate and its subspan function 2021-07-23 13:56:28 +02:00
Simon Hausmann
742c1eddfd Fix alpha detection condition in the color presentation request
It needs to be not 1

Co-authored-by: Olivier Goffart <olivier@woboq.com>
2021-07-23 13:48:52 +02:00
Tobias Hunger
2cdc5848a2 Janitor: Replace float comparison dance with approx_eq from euclid
Sixtyfps uses euclid already, so let's use euclid for float comparisons
as well.

I changed the code to decide whether a number is a positive integer to
make do without a comparison along the way.
2021-07-23 13:48:52 +02:00
Tobias Hunger
27b42687fa Janitor: Fix clippy::redundant_closure 2021-07-23 13:48:52 +02:00
Tobias Hunger
9539a53480 Janitor: Fix clippy::redundant_clone 2021-07-23 13:48:52 +02:00
Tobias Hunger
1c21ba89ee Janitor: Fix clippy::if_let_some_result 2021-07-23 13:48:52 +02:00
Tobias Hunger
97be634b9b Janitor: Fix clippy::match_like_matches_macro 2021-07-23 13:48:52 +02:00