forked from qt-creator/qt-creator
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>
83 lines
1.6 KiB
C++
83 lines
1.6 KiB
C++
// Copyright (C) 2023 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#ifndef TASKWIDGET_H
|
|
#define TASKWIDGET_H
|
|
|
|
#include <tasking/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, // TODO: Rename to Success
|
|
Error,
|
|
// TODO: Add Canceled state
|
|
};
|
|
|
|
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::GroupItem executeMode() const;
|
|
|
|
void setWorkflowPolicy(Tasking::WorkflowPolicy policy);
|
|
Tasking::GroupItem 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;
|
|
};
|
|
|
|
#endif // TASKWIDGET_H
|