2022-11-11 10:11:22 +01:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2022-11-11 10:11:22 +01:00
|
|
|
|
|
|
|
|
#include <utils/layoutbuilder.h>
|
|
|
|
|
#include <utils/tasktree.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
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-06 16:07:16 +01:00
|
|
|
enum class ExecuteMode {
|
|
|
|
|
Sequential, // default
|
|
|
|
|
Parallel
|
|
|
|
|
};
|
|
|
|
|
|
2022-11-11 10:11:22 +01:00
|
|
|
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();
|
|
|
|
|
|
2023-01-06 16:07:16 +01:00
|
|
|
void setExecuteMode(ExecuteMode mode);
|
|
|
|
|
Utils::Tasking::ParallelLimit executeMode() const;
|
2022-11-11 10:11:22 +01:00
|
|
|
|
|
|
|
|
void setWorkflowPolicy(Utils::Tasking::WorkflowPolicy policy);
|
|
|
|
|
Utils::Tasking::WorkflowPolicy workflowPolicy() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void updateExecuteMode();
|
|
|
|
|
void updateWorkflowPolicy();
|
|
|
|
|
|
|
|
|
|
QComboBox *m_executeCombo = nullptr;
|
|
|
|
|
QComboBox *m_workflowCombo = nullptr;
|
|
|
|
|
|
2023-01-06 16:07:16 +01:00
|
|
|
ExecuteMode m_executeMode = ExecuteMode::Sequential;
|
2022-11-11 10:11:22 +01:00
|
|
|
Utils::Tasking::WorkflowPolicy m_workflowPolicy = Utils::Tasking::WorkflowPolicy::StopOnError;
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-24 16:40:01 +02:00
|
|
|
class TaskGroup
|
2022-11-11 10:11:22 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2023-04-24 16:40:01 +02:00
|
|
|
QWidget *group;
|
2023-04-25 10:15:07 +02:00
|
|
|
Layouting::Column items;
|
2022-11-11 10:11:22 +01:00
|
|
|
};
|
2023-04-24 16:40:01 +02:00
|
|
|
|
2023-04-27 08:24:43 +02:00
|
|
|
void createItem(Layouting::LayoutItem *item, const TaskGroup &taskGroup);
|