- list<shared_ptr<Job> > jobs = JobManager::instance()->get ();
-
- int index = 0;
-
- for (list<shared_ptr<Job> >::iterator i = jobs.begin(); i != jobs.end(); ++i) {
-
- if (_job_records.find (*i) == _job_records.end ()) {
- wxStaticText* m = new wxStaticText (_panel, wxID_ANY, std_to_wx ((*i)->name ()));
- _table->Insert (index, m, 0, wxALIGN_CENTER_VERTICAL | wxALL, 6);
-
- JobRecord r;
- int n = 1;
- r.finalised = false;
- r.gauge = new wxGauge (_panel, wxID_ANY, 100);
- _table->Insert (index + n, r.gauge, 1, wxEXPAND | wxLEFT | wxRIGHT);
- ++n;
-
- r.message = new wxStaticText (_panel, wxID_ANY, std_to_wx (""));
- _table->Insert (index + n, r.message, 1, wxALIGN_CENTER_VERTICAL | wxALL, 6);
- ++n;
-
- r.cancel = new wxButton (_panel, wxID_ANY, _("Cancel"));
- r.cancel->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (JobManagerView::cancel_clicked), 0, this);
- _table->Insert (index + n, r.cancel, 1, wxALIGN_CENTER_VERTICAL | wxALL, 6);
- ++n;
-
- if (_buttons & PAUSE) {
- r.pause = new wxButton (_panel, wxID_ANY, _("Pause"));
- r.pause->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (JobManagerView::pause_clicked), 0, this);
- _table->Insert (index + n, r.pause, 1, wxALIGN_CENTER_VERTICAL | wxALL, 6);
- ++n;
- }
-
- r.details = new wxButton (_panel, wxID_ANY, _("Details..."));
- r.details->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (JobManagerView::details_clicked), 0, this);
- r.details->Enable (false);
- _table->Insert (index + n, r.details, 1, wxALIGN_CENTER_VERTICAL | wxALL, 6);
- ++n;
-
- _job_records[*i] = r;
- }
-
- string const st = (*i)->status ();
-
- if (!(*i)->finished ()) {
- float const p = (*i)->overall_progress ();
- if (p >= 0) {
- checked_set (_job_records[*i].message, st);
- _job_records[*i].gauge->SetValue (p * 100);
- } else {
- checked_set (_job_records[*i].message, wx_to_std (_("Running")));
- _job_records[*i].gauge->Pulse ();
- }
- }
-
- if ((*i)->finished() && !_job_records[*i].finalised) {
- checked_set (_job_records[*i].message, st);
- if (!(*i)->finished_cancelled()) {
- _job_records[*i].gauge->SetValue (100);
- }
- _job_records[*i].finalised = true;
- _job_records[*i].cancel->Enable (false);
- if (!(*i)->error_details().empty ()) {
- _job_records[*i].details->Enable (true);
- }
- }
-
- index += 5;
- if (_buttons & PAUSE) {
- ++index;