8 Commits

Author SHA1 Message Date
Simon Brunel
2c1e631aed Include Qt classes by module and remove unnecessary comments 2020-02-11 22:25:08 +01:00
Simon Brunel
d5a82518f9 Simplify tests directory structure 2020-02-11 22:13:57 +01:00
Simon Brunel
58738a5604 Simplify license notice in source files 2020-02-06 22:33:19 +01:00
Simon Brunel
6639ea52db Migrate to CMake to build the entire project 2020-01-12 21:04:43 +01:00
Simon Brunel
815dc443b9 Add MIT license header to all source files 2019-12-20 21:42:19 +01:00
Simon Brunel
963ec621e1 Rename qPromise() helper to QtPromise::resolve()
For consistency with other helpers, deprecate `qPromise()` in favor of `QtPromise::resolve()` but also add support for calling this helper with lvalue. Add extra unit tests to make sure that rvalue is not copied.
2019-03-25 14:45:41 +01:00
Simon Brunel
1f30224578 Add support for creating promises from Qt signals (#25)
Introduce a new `QtPromise::connect()` helper that allows to create a promise resolved from a single signal and optionally, rejected by another one (from a different object or not). The promise type is determined by the type of the first signal argument (other arguments are currently ignored). A `QPromise<void>` is returned if the resolve signal doesn't provide any argument.

If the rejection is emitted before the promise is resolved, the promise will be rejected with the value of the first argument (other arguments being ignored). If the rejection signal doesn't provide any argument, the promise will be rejected with `QPromiseUndefinedException` if the signal is emitted. Additionally, the promise will be automatically rejected with `QPromiseContextException` if the source object is destroyed before the promise is resolved.
2019-03-04 14:02:32 +01:00
Simon Brunel
700098ef7b Reorganize exceptions and add unit tests 2019-03-01 17:41:32 +01:00