fix stuff
[dcpomatic.git] / src / wx / content_panel.cc
index 07d2e142acfe456363ef33a16643e246f6fca84a..1f8c8fef39b354031b50b0dc75cd22681f78018f 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "audio_panel.h"
 #include "content_panel.h"
-#include "content_panel.h"
 #include "cucumber_bridge.h"
 #include "cucumber_registry.h"
 #include "dcpomatic_button.h"
@@ -33,8 +32,6 @@
 #include "timeline_dialog.h"
 #include "timing_panel.h"
 #include "video_panel.h"
-#include "video_panel.h"
-#include "wx_util.h"
 #include "wx_util.h"
 #include "lib/audio_content.h"
 #include "lib/case_insensitive_sorter.h"
@@ -50,6 +47,7 @@
 #include "lib/film.h"
 #include "lib/film_util.h"
 #include "lib/image_content.h"
+#include "lib/job_manager.h"
 #include "lib/log.h"
 #include "lib/playlist.h"
 #include "lib/scope_guard.h"
@@ -919,10 +917,6 @@ ContentPanel::setup ()
                item.SetData (i.get ());
                _content->InsertItem (item);
 
-               if (i.get() == selected_content) {
-                       _content->SetItemState (t, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
-               }
-
                if (alert) {
                        _content->SetItemTextColour (t, *wxRED);
                }
@@ -975,11 +969,16 @@ ContentPanel::add_files (vector<boost::filesystem::path> paths)
 
        try {
                for (auto i: paths) {
+                       std::cout << "here I am adding " << i << "\n";
                        for (auto j: content_factory(i)) {
+                               std::cout << "add " << j << "\n";
                                _film->examine_and_add_content (j);
+                               std::cout << "add done.\n";
                        }
+                       std::cout << "that's done.\n";
                }
        } catch (exception& e) {
+               std::cout << "that threw.\n";
                error_dialog (_parent, e.what());
        }
 }
@@ -1020,12 +1019,22 @@ ContentPanel::window() const
 }
 
 
+#ifdef DCPOMATIC_CUCUMBER
 void
 ContentPanel::cucumber_add_content_file (string filename)
 {
-       list<boost::filesystem::path> path_list;
-       path_list.push_back (filename);
-       add_files (path_list);
+       std::cout << "CP::cucumber_add_content_file\n";
+       add_files ({filename});
+       auto jm = JobManager::instance ();
+       while (jm->work_to_do()) {
+               std::cout << "work to do.\n";
+               while (signal_manager->ui_idle()) {}
+               dcpomatic_sleep_seconds (1);
+       }
+       while (signal_manager->ui_idle()) {
+               std::cout << "ui idle.\n";
+       }
+       std::cout << "CP::cucumber_add_content_file done\n";
 }
 
 
@@ -1035,9 +1044,10 @@ ContentPanel::cucumber_get_content_list ()
 {
        /* The playlist method that we end up calling has a mutex, so this should be ok */
        std::string s;
-       BOOST_FOREACH (shared_ptr<Content> i, _film->content()) {
+       for (auto content: _film->content()) {
                bool alert;
-               s += wx_to_std (text_for_content(i, alert)) + "\n";
+               s += wx_to_std (text_for_content(content, alert)) + "\n";
        }
        return s;
 }
+#endif