27 #include "../../../common/Translator.h"
34 #include <QtCore/QCoreApplication>
35 #include <QtGui/QApplication>
39 AbstractProgressViewer(),
55 m_layout->setContentsMargins(0, 0, 0, 0);
69 m_tasks.insert(std::map<int, te::common::TaskProgress*>::value_type(
id, t));
74 std::map<int, te::common::TaskProgress*>::iterator it = m_tasks.find(taskId);
76 if(it != m_tasks.end())
88 QCoreApplication::processEvents();
94 std::map<int, te::common::TaskProgress*>::iterator it = m_tasks.find(taskId);
96 if(it != m_tasks.end())
99 m_totalSteps -= it->second->getTotalSteps();
100 m_currentStep -= it->second->getCurrentStep();
102 double aux =
static_cast<double>(m_currentStep) / static_cast<double>(m_totalSteps);
104 m_propStep =
static_cast<int>(100.0 * aux);
110 m_totalSteps += m_tasks[taskId]->getTotalSteps();
117 double aux =
static_cast<double>(m_currentStep) / static_cast<double>(m_totalSteps);
119 int val =
static_cast<int>(100.0 * aux);
121 if(val != m_propStep && val >= 0.0)
126 QCoreApplication::processEvents();
136 m_button->setText(value.c_str());
143 m_progressBar->setValue(static_cast<ProgressSetValueEvent*>(e)->m_value);
148 m_progressBar->reset();
ProgressViewerBar(QWidget *parent)
Default constructor.
QGridLayout * m_layout
GUI Objects used to build the custom widget.
void removeTask(int taskId)
Removes a task from progress viewer container.
A class that defines the interface of a qt bar progress viewer.
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...
void updateMessage(int taskId)
Update the progress message.
The ProgressResetEvent is a custom event used to reset a progress bar.
void updateValue(int taskId)
Update the progress evaluation.
QProgressBar * m_progressBar
GUI Objects used to build the custom widget.
QPushButton * m_button
GUI Objects used to build the custom widget.
The ProgressResetEvent is a custom event used to reset a progress bar.
~ProgressViewerBar()
Virtual destructor.
void cancelTask(int taskId)
Cancel a task.
virtual void customEvent(QEvent *e)
Used to receive custom progress events.
void setTotalValues(int taskId)
Set task total steps.
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.
void setButtonText(const std::string &value)
This class can be used to inform the progress of a task.
virtual void onReleased()
Used to get the button clicked (internal function).
A custom event used to set a new message into a progress bar.
void addTask(te::common::TaskProgress *t, int id)
Insert a new taks to progress viewer container.