Commit graph

46 commits

Author SHA1 Message Date
Olivier Goffart
2e09a58fd7 Use the qttypes crate 2021-04-20 12:41:44 +02:00
Simon Hausmann
a792b52515 Load custom fonts from disk only once with Qt
Amends commit 4cf3fa5179
2021-04-13 10:53:21 +02:00
Simon Hausmann
1e4921de13 Fix LSP server staying alive when closing preview window
* Provide an internal behavior parameter to run_event_loop() that we can use
from the preview to not quit when the last window was closed.
* Fix Drop for the winit event loop GraphicsWindow to drop the backend window correctly
  when unmapping, not when the graphics window dies. Otherwise QuitOnLastWindowClosed doesn't work.
2021-04-06 12:11:55 +02:00
Olivier Goffart
d76ee8371f Fix warning when Qt is not built 2021-04-03 10:23:41 +02:00
Olivier Goffart
309a9274e1 LSP: preview window
Currently not yet live preview from the open document content, but that should totaly be doable
2021-04-03 10:00:12 +02:00
Olivier Goffart
c3046f5a55 Add a way to send an event to the GUI thread from any thread
The idea is that the callback is meant to be run in the gui thread

(untested)
2021-04-03 10:00:12 +02:00
Simon Hausmann
4cbcf2611f Fix recurring C++ timers
* sixtyfps_timer_start needs to *take* the timer id out of the Rust
  timer to avoid that the subsequent drop stops the timer again
* For the Qt event loop, call `timer_event()` once before entering
  QCoreApplication::exec(), to schedule any timers that were started
  beforehand.
* Added a way to quit the event loop gently, in order to use that
  from the C++ unit test.
2021-03-25 20:07:12 +01:00
Simon Hausmann
e63baa5766 Re-organize Window and PlatformWindow construction and referencing
Initialize the self_weak in the PlatformWindow impl using the
Rc::new_cyclic pattern with a construction parameter.
2021-03-25 09:43:59 +01:00
Olivier Goffart
1dba04721a Add a qt_viewer example that uses QWidget 2021-03-23 17:13:41 +01:00
Olivier Goffart
35cce45cbc Add a fii feature so that we don't compile in the ffi code if not required 2021-03-16 18:09:57 +01:00
Simon Hausmann
f087cc18bc Remove extern "C" functions from wasm module
We don't need these functions and their export. They account for ~20kb in
the optimized .wasm - plus JS glue code.
2021-02-26 17:04:49 +01:00
Simon Hausmann
d5d537b1ce Remove redundant to_string() call 2021-02-17 15:28:58 +01:00
Simon Hausmann
3ba92bdc6d Add API to the wasm interpreter to download and register fonts 2021-02-17 15:21:30 +01:00
Simon Hausmann
445ddd58d5 API cleanup
Remove the `application` infix from `register_application_font`, to
reduce the changes that it might be interpreted to be a function that
also changes the default font in all text elements.
2021-02-17 14:37:31 +01:00
Simon Hausmann
f7ab4625e4 Prospective build fix
Use the same to_string_lossy() code path on all platforms
2021-02-17 14:32:02 +01:00
Simon Hausmann
45fe6c3e8d Add the ability to load application fonts by path
The viewer command line tool also gains the ability to specify them via `--app-font=/path/to/font.ttf` , which can be specified multiple times.
2021-02-17 14:16:52 +01:00
Olivier Goffart
9eac131ae5 Add the logo in the docs 2021-02-12 08:24:42 +01:00
Olivier Goffart
86d40ad5e0 Some warning fix in the CI
- re-enable Qt for the C++ part now that the download server is back up
 - Use the proper way to set env variable on Windows
 - Silent deprecated warning for alloc::LayoutError
 - Silent warning in qt/lib.rs when Qt is not there
 - remove LD_LIBRARY_PATH workaround as the install-qt-action is fixed
2021-01-22 17:58:53 +01:00
Olivier Goffart
9eedb730d2 Fix build when Qt is not available 2021-01-22 17:11:21 +01:00
Simon Hausmann
9e0927f324 Move the clipboard access from corelib to the backend
This way the backend doesn't need to depend on copypasta.
2021-01-22 15:25:06 +01:00
Simon Hausmann
5f265ffc09 Split up ComponentWindow::run() into show(), hide() and sixtyfps::run_event_loop()
This allows creating multiple windows for example, and it will allow for
showing windows in those tests that require a mapped window.

As a bonus, the run() function on generated components is not consuming
anymore.
2021-01-19 09:50:22 +01:00
Olivier Goffart
d65a655333 Fix Wasm build error and warnings 2021-01-15 15:23:17 +01:00
Olivier Goffart
f1ce103c7b WIP: start splitting Window and PLatformWindow 2021-01-15 15:02:55 +01:00
Olivier Goffart
547b2a7f6e Introduce Backend trait
Such that the font are properly registered when the GL backend is chosen at runtime
2021-01-15 12:20:32 +01:00
Olivier Goffart
a069ceae7f Fix warning with wasm 2021-01-14 08:53:14 +01:00
Olivier Goffart
62150cba1a Basic text input 2021-01-14 08:53:13 +01:00
Olivier Goffart
0b20d13401 Qt backend: Implement register_application_font_from_memory 2021-01-14 08:53:13 +01:00
Olivier Goffart
46dbb1ee9e By default, enable the GL backend also on desktop
So it can be chosen with an env variable or if Qt is not available
2021-01-14 08:53:13 +01:00
Olivier Goffart
49c9881d10 fix compile 2021-01-14 08:53:13 +01:00
Olivier Goffart
531ff42973 WIP: Qt backend using Qt 2021-01-14 08:53:13 +01:00
Olivier Goffart
8a95b806c7 Strawman implementation of a combo box 2020-11-03 17:55:49 +01:00
Olivier Goffart
a82c23fc41 Add ability for the native style to export native Globals 2020-11-02 16:13:04 +01:00
Olivier Goffart
e4e601de83 Draw the frame properly around the native scrollview 2020-10-16 10:45:17 +02:00
Olivier Goffart
d57ad389e0 Default to the native style in the viewer if it is available 2020-10-14 14:51:47 +02:00
Olivier Goffart
3bdd71b36f Start working on the Native ListView
Currently only the interpret part
2020-10-08 15:51:33 +02:00
Olivier Goffart
6662e1ff00 Proper Scrollbar on the native style 2020-09-28 18:13:13 +02:00
Olivier Goffart
6dd0d178a0 Rename ScrollArea to ScrollView 2020-09-28 10:52:29 +02:00
Olivier Goffart
315fd7a881 Start doing a ScrollArea element
Unfortunately something is wrong with the Qt style, it looks like the Qt style
does not respect the rect given for the sub components

Also Input is not handled yet.
2020-09-22 20:05:41 +02:00
Simon Hausmann
93a08c5207 Add a LineEdit widget to the ugly and native style 2020-09-18 18:54:37 +02:00
Simon Hausmann
02d18b09cf Fix warning about x not needing to be mutable 2020-09-15 11:21:01 +02:00
Olivier Goffart
1cf6d81169 Impletment GroupBox with the Qt style 2020-09-02 17:05:28 +02:00
Olivier Goffart
9782d85fdb Native style works with C++ 2020-09-01 12:25:11 +02:00
Olivier Goffart
f1ad78bc25 Qt style support for the rust backend
Need to set the SIXTYFPS_STYLE=native env variable while compiling
2020-09-01 12:25:11 +02:00
Olivier Goffart
9d5f27db0b Rename QtStyle to Native 2020-09-01 12:25:11 +02:00
Olivier Goffart
b27f64756e In the Qt backend, having Qt is the default and not having it is the exception
Simplify the config
2020-09-01 09:58:25 +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