Commit Graph

11 Commits

Author SHA1 Message Date
Dmitriy Purgin
0c3955cca5
Implement QPromise<T>::convert<U>() (#41)
Converts the resolved value of `QPromise<T>` to the type `U`. Depending on types `T` and `U`, it performs a static cast, calls a converting constructor or tries to convert using `QVariant`.
2020-11-22 17:26:06 +01:00
Simon Brunel
7ee51de987
Fix Google Analytics plugin docs config 2020-01-24 04:58:32 +01:00
Simon Brunel
7f9013a878 Add CMake support and enhance the getting started docs
- Add a root CMakeLists.txt defining an INTERFACE target.
- Add CMake, qpm, Git and download installation instructions.
- Add CMake and qmake integration instructions.
- Remove smooth scroll when navigating the docs.
- Add links validation to `npm run docs:link`.
- Reorganize the sidebar API Reference section.
2020-01-09 20:45:04 +01:00
Simon Brunel
3c1461b8d0 Enhance the documentation and add markdown lint
- Add npm package.json to make easier maintaining dependencies.
- Make markdown files consistent using remark.
- Wrap markdown lines to 100 characters.
- Better README.md layout and visual.
- Enable VuePress landing/home page.
- Upgrade to latest VuePress version.
- Add link to the new Qt Marketplace.
2019-12-21 10:27:26 +01:00
Simon Brunel
e3f0f054af Implement QPromise<Sequence<T>>::reduce(reducer, initialValue)
Iterates over all the promise values (i.e. `Sequence<T>`) and reduces the sequence to a single value using the given `reducer` function and an optional `initialValue`. Also provide a static helper to directly reduce values (`QtPromise::reduce(values, reducer, initialValue)`).
2019-03-31 15:16:08 +02:00
Simon Brunel
cbf4cc7867 Rename qPromiseAll() helper to QtPromise::all()
For consistency with other helpers, deprecate `qPromiseAll()` in favor of `QtPromise::all()`.
2019-03-25 14:45:51 +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
9119cc72f6 Add documentation for built-in exceptions 2019-02-01 16:06:29 +01:00
Simon Brunel
16229fc2c9 Integrate DocSearch (Algolia)
https://github.com/algolia/docsearch-configs/blob/master/configs/qtpromise.json
https://community.algolia.com/docsearch/
2018-09-10 12:36:31 +02:00
Simon Brunel
eebcb4f364 Migrate documentation to VuePress
GitBook development seems a bit stuck right now so let's switch to VuePress which, IMO, is more user friendly. Update the documentation to include the version number in which features were added and use custom container to display notes and warnings.
2018-09-09 10:55:07 +02:00