10#include <QtCore/QMutex>
77 std::vector<TaskProgressInfo>
GetProcessedTasks(
bool preferSorted =
false,
int maxCount = -1)
const;
86 const QByteArray& taskId,
87 const QString& taskDescription,
88 double weight = 1.0)
override;
89 virtual std::unique_ptr<IProgressLogger>
StartProgressLogger(
bool isCancelable =
false,
const QString& description = {})
override;
122 bool isCancelable =
false;
132 virtual void OnProgress(
double currentProgress)
override;
133 virtual bool IsCanceled()
const override;
136 TaskInfo m_defaultTaskInfo;
138 std::map<TaskBase*, ProgressInfo> m_openTasks;
140 double m_currentProgress;
142 double m_closedTaskSum;
143 double m_maxProgressSum;
144 bool m_isProgressLoggerStarted;
146 int m_cancelableCounter;
149 mutable QMutex m_tasksMutex;
TaskBase(CCumulatedProgressManagerBase *parentPtr, const TaskInfo &taskInfo, double weight, bool isCancelable)
CCumulatedProgressManagerBase * m_parentPtr
Progress manager delegating cumulated progress result to another manager.
virtual ~CCumulatedProgressManagerBase()
virtual void OpenTask(TaskBase *taskPtr, const TaskInfo &taskInfo, double weight, bool isCancelable)
CCumulatedProgressManagerBase(const TaskInfo &defaultTaskInfo={"", ""})
Create cumulated progress manager.
void SetCanceled(bool state=true)
virtual void OnProgressChanged(double cumulatedValue)
double GetCumulatedProgress() const
Get final progress beeing result of all task progress.
std::unique_ptr< IProgressManager > CreateSubtaskManager(const QByteArray &taskId, const QString &taskDescription, double weight=1.0) override
Create progress manager for the subtask.
virtual std::unique_ptr< IProgressLogger > StartProgressLogger(bool isCancelable=false, const QString &description={}) override
Create progress logger.
virtual void ResetProgressManager() override
Reset progress manager and make it possible to reuse it.
virtual void OnTasksChanged()
void SetDefaultTaskInfo(const TaskInfo &defaultTaskInfo)
Set information of the default task.
@ Created
Task was created, but not started.
@ Running
Task is running.
@ Finished
Task was finished.
friend class SubTaskManager
bool IsCancelable() const
virtual void CloseTask(TaskBase *taskPtr)
void TryUpdateCumulatedProgress()
virtual bool IsCanceled() const
std::vector< TaskProgressInfo > GetProcessedTasks(bool preferSorted=false, int maxCount=-1) const
Get list of current processed tasks.
virtual void ReportTaskProgress(TaskBase *taskPtr, double progress, TaskStatus taskStatus)
Consume information about progress of some process.
Consume information about progress of some process.
Base interface for all used interfaces and implementations.
This namespace contains basic implementations of standard primitives on the component level.