Add some useful selectors in the add file dialog.
[dcpomatic.git] / src / wx / content_panel.cc
index 066c3e93cadba2a126868391f0213daa7ec73e87..59886229c9be06892c6e646e70e8be2d7b722985 100644 (file)
@@ -38,6 +38,7 @@
 #include <wx/listctrl.h>
 #include <boost/filesystem.hpp>
 #include <boost/foreach.hpp>
+#include <iostream>
 
 #include "lib/image_filename_sorter.cc"
 
@@ -244,7 +245,7 @@ ContentPanel::add_file_clicked ()
        /* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using
           non-Latin filenames or paths.
        */
-       wxFileDialog* d = new wxFileDialog (_panel, _("Choose a file or files"), wxT (""), wxT (""), wxT ("*.*"), wxFD_MULTIPLE | wxFD_CHANGE_DIR);
+       wxFileDialog* d = new wxFileDialog (_panel, _("Choose a file or files"), wxT (""), wxT (""), wxT ("All files|*.*|Subtitle files|*.srt;*.xml|Audio files|*.wav;*.w64;*.flac;*.aif;*.aiff"), wxFD_MULTIPLE | wxFD_CHANGE_DIR);
        int const r = d->ShowModal ();
 
        if (r != wxID_OK) {
@@ -276,6 +277,10 @@ ContentPanel::add_folder_clicked ()
        }
 
        shared_ptr<Content> content = content_factory (_film, path);
+       if (!content) {
+               error_dialog (_parent, _("No content found in this folder."));
+               return;
+       }
 
        shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (content);
        if (ic) {
@@ -521,11 +526,6 @@ 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) {
-               shared_ptr<Content> c = content_factory (_film, *i);
-               shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (c);
-               if (ic) {
-                       ic->set_video_frame_rate (24);
-               }
-               _film->examine_and_add_content (c);
+               _film->examine_and_add_content (content_factory (_film, *i));
        }
 }