#include "content_properties_dialog.h"
#include "film_viewer.h"
#include "repeat_dialog.h"
-#include "timeline_audio_content_view.h"
#include "timeline_video_content_view.h"
+#include "timeline_audio_content_view.h"
#include "wx_util.h"
#include "lib/audio_content.h"
#include "lib/config.h"
#include "lib/exceptions.h"
#include "lib/ffmpeg_content.h"
#include "lib/film.h"
+#include "lib/find_missing.h"
#include "lib/guess_crop.h"
#include "lib/image_content.h"
#include "lib/job_manager.h"
boost::filesystem::path path;
if ((ic && !ic->still ()) || dc) {
- auto d = new wxDirDialog (0, _("Choose a folder"), wxT (""), wxDD_DIR_MUST_EXIST);
+ auto d = new wxDirDialog (nullptr, _("Choose a folder"), wxT (""), wxDD_DIR_MUST_EXIST);
r = d->ShowModal ();
- path = wx_to_std (d->GetPath ());
+ path = wx_to_std (d->GetPath());
d->Destroy ();
} else {
- auto d = new wxFileDialog (0, _("Choose a file"), wxT (""), wxT (""), wxT ("*.*"));
+ auto d = new wxFileDialog (nullptr, _("Choose a file"), wxT (""), wxT (""), wxT ("*.*"));
r = d->ShowModal ();
- path = wx_to_std (d->GetPath ());
+ path = wx_to_std (d->GetPath());
d->Destroy ();
}
- list<shared_ptr<Content>> content;
-
- if (r == wxID_OK) {
- if (dc) {
- content.push_back (make_shared<DCPContent>(path));
- } else {
- content = content_factory (path);
- }
- }
-
- if (content.empty ()) {
+ if (r == wxID_CANCEL) {
return;
}
- for (auto i: content) {
- auto j = make_shared<ExamineContentJob>(film, i);
-
- j->Finished.connect (
- bind (
- &ContentMenu::maybe_found_missing,
- this,
- std::weak_ptr<Job> (j),
- std::weak_ptr<Content> (_content.front ()),
- std::weak_ptr<Content> (i)
- )
- );
-
- JobManager::instance()->add (j);
- }
+ dcpomatic::find_missing (film->content(), path);
}
void
}
for (auto i: _content) {
- JobManager::instance()->add (shared_ptr<Job> (new ExamineContentJob (film, i)));
+ JobManager::instance()->add(make_shared<ExamineContentJob>(film, i));
}
}
-void
-ContentMenu::maybe_found_missing (weak_ptr<Job> j, weak_ptr<Content> oc, weak_ptr<Content> nc)
-{
- auto job = j.lock ();
- if (!job || !job->finished_ok ()) {
- return;
- }
-
- auto old_content = oc.lock ();
- auto new_content = nc.lock ();
- DCPOMATIC_ASSERT (old_content);
- DCPOMATIC_ASSERT (new_content);
-
- if (new_content->digest() != old_content->digest()) {
- error_dialog (0, _("The content file(s) you specified are not the same as those that are missing. Either try again with the correct content file or remove the missing content."));
- return;
- }
-
- old_content->set_paths (new_content->paths());
-}
void
ContentMenu::kdm ()