Another attempt to fix back / same-frame seeks.
[dcpomatic.git] / src / lib / job.cc
index 9a5812fa7426dfb451fb619951b606769be16e06..080d1eaf6018a5588c9d9f0c31a63c894585a4a1 100644 (file)
@@ -27,6 +27,7 @@
 #include "job.h"
 #include "util.h"
 #include "cross.h"
+#include "ui_signaller.h"
 
 #include "i18n.h"
 
@@ -35,9 +36,7 @@ using std::list;
 using std::stringstream;
 using boost::shared_ptr;
 
-/** @param s Film that we are operating on.
- */
-Job::Job (shared_ptr<Film> f)
+Job::Job (shared_ptr<const Film> f)
        : _film (f)
        , _thread (0)
        , _state (NEW)
@@ -94,7 +93,7 @@ Job::run_wrapper ()
                set_state (FINISHED_ERROR);
                set_error (
                        e.what (),
-                       _("It is not known what caused this error.  The best idea is to report the problem to the DVD-o-matic mailing list (dvdomatic@carlh.net)")
+                       _("It is not known what caused this error.  The best idea is to report the problem to the DCP-o-matic mailing list (dcpomatic@carlh.net)")
                        );
 
        } catch (...) {
@@ -103,7 +102,7 @@ Job::run_wrapper ()
                set_state (FINISHED_ERROR);
                set_error (
                        _("Unknown error"),
-                       _("It is not known what caused this error.  The best idea is to report the problem to the DVD-o-matic mailing list (dvdomatic@carlh.net)")
+                       _("It is not known what caused this error.  The best idea is to report the problem to the DCP-o-matic mailing list (dcpomatic@carlh.net)")
                        );
 
        }
@@ -172,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)));
+               }
        }
 }
 
@@ -200,7 +202,7 @@ Job::set_progress (float p)
        boost::this_thread::interruption_point ();
 
        if (paused ()) {
-               dvdomatic_sleep (1);
+               dcpomatic_sleep (1);
        }
 }