X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcheck_content_change_job.cc;h=16ef8d86485391bb6724eb190055f4fdb94ce6d2;hb=ca5cc79f4464c5e9f34480757c288b9bbcb569ec;hp=783a2ac010521e989c636af307964955b256029c;hpb=f0f4b2371ff5cd6fc39239a3c201bae0c033d21f;p=dcpomatic.git diff --git a/src/lib/check_content_change_job.cc b/src/lib/check_content_change_job.cc index 783a2ac01..16ef8d864 100644 --- a/src/lib/check_content_change_job.cc +++ b/src/lib/check_content_change_job.cc @@ -18,32 +18,38 @@ */ + #include "check_content_change_job.h" -#include "job_manager.h" -#include "examine_content_job.h" #include "content.h" +#include "examine_content_job.h" #include "film.h" -#include +#include "job_manager.h" #include #include "i18n.h" -using std::string; -using std::list; + using std::cout; -using boost::shared_ptr; +using std::make_shared; +using std::shared_ptr; +using std::string; + -CheckContentChangeJob::CheckContentChangeJob (shared_ptr film, shared_ptr following) +CheckContentChangeJob::CheckContentChangeJob (shared_ptr film) : Job (film) - , _following (following) { } +CheckContentChangeJob::~CheckContentChangeJob () +{ + stop_thread (); +} + string CheckContentChangeJob::name () const { - return _("Check content for changes"); + return _("Checking content for changes"); } string @@ -57,40 +63,17 @@ CheckContentChangeJob::run () { set_progress_unknown (); - list > changed; + auto content = _film->content(); + std::vector> changed; + std::copy_if (content.begin(), content.end(), std::back_inserter(changed), [](shared_ptr c) { return c->changed(); }); - BOOST_FOREACH (shared_ptr i, _film->content()) { - bool ic = false; - for (size_t j = 0; j < i->number_of_paths(); ++j) { - if (boost::filesystem::last_write_time(i->path(j)) != i->last_write_time(j)) { - ic = true; - break; - } - } - if (!ic && i->calculate_digest() != i->digest()) { - ic = true; - } - if (ic) { - changed.push_back (i); + if (!changed.empty()) { + for (auto i: changed) { + JobManager::instance()->add(make_shared(_film, i)); } - } - - BOOST_FOREACH (shared_ptr i, changed) { - JobManager::instance()->add(shared_ptr(new ExamineContentJob(_film, i))); + set_message (_("Some files have been changed since they were added to the project.\n\nThese files will now be re-examined, so you may need to check their settings.")); } set_progress (1); set_state (FINISHED_OK); - - if (!changed.empty()) { - string m = _("Some files have been changed since they were added to the project.\n\nThese files will now be re-examined, so you may need to check their settings."); - if (_following) { - /* I'm assuming that _following is a make DCP job */ - m += " "; - m += _("Choose 'Make DCP' again when you have done this."); - } - set_message (m); - } else if (_following) { - JobManager::instance()->add (_following); - } }