, _window (window)
, _panel (panel)
, _table (table)
+ , _needs_pulse (false)
{
int n = 0;
panel->FitInside ();
}
+ void maybe_pulse ()
+ {
+ if (_job->running() && _needs_pulse) {
+ _gauge->Pulse ();
+ }
+
+ _needs_pulse = true;
+ }
+
private:
void progress ()
if (p >= 0) {
checked_set (_message, _job->status ());
_gauge->SetValue (p * 100);
- } else {
- checked_set (_message, wx_to_std (_("Running")));
- _gauge->Pulse ();
+ _needs_pulse = false;
}
_table->Layout ();
wxButton* _cancel;
wxButton* _pause;
wxButton* _details;
+ bool _needs_pulse;
};
/** Must be called in the GUI thread */
SetScrollRate (0, 32);
+ Bind (wxEVT_TIMER, boost::bind (&JobManagerView::periodic, this));
+ _timer.reset (new wxTimer (this));
+ _timer->Start (1000);
+
JobManager::instance()->JobAdded.connect (bind (&JobManagerView::job_added, this, _1));
}
}
}
+void
+JobManagerView::periodic ()
+{
+ for (list<shared_ptr<JobRecord> >::iterator i = _job_records.begin(); i != _job_records.end(); ++i) {
+ (*i)->maybe_pulse ();
+ }
+}
private:
void job_added (boost::weak_ptr<Job>);
+ void periodic ();
wxPanel* _panel;
wxFlexGridSizer* _table;
+ boost::shared_ptr<wxTimer> _timer;
std::list<boost::shared_ptr<JobRecord> > _job_records;
Buttons _buttons;