27 #include "../../../common/Translator.h"
34 #include <QtCore/QCoreApplication>
35 #include <QApplication>
38 : AbstractProgressViewer(),
59 m_tasks.insert(std::map<int, te::common::TaskProgress*>::value_type(
id, t));
66 std::map<int, te::common::TaskProgress*>::iterator it = m_tasks.find(taskId);
68 if(it != m_tasks.end())
82 QCoreApplication::processEvents();
88 std::map<int, te::common::TaskProgress*>::iterator it = m_tasks.find(taskId);
90 if(it != m_tasks.end())
93 m_totalSteps -= it->second->getTotalSteps();
94 m_currentStep -= it->second->getCurrentStep();
96 double aux =
static_cast<double>(m_currentStep) / static_cast<double>(m_totalSteps);
98 m_propStep =
static_cast<int>(100.0 * aux);
104 m_totalSteps += m_tasks[taskId]->getTotalSteps();
109 m_dlgProgress->show();
113 double aux =
static_cast<double>(m_currentStep) / static_cast<double>(m_totalSteps);
115 int val =
static_cast<int>(100.0 * aux);
117 if(val != m_propStep && val >= 0.0)
123 QCoreApplication::processEvents();
129 if(m_tasks.size() == 1)
131 m_message = m_tasks.begin()->second->getMessage();
135 m_message =
TE_TR(
"Multi Tasks");
145 m_dlgProgress->setValue(static_cast<ProgressSetValueEvent*>(e)->m_value);
149 m_dlgProgress->setLabelText(static_cast<ProgressSetMessageEvent*>(e)->m_value.c_str());
153 m_dlgProgress->reset();
159 std::map<int, te::common::TaskProgress*>::iterator it = m_tasks.begin();
161 while(it != m_tasks.end())
163 it->second->cancel();
The ProgressSetValueEvent is a custom event used to set a new value into a progress bar...
This class can be used to inform the progress of a task.
A custom event used to set a new message into a progress bar.
#define TE_TR(message)
It marks a string in order to get translated.
The ProgressResetEvent is a custom event used to reset a progress bar.