58 #include "processManagerWidget.hh" 60 void ProcessManagerWidget::updateStatus(QString _id,
int _status) {
62 QHash<QString, JobContainer>::iterator it = processMap_.find(_id);
65 if(it == processMap_.end())
return;
68 it.value().progress->setValue(_status);
71 void ProcessManagerWidget::setJobName(QString _id, QString _name) {
73 QHash<QString, JobContainer>::iterator it = processMap_.find(_id);
76 if(it == processMap_.end())
return;
78 it.value().id->setText(_name);
81 void ProcessManagerWidget::setJobDescription(QString _id, QString _desc) {
83 QHash<QString, JobContainer>::iterator it = processMap_.find(_id);
86 if(it == processMap_.end())
return;
89 it.value().description->setText(_desc);
92 void ProcessManagerWidget::addJob(QString _id, QString _description,
93 int _minSteps,
int _maxSteps) {
96 if(processMap_.contains(_id))
return;
98 QTableWidgetItem* name =
new QTableWidgetItem(_id);
99 QTableWidgetItem* desc =
new QTableWidgetItem(_description);
101 QProgressBar* progressBar =
new QProgressBar(this->processList);
102 progressBar->setMaximum(_maxSteps);
103 progressBar->setMinimum(_minSteps);
104 progressBar->setValue(0);
105 progressBar->setTextVisible(
true);
108 connect(button, SIGNAL(pressed()),
this, SLOT(cancelButtonPressed()));
110 int newRow = this->processList->rowCount();
112 this->processList->insertRow(newRow);
114 this->processList->setItem(newRow, 0, name);
115 this->processList->setItem(newRow, 1, desc);
116 this->processList->setCellWidget(newRow, 2, progressBar);
117 this->processList->setCellWidget(newRow, 3, button);
122 job.description = desc;
123 job.progress = progressBar;
126 processMap_.insert(_id, job);
129 void ProcessManagerWidget::cancelButtonPressed() {
136 if(button == 0)
return;
139 emit cancelJobRequested(button->jobId());
142 void ProcessManagerWidget::removeJob(QString _id) {
144 QHash<QString, JobContainer>::iterator it = processMap_.find(_id);
147 if(it == processMap_.end())
return;
149 processList->removeRow(processList->row(it.value().id));
152 processMap_.erase(it);