#include "job.h"
#include "util.h"
#include "cross.h"
-#include "ui_signaller.h"
#include "exceptions.h"
#include "film.h"
#include "log.h"
}
}
- if (finished && ui_signaller) {
- ui_signaller->emit (boost::bind (boost::ref (Finished)));
+ if (finished) {
+ emit (boost::bind (boost::ref (Finished)));
}
}
_pause_changed.wait (lm2);
}
- if (ui_signaller) {
- ui_signaller->emit (boost::bind (boost::ref (Progress)));
- }
+ lm.unlock ();
+ lm2.unlock ();
+
+ emit (boost::bind (boost::ref (Progress)));
}
/** @return fractional progress of the current sub-job, if known */
_progress.reset ();
lm.unlock ();
- if (ui_signaller) {
- ui_signaller->emit (boost::bind (boost::ref (Progress)));
- }
+ emit (boost::bind (boost::ref (Progress)));
}
/** @return Human-readable status of this job */
return s.str ();
}
+string
+Job::json_status () const
+{
+ boost::mutex::scoped_lock lm (_state_mutex);
+
+ switch (_state) {
+ case NEW:
+ return N_("new");
+ case RUNNING:
+ return N_("running");
+ case PAUSED:
+ return N_("paused");
+ case FINISHED_OK:
+ return N_("finished_ok");
+ case FINISHED_ERROR:
+ return N_("finished_error");
+ case FINISHED_CANCELLED:
+ return N_("finished_cancelled");
+ }
+
+ return "";
+}
+
/** @return An estimate of the remaining time for this sub-job, in seconds */
int
Job::remaining_time () const
return;
}
+ if (paused ()) {
+ resume ();
+ }
+
_thread->interrupt ();
_thread->join ();
}