Commit graph

7191 commits

Author SHA1 Message Date
Simon Hausmann
cfbdce735f
Add a C++ Map Model class (#1687)
* Add a C++ Map Model class

This matches the MapModel in the Rust API.
2022-09-27 16:03:56 +02:00
Simon Hausmann
388cf32770 C++ FilterModel: Fix mix of unique_ptr and shared_ptr
The inner is sorted in a shared_ptr and should be created using make_shared.
2022-09-27 14:15:38 +02:00
Simon Hausmann
56983482b9 Rename C++'s internal AbstractRepeaterView to ModelChangeListener
For consistency with the Rust model implementation.
2022-09-27 10:26:55 +02:00
Simon Hausmann
5b95466fa6
Add a C++ Filter Model class (#1685)
Add a C++ Filter Model class

This matches the FilterModel in the Rust API.
2022-09-27 10:24:47 +02:00
Simon Hausmann
edcefac4c5 Clean up properties and editor widget dependencies
* Use an alias for the signature of the property data notifier
* Replace the onQueryText interface from the editor and instead provide
  an object with the property data notifier. That way no second connection
  between editor and properties widget needs to be established,
  everything is provided in the one callback.

(This could also be simply a closure, instead of an interface implementation)
2022-09-26 17:10:18 +02:00
Simon Hausmann
a7dc0cff45
doc: don't show a preview for the generated component examples 2022-09-26 10:38:52 +02:00
Olivier Goffart
a45564bd2f Flickable: fix offset of the forwarded delayed mouse event
A recent commit introduced delayed press event, but the position of the
event was relative to the parent of the Flickable instead of relative to
the Flickable itself.

Fixes the printerdemo not expanding the element in the printer queue
2022-09-23 17:55:43 +02:00
Tobias Hunger
fbce062407
online_editor: Add properties viewer (#1677)
Add a simple widget showing the properties for the current Element.
2022-09-23 17:18:56 +02:00
Simon Hausmann
a24c33b8ea Fix Yocto cross build
After renaming the features, the if conditions need to be adjusted.
2022-09-23 14:12:21 +02:00
Simon Hausmann
dbe9f33bb4 janitor: Fix warning about unused functions/modules when compiling with Skia and D3d or Metal
When using Metal or D3D, we don't need the glcontext module.
2022-09-22 14:35:17 +02:00
Simon Hausmann
c07ae0bf12 doc: bump example MSVC version from 2019 to 2022
Since we also bumped the build tools example command line a few lines above.
2022-09-22 14:10:10 +02:00
Simon Hausmann
d3f34f3bdd janitor: Fix typo 2022-09-22 14:08:46 +02:00
Simon Hausmann
4a1e2e2eaf janitor: remove obsolete commit
Commit 743a980e21 added text selection drawing.
2022-09-22 13:14:01 +02:00
Simon Hausmann
67994071b0 doc: Mention gcc 10 in the C++ prerequisites 2022-09-22 12:58:04 +02:00
Simon Hausmann
f54cebf3d6 Don't build Skia with CMake by default
We also don't build it with Cargo by default
2022-09-22 12:56:18 +02:00
Simon Hausmann
5e4abec477 Add a backends section to the CMake docs
That's derived from the backends section of the Slint API crate (Cargo.toml)
2022-09-22 12:56:18 +02:00
Simon Hausmann
2c54628302 Minor grammar fix
Don't "do" a liasion, act as one :)
2022-09-22 12:56:18 +02:00
Simon Hausmann
2b7343c4d4 Rework the Node.js section of the build guide
- Use Node.js as the name, as that's also what's on the website
- Link to the websites of the dependencies
- Move the Node.js API prerequisites below the C++ section, in order of priority
- Create a Node.js Tests section, similar to C++, just for running the tests
- Change the remaining Node.js API build section, similar to C++, to
  explain what's needed to build it from git and how to use it.
2022-09-22 12:56:18 +02:00
Simon Hausmann
e97e12d9d9 Minor doc polish
- "can do C++20" -> "supports C++20"
2022-09-22 12:56:18 +02:00
Simon Hausmann
3c664cdd82 Various fixes to the Slint Build Guide
- In order to -> To
- Use title case for section titles
- Elaborate in the indvidual sentences about testing and building what the
  prerequisites are, what the provided command lines accomplish and where
  the output can be found.
2022-09-22 12:56:18 +02:00
Simon Hausmann
ab338cc2af Bump MSVC from 2019 to 2022
The Skia binaries on Windows are built against the 2022 runtime, so
when linking the app we also need to provide that.
2022-09-22 12:56:18 +02:00
Simon Hausmann
fd80a84590 Prospective fix for online_editor publishing
Extract the online_editor into a specific sub-directory, as the v2
docs say "All the contents are downloaded to the current working directory.".
2022-09-22 11:50:46 +02:00
Simon Hausmann
88e42416f8 Prospective fix for online_editor publishing
Commit 0767a70f9e removed the online editor from the existing multi-path
artefact. The multi-path artefact
preserved the leading paths, which is why after extraction the online editor build
could be find at tools/online_editor/dist.

After the commit, the online editor is in its own archive single-path archive, which is when GH
strips the leading path and we end up with just the contents of dist/ directory in the archive.
2022-09-22 11:11:04 +02:00
Tobias Hunger
c994502ce9 LSP: Improve data reported by queryProperties
Report more and better ranges for the expression in an property.
2022-09-22 10:51:26 +02:00
Tobias Hunger
04420b9e65 lsp: Polish the queryProperties command
Make it not error out when no element is selected.
2022-09-22 10:51:26 +02:00
Simon Hausmann
d26b7f9428 Skia: fix height of empty text lines
Apply the text style with font, etc. as default on the paragraph style, so that it applies to empty lines.

cc #1480
2022-09-22 09:56:53 +02:00
Simon Hausmann
743a980e21 Skia: add support for rendering text selections
cc #1480
2022-09-22 09:04:27 +02:00
Simon Hausmann
74d3bf07e7 Skia: Fix text cursor at end of text and in empty text inputs
At end of text, take the right edge of the glyph cluster; otherwise the left edge
of what's to the right of the cursor.

For empty text inputs, just return the height of the text to be.

cc #1480
2022-09-22 09:04:27 +02:00
Tobias Hunger
217a8469bd online_editor: Fix spurious canvas element in Preview Panel 2022-09-20 17:32:06 +02:00
Simon Hausmann
430ab57121 Clean up online editor startup sequence
Instead of a for loop that awaits ten times one second to see if the lsp
started up (within a microtask that nobody awaits for), resolve the
promise that the editor is ready precisely when we receive the message
from the lsp. In the window's onload handler we can then remove the
loader screen when the editor is ready (as connected microtask).

This means that the other widgets are attached to the DOM in the
meantime and even the preview can being doing its work. To avoid the
loader screen affecting the position of the widgets, place it in a layer
above everything else.
2022-09-20 12:54:40 +02:00
Simon Hausmann
f41e696ef6 Fix panic in GL renderer when PreviewWidget renders too early
If render() is called before the widget is attached, we end up with a
panic in the GL renderer as we cannot extract a gl context out of the
Canvas element.  The element has been created (good), but it's not
hooked into the window's body yet.

Therefore instruction Slint to only render after we've been attached.

In the future this could be generalized to also support detaching.
2022-09-20 12:54:40 +02:00
Tobias Hunger
0767a70f9e ci: Wire up cypress tests for the online_editor
Run the E2E tests in chrome and firefox on Linux
2022-09-20 12:13:40 +02:00
Tobias Hunger
7f00fbab58 online_editor: Make syntax_check work again
Turns out that was not actually doing anything locally :-/

So force the compiler to run, add some types that went missing and
disable checking of the webworkers -- there is a type conflict in there
that needs to be fixed upstream (Issue is:
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/60868).
2022-09-20 12:13:40 +02:00
Tobias Hunger
10ca4a813f online_editor: Smoke-test the online_editor 2022-09-20 12:13:40 +02:00
Simon Hausmann
4d01817c86
online editor: simplify slint wasm bindgen glue initialization (#1664)
We can store the promise that wasm bindgen generates to initialize glue
code and simply await on it as needed. Calling then() on a fullfilled
promise will just resolve to the promise result.
2022-09-20 10:13:33 +02:00
Simon Hausmann
ed993f9b2e online editor: Make render() on the preview widget always succeed
When called the first time, we would just throw an exception and never
resolve the promise.
2022-09-20 10:13:00 +02:00
Simon Hausmann
ea73253d16 Fix panic in online editor when resizing the preview widget
A resize of the HTML canvas element would trigger our own resize
handler, which tried to do a special dance to trigger a redraw.

As it turns out, this breaks with current winit as the event loop target
is gone, so calling with_window_target() panics.

See also commit 8b728df021

Instead, this patch reverts to the simpler method of calling
invoke_from_event_loop, has workarounds for how to properly wake up the
event loop and return poll. In there we can just call request_redraw()
on the winit window directly to trigger a draw.
2022-09-20 10:12:39 +02:00
Olivier Goffart
e7506e0d2a Dependency analysis: properly visit layout properties
in the funciton `visit_layout_items_dependencies` we were passing a
NamedReference for a property that could have been in the base
component type of an element, instead of in one of the element within
the current visited component. This would result in wrong computation
done later to find out the "element path" of the property.
We then need to tell the visitor that the named reference is in a sub
component. To do that, we need to visit a PropertyPath instead of just a
NamedReference

Issue 1659 was showing one of the symptoms of this, which was an assert.
But it could also result in wrong analysis (binding loop not detected
when it should or vice versa)

Fixes #1659
2022-09-19 18:38:29 +02:00
Tobias Hunger
97a8a26da6 ci: extract nodejs install into an action 2022-09-19 17:13:26 +02:00
Tobias Hunger
9356ee4316 ci: add action to install linux dependencies
... so that we do not need to spell out the same packages everywhere!
2022-09-19 17:13:26 +02:00
Tobias Hunger
f659ed17e2 online_editor: Lazily create the canvas_id 2022-09-19 14:27:14 +02:00
Tobias Hunger
1155ff0342 online_editor: Cleanups I missed from the last code review 2022-09-19 14:27:14 +02:00
Olivier Goffart
56997146f0 Prospective CI fix
We can't use the install action if we want to use the cache
2022-09-19 10:37:25 +02:00
Olivier Goffart
32d4cf3137 Prospective CI fix
a cache key is required
2022-09-18 08:08:12 +02:00
Olivier Goffart
29df9d66b1 Prospective CI fix
The mdbook build seems broken with nightly rust right now.
Maybe using the install action might help
2022-09-18 08:05:09 +02:00
Joshua Goring
bf2e6a5ef7 Fix editor integrations link 2022-09-18 07:49:12 +02:00
Tobias Hunger
f28b1374e1
Update pre-commit configuration 2022-09-17 20:56:17 +02:00
Olivier Goffart
97481d170a
Update README.md
Mention that the MCU part is ready
2022-09-17 17:32:23 +02:00
Olivier Goffart
b7a10dd317 Remove unused wee_alloc dependency
It is not even used, and has security issue.
Fixes https://github.com/slint-ui/slint/security/dependabot/2
2022-09-16 19:24:04 +02:00
Olivier Goffart
ba56f4e326 ChangeLog entry for the last two PR 2022-09-16 19:20:38 +02:00