summaryrefslogtreecommitdiff
path: root/src/wx/content_menu.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-12-25 02:05:54 +0100
committerCarl Hetherington <cth@carlh.net>2022-05-02 00:31:04 +0200
commit266e3f1b80d1263ff3cc8b3afaecd6ca1f88983b (patch)
treeeeb717e9eaa72e1b70f0a9ff1f2e7bad4ddc2a5b /src/wx/content_menu.cc
parent469a5dbd4251b094e6d4b668a763568c25947b88 (diff)
Extract and improve code to find missing files (#1940).
Diffstat (limited to 'src/wx/content_menu.cc')
-rw-r--r--src/wx/content_menu.cc48
1 files changed, 2 insertions, 46 deletions
diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc
index 18ce64475..a80a5fc82 100644
--- a/src/wx/content_menu.cc
+++ b/src/wx/content_menu.cc
@@ -354,35 +354,11 @@ ContentMenu::find_missing ()
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
@@ -398,26 +374,6 @@ ContentMenu::re_examine ()
}
}
-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 ()