summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-12-20 16:18:24 +0000
committerCarl Hetherington <cth@carlh.net>2016-12-20 16:18:24 +0000
commit3476f2f8251d5800abdd968963cac57b0df8a657 (patch)
treedea2e82b66f7da44387023fe0c662253dfcec777 /src/wx
parentf8e6fdee828647bc5a6a1cc7627052a072a37dc6 (diff)
Allow content factory to return multiple content.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/content_menu.cc30
-rw-r--r--src/wx/content_panel.cc36
2 files changed, 36 insertions, 30 deletions
diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc
index 0240a8c33..429699956 100644
--- a/src/wx/content_menu.cc
+++ b/src/wx/content_menu.cc
@@ -278,8 +278,6 @@ ContentMenu::find_missing ()
return;
}
- shared_ptr<Content> content;
-
/* XXX: a bit nasty */
shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (_content.front ());
shared_ptr<DCPContent> dc = dynamic_pointer_cast<DCPContent> (_content.front ());
@@ -299,27 +297,31 @@ ContentMenu::find_missing ()
d->Destroy ();
}
+ list<shared_ptr<Content> > content;
+
if (r == wxID_OK) {
content = content_factory (film, path);
}
- if (!content) {
+ if (content.empty ()) {
return;
}
- shared_ptr<Job> j (new ExamineContentJob (film, content));
+ BOOST_FOREACH (shared_ptr<Content> i, content) {
+ shared_ptr<Job> j (new ExamineContentJob (film, i));
- j->Finished.connect (
- bind (
- &ContentMenu::maybe_found_missing,
- this,
- boost::weak_ptr<Job> (j),
- boost::weak_ptr<Content> (_content.front ()),
- boost::weak_ptr<Content> (content)
- )
- );
+ j->Finished.connect (
+ bind (
+ &ContentMenu::maybe_found_missing,
+ this,
+ boost::weak_ptr<Job> (j),
+ boost::weak_ptr<Content> (_content.front ()),
+ boost::weak_ptr<Content> (i)
+ )
+ );
- JobManager::instance()->add (j);
+ JobManager::instance()->add (j);
+ }
}
void
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc
index b67bdb4eb..816512fb6 100644
--- a/src/wx/content_panel.cc
+++ b/src/wx/content_panel.cc
@@ -310,7 +310,7 @@ ContentPanel::add_folder_clicked ()
return;
}
- shared_ptr<Content> content;
+ list<shared_ptr<Content> > content;
try {
content = content_factory (_film, path);
@@ -319,26 +319,28 @@ ContentPanel::add_folder_clicked ()
return;
}
- if (!content) {
+ if (content.empty ()) {
error_dialog (_parent, _("No content found in this folder."));
return;
}
- shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (content);
- if (ic) {
- ImageSequenceDialog* e = new ImageSequenceDialog (_panel);
- r = e->ShowModal ();
- float const frame_rate = e->frame_rate ();
- e->Destroy ();
-
- if (r != wxID_OK) {
- return;
+ BOOST_FOREACH (shared_ptr<Content> i, content) {
+ shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (i);
+ if (ic) {
+ ImageSequenceDialog* e = new ImageSequenceDialog (_panel);
+ r = e->ShowModal ();
+ float const frame_rate = e->frame_rate ();
+ e->Destroy ();
+
+ if (r != wxID_OK) {
+ return;
+ }
+
+ ic->set_video_frame_rate (frame_rate);
}
- ic->set_video_frame_rate (frame_rate);
+ _film->examine_and_add_content (i);
}
-
- _film->examine_and_add_content (content);
}
/** @return true if this remove "click" should be ignored */
@@ -583,7 +585,9 @@ ContentPanel::add_files (list<boost::filesystem::path> paths)
/* XXX: check for lots of files here and do something */
- for (list<boost::filesystem::path>::const_iterator i = paths.begin(); i != paths.end(); ++i) {
- _film->examine_and_add_content (content_factory (_film, *i));
+ BOOST_FOREACH (boost::filesystem::path i, paths) {
+ BOOST_FOREACH (shared_ptr<Content> j, content_factory (_film, i)) {
+ _film->examine_and_add_content (j);
+ }
}
}