forked from qt-creator/qt-creator
Short live Tasking in Solutions! Add src/libs/solutions/README.md with the motivation and hints. Move TaskTree and Barrier from Utils into Tasking object lib, the first solution in Solutions project. Tasking: Some more work is still required for adapting auto and manual tests. Currently they use Async task, which stayed in Utils. For Qt purposed we most probably need to have a clone of Async task inside the Tasking namespace that is more Qt-like (no Utils::FutureSynchronizer, no priority field, global QThreadPool instead of a custom one for Creator). Change-Id: I5d10a2d68170ffa467d8c299be5995b9aa4f8f77 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
88 lines
1.7 KiB
C++
88 lines
1.7 KiB
C++
// Copyright (C) 2022 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
#include <solutions/tasking/tasktree.h>
|
|
|
|
#include <utils/layoutbuilder.h>
|
|
|
|
#include <QWidget>
|
|
|
|
class StateIndicator;
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
class QCheckBox;
|
|
class QComboBox;
|
|
class QLabel;
|
|
class QSpinBox;
|
|
QT_END_NAMESPACE
|
|
|
|
enum class State {
|
|
Initial,
|
|
Running,
|
|
Done,
|
|
Error
|
|
};
|
|
|
|
enum class ExecuteMode {
|
|
Sequential, // default
|
|
Parallel
|
|
};
|
|
|
|
class StateWidget : public QWidget
|
|
{
|
|
public:
|
|
StateWidget();
|
|
|
|
void setState(State state);
|
|
|
|
protected:
|
|
StateIndicator *m_stateIndicator = nullptr;
|
|
};
|
|
|
|
class TaskWidget : public StateWidget
|
|
{
|
|
public:
|
|
TaskWidget();
|
|
|
|
void setBusyTime(int seconds);
|
|
int busyTime() const;
|
|
void setSuccess(bool success);
|
|
bool isSuccess() const;
|
|
|
|
private:
|
|
QLabel *m_infoLabel = nullptr;
|
|
QSpinBox *m_spinBox = nullptr;
|
|
QCheckBox *m_checkBox = nullptr;
|
|
};
|
|
|
|
class GroupWidget : public StateWidget
|
|
{
|
|
public:
|
|
GroupWidget();
|
|
|
|
void setExecuteMode(ExecuteMode mode);
|
|
Tasking::ParallelLimit executeMode() const;
|
|
|
|
void setWorkflowPolicy(Tasking::WorkflowPolicy policy);
|
|
Tasking::WorkflowPolicy workflowPolicy() const;
|
|
|
|
private:
|
|
void updateExecuteMode();
|
|
void updateWorkflowPolicy();
|
|
|
|
QComboBox *m_executeCombo = nullptr;
|
|
QComboBox *m_workflowCombo = nullptr;
|
|
|
|
ExecuteMode m_executeMode = ExecuteMode::Sequential;
|
|
Tasking::WorkflowPolicy m_workflowPolicy = Tasking::WorkflowPolicy::StopOnError;
|
|
};
|
|
|
|
class TaskGroup
|
|
{
|
|
public:
|
|
QWidget *group;
|
|
Layouting::Column items;
|
|
};
|
|
|
|
void createItem(Layouting::LayoutItem *item, const TaskGroup &taskGroup);
|