X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fjob.h;h=97e3fc29637d292597d943f4c9e70a77cdd8dfad;hb=5e4f001bf32e3cdf65efa34803d70e6c1c00c66b;hp=ce3a87f5efdb29b8a8555c06c7446dc7972705b9;hpb=e16c8ed02a0cb1f733a990d75a9de1bf50cf89bd;p=dcpomatic.git diff --git a/src/lib/job.h b/src/lib/job.h index ce3a87f5e..97e3fc296 100644 --- a/src/lib/job.h +++ b/src/lib/job.h @@ -64,13 +64,23 @@ public: int elapsed_time () const; virtual std::string status () const; + std::string sub_name () const { + return _sub_name; + } void set_progress_unknown (); - void set_progress (float); - void ascend (); - void descend (float); - float overall_progress () const; - + void set_progress (float, bool force = false); + void sub (std::string); + float progress () const; + bool progress_unknown () const { + return !_progress; + } + + boost::shared_ptr film () const { + return _film; + } + + boost::signals2::signal Progress; /** Emitted from the UI thread when the job is finished */ boost::signals2::signal Finished; @@ -80,10 +90,10 @@ protected: /** Description of a job's state */ enum State { - NEW, ///< the job hasn't been started yet - RUNNING, ///< the job is running - PAUSED, ///< the job has been paused - FINISHED_OK, ///< the job has finished successfully + NEW, ///< the job hasn't been started yet + RUNNING, ///< the job is running + PAUSED, ///< the job has been paused + FINISHED_OK, ///< the job has finished successfully FINISHED_ERROR, ///< the job has finished in error FINISHED_CANCELLED ///< the job was cancelled }; @@ -107,23 +117,13 @@ private: std::string _error_summary; std::string _error_details; - /** time that this job was started */ + /** time that this sub-job was started */ time_t _start_time; + std::string _sub_name; - /** mutex for _stack and _progress_unknown */ + /** mutex for _progress */ mutable boost::mutex _progress_mutex; - - struct Level { - Level (float a) : allocation (a), normalised (0) {} - - float allocation; - float normalised; - }; - - std::list _stack; - - /** true if this job's progress will always be unknown */ - bool _progress_unknown; + boost::optional _progress; int _ran_for; };