Fix confusion with AUDIO_STREAMS property.
[dcpomatic.git] / src / lib / job.cc
index eadafbf73a1f8d6b20c3ffca9527d90a68f2fb18..286b38456a8c0b82891e67d8b698cfaf4fedde64 100644 (file)
@@ -27,7 +27,6 @@
 #include "job.h"
 #include "util.h"
 #include "cross.h"
-#include "ui_signaller.h"
 #include "exceptions.h"
 #include "film.h"
 #include "log.h"
@@ -203,8 +202,8 @@ Job::set_state (State s)
                }
        }
 
-       if (finished && ui_signaller) {
-               ui_signaller->emit (boost::bind (boost::ref (Finished)));
+       if (finished) {
+               emit (boost::bind (boost::ref (Finished)));
        }       
 }
 
@@ -239,9 +238,10 @@ Job::set_progress (float p, bool force)
                _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 */
@@ -301,9 +301,7 @@ Job::set_progress_unknown ()
        _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 */
@@ -381,6 +379,10 @@ Job::cancel ()
                return;
        }
 
+       if (paused ()) {
+               resume ();
+       }
+
        _thread->interrupt ();
        _thread->join ();
 }