Commit Graph

31 Commits

Author SHA1 Message Date
Jarek Kobus
79395e9df4 DataExchange example: Reuse TaskTreeRunner
Change-Id: I9075dca4c121f0a6041087bc8407569308135614
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-01-15 10:20:40 +00:00
Jarek Kobus
f63d31daa2 Demo example: Reuse TaskTreeRunner
Change-Id: Ia083a2317647c26886b9f483e5ae411e1e51c983
Reviewed-by: hjk <hjk@qt.io>
2024-01-15 10:17:07 +00:00
Jarek Kobus
7c3e8b420e ImageScaling example: Reuse TaskTreeRunner
Change-Id: I727a961bcfca20ebc0584b1ddeeaa412aff63335
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2024-01-15 10:16:29 +00:00
Jarek Kobus
14f6954026 TaskTree: Disconnect from task's done() signal on destruction
If a task or task's adapter sends done() signal directly
from the destructor (which isn't really desired),
ensure we disconnect from this signal beforehand,
otherwise this may start invoking normal handling of task done()
and interfere with the destruction.

Fix NetworkQuery d'tor.

Add a test for it.

Add some TODO items.

Fixes: QTCREATORBUG-30204
Change-Id: I56a34d0f00c961c15bd1bcffef45520a4be5bce0
Reviewed-by: hjk <hjk@qt.io>
2024-01-15 08:29:57 +00:00
Jarek Kobus
ae57346f30 TrafficLight: Undecorate strings in order to compile against Qt 6.2
Change-Id: Iac3a65cca5b07f405fb64fe4cefc7cdf3d509759
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-01-13 02:41:23 +00:00
Jarek Kobus
1f41e408e0 TaskTree: Simplify recipe in ImageScaling example
Change-Id: Ieda5a7b06098cc2b90c69db79b7a002345a68f44
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2024-01-11 11:51:30 +00:00
Jarek Kobus
7c0b831391 TaskTree: Implement TrafficLight example
Import from:
https://github.com/qt/qtscxml/tree/dev/examples/scxml/trafficlight-common
and implement it in terms of TaskTree.
The recipe() corresponds to trafficlight.scxml file and implements
the business logic.

Used components: TimeoutTask and BarrierTask.

Change-Id: Ifc08b947388abed8cfc85ba082aaa0b18da0a1d7
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-01-11 11:36:06 +00:00
Jarek Kobus
e8904041c2 TaskTree: Introduce Forever group
Rename Forever -> LoopForever, Repeat -> LoopRepeat.

Change-Id: Ic999c876762d2b092f23ae88ea6de341b68a1fc2
Reviewed-by: hjk <hjk@qt.io>
2024-01-11 11:34:43 +00:00
Jarek Kobus
bc2faebe02 TaskTree: Reuse Repeat element in DataExchange example
Update the location of the target url so that it points to the
TaskTree wiki image.

Task-number: QTCREATORBUG-30081
Change-Id: Ic1c715c268b9e14711bc98415e747de8b75ed2dc
Reviewed-by: hjk <hjk@qt.io>
2024-01-10 10:45:21 +00:00
Jarek Kobus
ff46a9a8ef TaskTree: Reuse Repeat element in ImageScaling example
Task-number: QTCREATORBUG-30081
Change-Id: I281b6fe45c62045686ee215a5e03a5d8917a0282
Reviewed-by: hjk <hjk@qt.io>
2024-01-10 10:42:47 +00:00
Jarek Kobus
7d3f50f784 TaskTree: Remove explicit List element
Replace it with additional GroupItem's c'tors.

This addresses the 27th point in the report below.

Task-number: QTCREATORBUG-28741
Change-Id: I7f0620993e7c9bf61868e7bc7b112eea4dae6471
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-12-22 09:32:26 +00:00
Jarek Kobus
9c5831dc80 TaskTree demo: Tweak the done result instead of nesting a Group
Tweak the return value of the TimeoutTask instead of nesting
a Group with conditional workflow policy.

Rename TaskWidget::isSuccess() into desiredResult().

Change-Id: I3d6f703427f13e8feb6d6db97c07b8b9f8b261a6
Reviewed-by: hjk <hjk@qt.io>
2023-11-20 08:27:17 +00:00
Jarek Kobus
ce80a6dad5 TaskTree: Rename TreeStorage<> -> Storage<>
This addresses the 20th point in the master task below.

Task-number: QTCREATORBUG-28741
Change-Id: I696beda87430fbe637abba8054012fb77516e220
Reviewed-by: hjk <hjk@qt.io>
2023-11-20 08:25:50 +00:00
Jarek Kobus
ced3052e7f TaskTree: Get rid of Storage subclass of GroupItem
Make the c'tor of the GroupItem taking the TreeStorageBase
public instead.

This addresses the 20th point in the master task below.

Task-number: QTCREATORBUG-28741
Change-Id: I78320ec24b4e4b915ab549135fb93b45c658b9f2
Reviewed-by: hjk <hjk@qt.io>
2023-11-20 07:47:54 +00:00
Jarek Kobus
5a2df08ae0 TaskTree: Add a new example showing input / output data exchange
This example shows how to separate the business logic of the recipe
from the GUI and how to write a reusable recipe.

It shows how to feed the recipe with the initial data and how to
retrieve the final result from the recipe using onStorageSetup()
and onStorageDone() handlers.

Change-Id: I04c0c0c9bd6cf25ac4e91317e527ad12832e9143
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-11-15 10:54:05 +00:00
Jarek Kobus
c25a7a0381 TaskTree: Address some code style issues
Amends af63dcaf96

Change-Id: I9c727751afe306be5da36e772201eff1f36ac18a
Reviewed-by: hjk <hjk@qt.io>
2023-11-08 08:30:31 +00:00
Jarek Kobus
2c0a59384c TaskTree: Rename workflow policies
Make naming consistent with recent changes.
"Done" is meant to be an event name when the task / group
finishes. "Done" may finish with "Success" or an "Error".

This addresses the 26th point in the master task below.

Task-number: QTCREATORBUG-28741
Change-Id: Icc882710dc4896626dc9332440aa13a692af54c4
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-11-07 14:09:15 +00:00
Jarek Kobus
1da7f18fb7 TaskTree: Introduce List element
The List element of GroupItem type is a helper for
constructing Group content with an initializer lists.
Since there is no easy way of mixing items and lists of items
inside the initializer list, the List element encloses
the list of children in a single GroupItem element making it
possible to mix the lists of GroupItems with individual
GroupItem elements on a single initializer list.

This addresses the 25th point in the master task below.

Task-number: QTCREATORBUG-28741
Change-Id: I5fa4b76677f5aa7dcf875b9e9a16d86a26d380a7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-11-07 14:08:36 +00:00
Jarek Kobus
af63dcaf96 TaskTree demo: Visualize Canceled state
The running task tree may cancel automatically some tasks / groups.
Visualize the canceled task / group with cyan color.
Add footer with state legend.

Task-number: QTCREATORBUG-29834
Change-Id: Ie799fa7b803ca3cc5ac21c580c2f86cd41b3242b
Reviewed-by: hjk <hjk@qt.io>
2023-11-07 14:08:28 +00:00
Jarek Kobus
37b6cb7f90 TaskTree: Get rid of onGroupError element
Make it possible to setup onGroupDone element with additional
OnDone argument.
The onGroupDone handler may accept extra DoneResult argument.
The onGroupDone handler may also tweak the success bit of a group.

All above features conform to the behavior of the task done handler.

Task-number: QTCREATORBUG-29834
Change-Id: I125bdfe155e585678fb33410632246401cbc9390
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-11-07 14:08:04 +00:00
Jarek Kobus
dda75153fe TaskTree: Introduce DoneWith enum
This makes it possible to recognize the cancel state
when the task was automatically stopped because of task's
parent group workflow policy or when the user called TaskTree::stop().

This addresses the 2nd point in the master task below.

Task-number: QTCREATORBUG-28741
Task-number: QTCREATORBUG-29834
Change-Id: I2798b9ec1d2f1d667aff51ee0271a5a15a525dc1
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-11-07 11:52:18 +00:00
Jarek Kobus
0fa16f8489 TaskTree: Use common done handler
Instead of specifying two separate done and error handlers,
specify just one that takes additional "bool success" argument.

Task-number: QTCREATORBUG-29834
Change-Id: Ie4f92236a38b03dac3dd33b2c80a317b62772a12
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-11-06 14:33:27 +00:00
Christian Kandeler
fca94a8366 qbs build: Fix manual tests
- Remove dependency on project.withAutotests by adding local
{Qt,Cpp}Application overrides that alias QtcManualTest. This way, the
respective products are a QtcManualTest when inside Qt Creator, while
also working outside the source tree.
- Rename QtcManualtest to QtcManualTest. (The reason QtcAutotest is not
camel-cased is because "autotest" is a single word.)
- Plus some minor clean-ups.

Change-Id: Idd77191f0b433d6d7443c639eebda383ab110082
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-09-20 10:22:21 +00:00
Jarek Kobus
7730a329a3 TaskTree demo: Simplify task creation
Fix workflow policy.
Fix const correctness.
Rename treeRoot into recipe.

Change-Id: Ib0457691001dbb88135027f8c7a34ba671b0b082
Reviewed-by: hjk <hjk@qt.io>
2023-09-01 07:33:44 +00:00
Jarek Kobus
541719d443 TaskTree demo: Simplify task creation
Change-Id: Ia47c6599e872a7400b521ca77b109ff369bdd836
Reviewed-by: hjk <hjk@qt.io>
2023-08-28 11:38:46 +00:00
Jarek Kobus
04b86eb3db ImageScaling: Implement the example using TaskTree
Change-Id: Iac54157955d5dffe12a7fdeed904fbcf62a2b667
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-07 09:27:40 +00:00
Jarek Kobus
d97d3f58ac TaskTree: Rename TaskItem into GroupItem
Not all classes derived from TaskItem are tasks,
but the common denominator is that all may be placed
inside a group: thus GroupItem sounds more appropriate.

Addresses the 10th point in the bugreport below.

Task-number: QTCREATORBUG-28741
Change-Id: I94d728a8e39ec732810f2e5bbe6b9a76f3bc387c
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-06-06 09:06:01 +00:00
Jarek Kobus
3f9704846b ImageScaling: Get rid of doc example markers
In order to more easily compare both implementations.

Change-Id: I4ff48cb4d4e61be4e2c8834f63091f4d825db0be
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-06 08:05:58 +00:00
Jarek Kobus
c3344c740a Tasking: Import imagescaling example
It's an initial copy of the
qtbase/examples/qtconcurrent/imagescaling.

The goal is to implement it using TaskTree and
compare both implementations.

Change-Id: I92953a70a3330ac679823060e75e5f39971ae444
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2023-06-06 08:05:39 +00:00
Jarek Kobus
9694d9c6f6 Tasking: Introduce NetworkQuery
The NetworkQuery class is prepared to work with TaskTree.
Provide the task tree adapter for the NetworkQuery class.
Register the task inside the Tasking namespace under
the NetworkQueryTask name.

This class introduces the dependency to Qt::Network,
otherwise Tasking namespace is independent on Qt::Network.
Possibly, may be added into Qt::Network lib,
as a wrapper around the QNetworkReply.

Change-Id: I29f160c0bf128c567ce20f044540b2dd6f1e17c4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-06-06 08:05:14 +00:00
Jarek Kobus
6f8e5c409f TaskTree: De-utils-ize manual test, rename it to demo
Change-Id: I80a2522f7ba12ee9b63c19d66e514d7047951733
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-06-01 10:53:35 +00:00