27 #include "../../../common/Translator.h"
34 #include <QtCore/QCoreApplication>
35 #include <QtGui/QApplication>
38 : AbstractProgressViewer(),
58 m_tasks.insert(std::map<int, te::common::TaskProgress*>::value_type(
id, t));
65 std::map<int, te::common::TaskProgress*>::iterator it = m_tasks.find(taskId);
67 if(it != m_tasks.end())
81 QCoreApplication::processEvents();
87 std::map<int, te::common::TaskProgress*>::iterator it = m_tasks.find(taskId);
89 if(it != m_tasks.end())
92 m_totalSteps -= it->second->getTotalSteps();
93 m_currentStep -= it->second->getCurrentStep();
95 double aux =
static_cast<double>(m_currentStep) / static_cast<double>(m_totalSteps);
97 m_propStep =
static_cast<int>(100.0 * aux);
103 m_totalSteps += m_tasks[taskId]->getTotalSteps();
110 double aux =
static_cast<double>(m_currentStep) / static_cast<double>(m_totalSteps);
112 int val =
static_cast<int>(100.0 * aux);
114 if(val != m_propStep && val >= 0.0)
120 QCoreApplication::processEvents();
126 if(m_tasks.size() == 1)
128 m_message = m_tasks.begin()->second->getMessage();
142 m_dlgProgress->setValue(static_cast<ProgressSetValueEvent*>(e)->m_value);
146 m_dlgProgress->setLabelText(static_cast<ProgressSetMessageEvent*>(e)->m_value.c_str());
150 m_dlgProgress->reset();
156 std::map<int, te::common::TaskProgress*>::iterator it = m_tasks.begin();
158 while(it != m_tasks.end())
160 it->second->cancel();
The ProgressSetMessageEvent is a custom event used to set a new message into a progress bar...
void updateValue(int taskId)
Update the progress evaluation.
QProgressDialog * m_dlgProgress
GUI Objects used as progress bar dialog.
static QEvent::Type type()
Get the custom event type.
The ProgressSetValueEvent is a custom event used to set a new value into a progress bar...
virtual ~ProgressViewerDialog()
Virtual destructor.
void addTask(te::common::TaskProgress *t, int id)
Insert a new taks to progress viewer container.
static QEvent::Type type()
Get the custom event type.
virtual void cancel()
Get the button clicked and cancel ALL tasks.
void updateMessage(int taskId)
Update the progress message.
The ProgressResetEvent is a custom event used to reset a progress bar.
virtual void customEvent(QEvent *e)
Used to receive custom progress events.
The ProgressResetEvent is a custom event used to reset a progress bar.
void cancelTask(int taskId)
Cancel a task.
#define TR_QT_WIDGETS(message)
It marks a string in order to get translated. This is a special mark used in the TerraLib Qt Widgets ...
The ProgressSetValueEvent is a custom event used to set a new value into a progress bar...
static QEvent::Type type()
Get the custom event type.
This class can be used to inform the progress of a task.
void removeTask(int taskId)
Removes a task from progress viewer container.
A custom event used to set a new message into a progress bar.
void setTotalValues(int taskId)
Set task total steps.
ProgressViewerDialog(QWidget *parent)
Default constructor.