Commit graph

372 commits

Author SHA1 Message Date
Simon Hausmann
254df328d0 Add support for images (resources) in models
This also allows replacing the emojis (not working due to lack of fallback) with images
2020-08-04 16:09:33 +02:00
Olivier Goffart
283387bc44 Add the self and parent implicit id 2020-08-04 15:58:40 +02:00
Simon Hausmann
ee3765e115 Print out the type we failed to convert to rust if it happens 2020-08-04 15:10:58 +02:00
Simon Hausmann
7277d15394 Provide a better error message when failing to convert a type to C++ 2020-08-04 15:04:18 +02:00
Simon Hausmann
2d255380c7 Don't crash when trying to report internal errors 2020-08-04 15:01:42 +02:00
Olivier Goffart
52cf481dc4 Fix states in repeated elements
This create reference to new property that needs to be adjusted
2020-08-04 14:02:18 +02:00
Simon Hausmann
41671e3efb Represent the window scale factor conversions in the IR
That means less code in the generators and easier to extend in the
future with more built-in functions.
2020-08-04 12:49:37 +02:00
Olivier Goffart
2b9e529af7 Fix unicode in strings in C++ 2020-08-04 11:52:47 +02:00
Simon Hausmann
4f0bf0b982 Rename dpi to (window) scale_factor 2020-08-04 09:01:30 +02:00
Olivier Goffart
d7bb993d7b Fix clang warnings 2020-08-03 18:46:11 +02:00
Olivier Goffart
da11b33e9b Version check
Compilation error when the compiler and the runtime are not on the same version
2020-08-03 18:44:36 +02:00
Olivier Goffart
b259a09338 Rename the types float32 and int32 to float and int 2020-08-03 16:15:41 +02:00
Olivier Goffart
1bfd708784 Change the field_offsets() function to a FIELD_OFFSETS associated const 2020-08-03 16:04:55 +02:00
Olivier Goffart
de188e0a54 Add the as_weak to rust generated component 2020-08-03 15:36:54 +02:00
Olivier Goffart
5f38f03a1b Test setting signal handler and a few fix to make it work
We were not parsing CodeBlock node from the signal handler correctly,
we wer eonly taking the first expression instead of the whole codeblock

In JS, emitting signal before the show() did not update the GLOBAL_CONTEXT
needed to emit signals defined in JS
2020-08-03 15:01:10 +02:00
Olivier Goffart
b8d440a6db Rust: default visibility of everything to private 2020-08-03 15:01:10 +02:00
Olivier Goffart
8aef208340 Rust: add on_* to set signal handler 2020-08-03 15:01:10 +02:00
Olivier Goffart
b2a1a72450 C++: add on_* funciton to connect to signals 2020-08-03 15:01:10 +02:00
Olivier Goffart
a4efac920a C++: make all properties and sub elements private 2020-08-03 15:01:10 +02:00
Olivier Goffart
cb67e40c32 Rename WeakPin -> PinWeak 2020-07-31 18:19:26 +02:00
Simon Hausmann
480a8470f5 Remove dead code 2020-07-30 19:51:33 +02:00
Simon Hausmann
cb7aca54d4 Implement support for nested layouts in the C++ generator 2020-07-30 19:41:38 +02:00
Simon Hausmann
884af3c88f Implement support for nested layouts in the Rust generator 2020-07-30 19:41:29 +02:00
Olivier Goffart
9760cf4969 Begin to implement a Flickable
The implementation is still very rough and will need to be improved
2020-07-30 14:36:21 +02:00
Simon Hausmann
94433b9bf1 Implement get_property_ref for Layouts in the interpreter
We can fetch the Property<> references from the custom_properties hash
by using the property name that was changed in the moving declarations
pass.
2020-07-30 10:24:03 +02:00
Simon Hausmann
e0c9f9a71d Parse nested grid layouts
They don't work at run-time yet though.
2020-07-30 10:22:29 +02:00
Simon Hausmann
e881d89bf9 Get rid of visible x/y properties in GridLayout
It doesn't really make sense to have them in the API, the grid layout is
supposed to "own" the surrounding space. That can be an element and then
it should be a (0, 0) and distribute the element's width/height, or in
the future it can be a cell of a grid layout. Then there's an (x/y), but
that's implicit / hidden.
2020-07-29 18:52:22 +02:00
Simon Hausmann
4fccbba29d Prepare for "virtualizing" the grid layout's width/height
Instead of storing the "within" element that we unconditionally take the
"width" and "height" properties from, let's pass through a property
reference expression to the width/height to use. For now that's still
the layout parent's width/height, but with this it can be replaced in
the future to refer to a "virtual" property that belongs to parent cell.
2020-07-29 18:52:22 +02:00
Simon Hausmann
8f8971f321 Move the grid and path layout extraction code into separate helper function
That'll make it easier to call them for nested layouts.
2020-07-29 18:52:22 +02:00
Simon Hausmann
30acb11362 Fix handling of properties of nested optimized layout elements
We need to traverse also into the expressions of nested layouts to ensure
any references inside are updated as the
"virtual" properties are moved.
2020-07-29 18:52:22 +02:00
Simon Hausmann
00271a3746 Extend the layout data structure in the compiler to allow nesting 2020-07-29 18:52:22 +02:00
Simon Hausmann
f853843bc4 Store layouts in a common enum and vector
That'll make it easier later to allow for nesting them.
2020-07-29 18:52:02 +02:00
Olivier Goffart
edd9575b53 Add easing curve in the C++ backend 2020-07-29 15:29:55 +02:00
Olivier Goffart
46a011683f Implement easing curve in the runtime 2020-07-29 15:20:28 +02:00
Olivier Goffart
feec73674f Start implementing easing curve 2020-07-29 15:19:41 +02:00
Olivier Goffart
733f44f50b Error when using a layout property outside of a layout 2020-07-28 18:24:36 +02:00
Olivier Goffart
5b2add75e4 Parse the row/col/rowspan/colspan in a layout 2020-07-28 18:04:16 +02:00
Olivier Goffart
f02512f467 Allow to get the span of a binding 2020-07-28 18:02:23 +02:00
Olivier Goffart
b57f3775c9 Refactor GridLayout 2020-07-28 10:31:05 +02:00
Simon Hausmann
09cae799d3 Fix return type of compile_syntax_node
All call sites are only interested in the root component, so might
as well return that.
2020-07-28 09:21:32 +02:00
Olivier Goffart
def42ba3df Add reserved properties that every item has
These properties are materialized if used
2020-07-27 12:18:55 +02:00
Simon Hausmann
7aa7bd8492 Add support for exporting imports
This will allow us to break up the styles, so that one can have for example

    button.60
    checkbox.60

and finally widgets.60:

    import { Button } from "button.60";
    import { CheckBox } from "checkbox.60";
    export { Button, CheckBox };

and then the users have to only import "widgets.60";
2020-07-24 18:33:01 +02:00
Olivier Goffart
d77d7cddc3 The viewer can use the Qt style with --style qt 2020-07-24 18:06:55 +02:00
Simon Hausmann
88fb491837 Add support for mapping elements to different native classes
The Rectangle element has properties for a border outline. If those are
used, then the generated code should use BorderRectangle. But if they are
not used, then we can fall back to just generating a Rectangle.
2020-07-24 17:48:19 +02:00
Simon Hausmann
6c27451761 Begin separating builtin elements from the underlying types
This uses a NativeClass type in the registry to represent the underlying
Rust/C++ types.
2020-07-24 16:11:46 +02:00
Olivier Goffart
f87a3e2c13 Assignment operator 2020-07-24 11:43:23 +02:00
Olivier Goffart
6f30c21a98 Fix panic when connecting a non existing signal 2020-07-24 11:33:00 +02:00
Olivier Goffart
232848de9e Make sure that there is only one error reported when assigning to invalid
This also start parsing assignment ('=') as a self assignement
but the code generation is not yet implmented
2020-07-24 11:33:00 +02:00
Simon Hausmann
9938197b58 Split Rectangle again
Into the previous Rectangle and BorderRectangle that allows (rounded) borders through a stroke in addition to the fill.

Next step is to make the compiler make the choice automatically depending
on the properties used.
2020-07-24 10:15:12 +02:00
Simon Hausmann
dd9bd2cf72 Add a rounded border to the button
There's still an open question about how to avoid the border properties
for all rectangles but allocate them only for those who have a border.
Regardless, this border illustrates the issue with the lack of text sizing.
2020-07-24 09:21:30 +02:00