43 #include "processManagerWidget.hh" 45 void ProcessManagerWidget::updateStatus(QString _id,
int _status) {
47 QHash<QString, JobContainer>::iterator it = processMap_.find(_id);
50 if(it == processMap_.end())
return;
53 it.value().progress->setValue(_status);
56 void ProcessManagerWidget::setJobName(QString _id, QString _name) {
58 QHash<QString, JobContainer>::iterator it = processMap_.find(_id);
61 if(it == processMap_.end())
return;
63 it.value().id->setText(_name);
66 void ProcessManagerWidget::setJobDescription(QString _id, QString _desc) {
68 QHash<QString, JobContainer>::iterator it = processMap_.find(_id);
71 if(it == processMap_.end())
return;
74 it.value().description->setText(_desc);
77 void ProcessManagerWidget::addJob(QString _id, QString _description,
78 int _minSteps,
int _maxSteps) {
81 if(processMap_.contains(_id))
return;
83 QTableWidgetItem* name =
new QTableWidgetItem(_id);
84 QTableWidgetItem* desc =
new QTableWidgetItem(_description);
86 QProgressBar* progressBar =
new QProgressBar(this->processList);
87 progressBar->setMaximum(_maxSteps);
88 progressBar->setMinimum(_minSteps);
89 progressBar->setValue(0);
90 progressBar->setTextVisible(
true);
93 connect(button, SIGNAL(pressed()),
this, SLOT(cancelButtonPressed()));
95 int newRow = this->processList->rowCount();
97 this->processList->insertRow(newRow);
99 this->processList->setItem(newRow, 0, name);
100 this->processList->setItem(newRow, 1, desc);
101 this->processList->setCellWidget(newRow, 2, progressBar);
102 this->processList->setCellWidget(newRow, 3, button);
107 job.description = desc;
108 job.progress = progressBar;
111 processMap_.insert(_id, job);
114 void ProcessManagerWidget::cancelButtonPressed() {
121 if(button == 0)
return;
124 emit cancelJobRequested(button->jobId());
127 void ProcessManagerWidget::removeJob(QString _id) {
129 QHash<QString, JobContainer>::iterator it = processMap_.find(_id);
132 if(it == processMap_.end())
return;
134 processList->removeRow(processList->row(it.value().id));
137 processMap_.erase(it);