27 #include "../Translator.h"
48 m_tasks.insert(std::map<int, TaskProgress*>::value_type(
id, t));
55 std::map<int, TaskProgress*>::iterator it = m_tasks.find(taskId);
57 if(it != m_tasks.end())
73 std::map<int, TaskProgress*>::iterator it = m_tasks.find(taskId);
75 if(it != m_tasks.end())
78 m_totalSteps -= it->second->getTotalSteps();
79 m_currentStep -= it->second->getCurrentStep();
81 double aux =
static_cast<double>(m_currentStep) / static_cast<double>(m_totalSteps);
83 m_propStep =
static_cast<int>(100.0 * aux);
89 m_totalSteps += m_tasks[taskId]->getTotalSteps();
96 double aux =
static_cast<double>(m_currentStep) / static_cast<double>(m_totalSteps);
98 int val =
static_cast<int>(100.0 * aux);
100 if((val != m_propStep) && (val >= 0))
104 std::cout << m_message <<
TE_TR(
" - Percent: ") << m_propStep <<
"%" <<std::endl;
110 if(m_tasks.size() == 1)
112 m_message = m_tasks.begin()->second->getMessage();
116 m_message =
TE_TR(
"Multi Tasks");
This class can be used to inform the progress of a task.
A progress viewer implementation for the console.
This class can be used to inform the progress of a task.
#define TE_TR(message)
It marks a string in order to get translated.
void updateMessage(int taskId)
Update the progress message.
ConsoleProgressViewer()
Default constructor.
A class that defines the interface of an abstract progress viewer.
void addTask(TaskProgress *t, int id)
Insert a new task in the progress viewer.
void removeTask(int taskId)
Removes a task from progress viewer container.
void cancelTask(int taskId)
Cancel a task.
void setTotalValues(int taskId)
Set task total steps.
void updateValue(int taskId)
Update the progress evaluation.
~ConsoleProgressViewer()
Virtual destructor.