34 m_totalSteps(totalSteps),
40 m_isMultiThread(false),
81 m_timer->setTotalSteps(m_totalSteps);
92 return m_currentPropStep;
104 m_currentStep = value;
106 double aux =
static_cast<double>(m_currentStep) / static_cast<double>(m_totalSteps);
108 int val =
static_cast<int>(100.0 * aux);
110 if(val > m_currentPropStep)
112 m_currentPropStep = val;
113 m_hasToUpdate =
true;
117 m_hasToUpdate =
false;
124 setMessage(m_timer->getMessage());
135 int val = getCurrentStep();
137 setCurrentStep(++val);
168 m_isMultiThread = flag;
183 if(m_timer == 0 && m_useTimer)
196 return m_hasToUpdate;
void useMultiThread(bool flag)
Used to define if task is running in thread mode.
void setMessage(const std::string &message)
Set the task message.
This class can be used to inform the progress of a task.
int getProportionalValue() const
Get the proportional value (value between 0 and 100).
A singleton class used to manage tasks progresses and their viewers.
void useTimer(bool flag)
Used to define if task use progress timer information.
int addTask(TaskProgress *tp)
Used in TaskProgress constructor, register this task generating a task id.
void cancelTask(int taskId)
Inform all viewers that a task was canceled.
const std::string & getMessage() const
Get the task message.
~TaskProgress()
Destructor.
bool isActive() const
Verify if the task is active.
void setTotalSteps(int value)
Set the task total stepes.
int getId() const
Get the task identification.
TaskProgress(const std::string &message="", unsigned int type=UNDEFINED, int totalSteps=0)
Default constructor.
static ProgressManager & getInstance()
It returns a reference to the singleton instance.
void setTotalValues(int taskId)
Inform all viewers that a task set the total values.
void cancel()
Cancel task, set the task active FALSE.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
int getCurrentStep() const
Get the task current step.
void removeTask(int taskId)
Used in TaskProgress destructor, remove task from singleton.
bool hasToUpdate() const
This function is used when proportional value has changed.
The ProgressTimer is a utility class that can be used to calculate the estimated time to finish a tas...
unsigned int getType() const
Get the task type.
void setCurrentStep(int value)
Set the task current step.
void updateMessage(int taskId)
Inform all viewers that a task set the message.
int m_id
Task identification.
The ProgressTimer is a utility class that can be used to calculate the estimated time to finish a tas...
void updateValue(int taskId)
Inform all viewers that a task set the current step.
int getTotalSteps() const
Get the task total stepes.