Commit graph

651 commits

Author SHA1 Message Date
Simon Hausmann
2da84fee46 Add a boilerplate TextInput item 2020-09-18 16:34:24 +02:00
Olivier Goffart
bfe2bf2478 Ability to read properties of a struct 2020-09-17 13:53:00 +02:00
Olivier Goffart
8134fe5088 Support for named type as property 2020-09-17 13:14:01 +02:00
Olivier Goffart
d4e1bfe360 Fix using local exported components
Components need to be processed in source order.
Not exported last as it was before.
2020-09-17 09:09:38 +02:00
Olivier Goffart
913d680333 Recactor rust Model after first round of API review
- Remove EmptyModel and use an Option
 - Make ModelRc a type alias
 - Rename ArrayModel into VecModel
2020-09-16 14:25:57 +02:00
Simon Hausmann
ad77896312 Change the way Text's default color is implemented
Instead of via an item constructor, implement support for default
bindings in the compiler.
2020-09-16 13:41:18 +02:00
Olivier Goffart
04e2910344 Test appending data in a model and modifying it 2020-09-16 10:41:18 +02:00
Simon Hausmann
625cb6c6b8 Add a constructor to Text and let the color default to black
We really shouldn't require specifying a color for every Text {} element just in order
to see *some* text.

For Rectangle OTOH transparent is a good default (and thus for Color), hence
this change just to Text.

Right now the constructor bit is also a bit repetitive, this could
perhaps be folded into BuiltinItem to generate the ffi, default impl and
forward to an init function if it exists.
2020-09-16 08:20:13 +02:00
Simon Hausmann
79ba5d9de8 Provide a window reference in various ItemVTable functions
Access to the window, in particular the scale factor, will be needed in a few places.
2020-09-15 15:55:47 +02:00
Olivier Goffart
4da5f5eee6 C++: Make a model based on a SharedArray like in C++
And make the SharedArray editable
2020-09-15 15:01:33 +02:00
Olivier Goffart
2275cd638a C++ Test: make sure to re-run cbindgen in case of changes
Also add -g to ease debugging
2020-09-15 12:18:36 +02:00
Olivier Goffart
4a0a65f113 C++ model that can be changed 2020-09-15 12:18:36 +02:00
Olivier Goffart
f69d88cddd Change all the C++ tests to the new assert macro
```
sed -i "s/assert(\(.*\) == \(.*\));/assert_eq(\1, \2);/" tests/cases/*
```

(But reverting th changes in color.60 because color can't be printed)
2020-09-15 10:28:49 +02:00
Olivier Goffart
b41e80b7db C++ Tests add an assert_eq macro
More consistency with rusts tests
2020-09-15 10:19:22 +02:00
Olivier Goffart
932d0f23a0 Test changing the model from rust code 2020-09-15 09:36:45 +02:00
Olivier Goffart
05f8f6ba92 Add small testcase for the debug function 2020-09-15 09:13:21 +02:00
Olivier Goffart
4de2e57175 Use a Model trait in the rust backend 2020-09-14 14:02:34 +02:00
Simon Hausmann
26ae1bfdb2 Add From<String> and Into<String> for SharedString 2020-09-14 08:49:41 +02:00
Olivier Goffart
42aa91e3eb Support for signal with arguments in the interpreter 2020-09-09 11:27:58 +02:00
Olivier Goffart
2ffef9b31a Signal handler with arguments works in C++ 2020-09-09 11:27:58 +02:00
Olivier Goffart
5df2c157fc Rust signal with arguments are working 2020-09-09 11:27:58 +02:00
Olivier Goffart
6065127581 Some progress towards signal with arguments
Generated code compile, but i haven't tested if it works yet
2020-09-08 17:41:20 +02:00
Olivier Goffart
a192ffe283 Make the C++ Signal class templated on the arguments 2020-09-08 13:11:32 +02:00
Olivier Goffart
16f5cf42e3 Actually compute the layout of elements within a for loop 2020-09-07 14:04:14 +02:00
Olivier Goffart
d924ec6bd9 Fix a bug when using layout within a for loop 2020-09-07 14:03:46 +02:00
Olivier Goffart
67764f8250 Fix the build of the C++ testcases 2020-09-06 14:50:56 +02:00
Olivier Goffart
c80975c85c Use C++17 in the msvc tests 2020-09-06 00:07:53 +02:00
Olivier Goffart
5759e912d0 On windows, we must close the file otherwise the compiler won't be able to open it 2020-09-05 23:47:08 +02:00
Olivier Goffart
82bfcc388a Add some debug to find out why the test is failling to compile 2020-09-05 23:12:08 +02:00
Olivier Goffart
9c32de9fac Attempt to pass the right options to MSVC 2020-09-05 22:40:40 +02:00
Olivier Goffart
103e5659e4 More escaping for slashes in path 2020-09-05 19:56:56 +02:00
Olivier Goffart
4845920dea On windows, the files are checked in with \r\n, and the test must accept that 2020-09-05 19:27:35 +02:00
Olivier Goffart
8465773b9b More fix for windows, make sure that slashes are escaped in the sixtyfps macro 2020-09-05 18:34:04 +02:00
Olivier Goffart
3c46df46d9 Attempt to fix window build by properly escaping backslashes 2020-09-05 17:42:12 +02:00
Olivier Goffart
4f5e8c7aff Do not print the warnings from tests.
Warning as expected as even code with warning need to be tested.
If anything, we could ensure that warning were indeed expected
by testing against a `^warning` comment
2020-09-05 17:29:00 +02:00
Simon Hausmann
2a9c962b8d Exclude exposure of easing and duration typed properties
We decided that their type mapping is not ready for public API yet. For
example for duration we'd like to replace the opaque i64 with another
opaque type that however has convenient conversions to
std::time::Duration or std::chrono::milliseconds. We can't use either
directly because we need ffi compatibility, in order to create an
instance in C++ and pass it to the Rust run-time.

So this hides such properties and instead produces a warning.
2020-09-04 21:25:11 +02:00
Simon Hausmann
ff9c118e07 Propagate warnings to the end of the compilation step and print them 2020-09-04 20:34:20 +02:00
Olivier Goffart
f5032ab0f8 Allow array as property
Also fix the lookup rules for the model property in a repeated element
2020-09-03 18:05:20 +02:00
Simon Hausmann
628426aded Rename cpp.rs to cppdriver.rs
This makes completion better :-)
2020-09-03 12:58:52 +02:00
Olivier Goffart
bb11f83131 Fix license headers 2020-09-03 09:38:12 +02:00
Olivier Goffart
b2b5645195 Allow property of type object, and conversion between objects 2020-09-03 08:39:23 +02:00
Olivier Goffart
1cf6d81169 Impletment GroupBox with the Qt style 2020-09-02 17:05:28 +02:00
Olivier Goffart
59dbb610be Materialize fake properties such as layout width/height 2020-09-01 18:49:49 +02:00
Olivier Goffart
2144975dad Fix setting row in GridLayout with the row property 2020-09-01 14:27:00 +02:00
Olivier Goffart
a36cb2d9b4 Layout: add a padding shorthand property
Also fix a bug in the C++ code generator where two layout have padding
in the same component
2020-09-01 13:29:13 +02:00
Olivier Goffart
2ef7cd6d96 Fix interpreter test 2020-09-01 12:47:40 +02:00
Olivier Goffart
9782d85fdb Native style works with C++ 2020-09-01 12:25:11 +02:00
Olivier Goffart
60201b9c7b Update dependencies 2020-08-31 17:38:22 +02:00
Olivier Goffart
6d41b1981d Move the Qt style to a new backend: the Qt backend
Currently the Qt backend still redirect everything to the GL backend,
but the goal is to use QPainter and QWindow

This also adds a "default" backend, whose goal is to select the proper
backend at compile time
2020-08-31 17:26:04 +02:00
Simon Hausmann
5dbd0b213c Add support for grid layout padding 2020-08-28 15:06:14 +02:00