Merge master.
[dcpomatic.git] / src / lib / job.cc
index 2e6385d62e8499a37ed427fb3650c1e22aec5196..080d1eaf6018a5588c9d9f0c31a63c894585a4a1 100644 (file)
@@ -27,6 +27,7 @@
 #include "job.h"
 #include "util.h"
 #include "cross.h"
+#include "ui_signaller.h"
 
 #include "i18n.h"
 
@@ -35,7 +36,7 @@ using std::list;
 using std::stringstream;
 using boost::shared_ptr;
 
-Job::Job (shared_ptr<Film> f)
+Job::Job (shared_ptr<const Film> f)
        : _film (f)
        , _thread (0)
        , _state (NEW)
@@ -170,8 +171,11 @@ Job::set_state (State s)
        boost::mutex::scoped_lock lm (_state_mutex);
        _state = s;
 
-       if (_state == FINISHED_OK || _state == FINISHED_ERROR) {
+       if (_state == FINISHED_OK || _state == FINISHED_ERROR || _state == FINISHED_CANCELLED) {
                _ran_for = elapsed_time ();
+               if (ui_signaller) {
+                       ui_signaller->emit (boost::bind (boost::ref (Finished)));
+               }
        }
 }