Remove the need for ScreenKDM::collect.
[dcpomatic.git] / src / tools / dcpomatic.cc
index 1ab316fec73a055ae83c2b0354b1220a9dfc0fa3..36817eb530496473c2861d6ca301f6f3590441a9 100644 (file)
 #include "lib/signal_manager.h"
 #include "lib/log.h"
 #include "lib/job_manager.h"
-#include "lib/transcode_job.h"
 #include "lib/exceptions.h"
 #include "lib/cinema.h"
-#include "lib/kdm.h"
+#include "lib/screen_kdm.h"
 #include "lib/send_kdm_email_job.h"
 #include "lib/server_finder.h"
-#include "lib/update.h"
+#include "lib/update_checker.h"
 #include "lib/cross.h"
 #include "lib/content_factory.h"
 #include "lib/compose.hpp"
@@ -447,7 +446,11 @@ private:
 
                try {
                        if (d->write_to ()) {
-                               write_kdm_files (_film, d->screens (), d->cpl (), d->from (), d->until (), d->formulation (), d->directory ());
+                               ScreenKDM::write_files (
+                                       _film,
+                                       _film->make_kdms (d->screens(), d->cpl(), d->from(), d->until(), d->formulation()),
+                                       d->directory()
+                                       );
                        } else {
                                JobManager::instance()->add (
                                        shared_ptr<Job> (new SendKDMEmailJob (_film, d->screens (), d->cpl (), d->from (), d->until (), d->formulation ()))
@@ -606,7 +609,7 @@ private:
        {
                list<shared_ptr<Job> > jobs = JobManager::instance()->get ();
                list<shared_ptr<Job> >::iterator i = jobs.begin();
-               while (i != jobs.end() && dynamic_pointer_cast<TranscodeJob> (*i) == 0) {
+               while (i != jobs.end() && (*i)->json_name() != "transcode") {
                        ++i;
                }
                bool const dcp_creation = (i != jobs.end ()) && !(*i)->finished ();
@@ -798,13 +801,17 @@ private:
                wxInitAllImageHandlers ();
 
                wxSplashScreen* splash = 0;
-               if (!Config::have_existing ()) {
-                       wxBitmap bitmap;
-                       boost::filesystem::path p = shared_path () / "splash.png";
-                       if (bitmap.LoadFile (std_to_wx (p.string ()), wxBITMAP_TYPE_PNG)) {
-                               splash = new wxSplashScreen (bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, 0, -1);
-                               wxYield ();
+               try {
+                       if (!Config::have_existing ()) {
+                               wxBitmap bitmap;
+                               boost::filesystem::path p = shared_path () / "splash.png";
+                               if (bitmap.LoadFile (std_to_wx (p.string ()), wxBITMAP_TYPE_PNG)) {
+                                       splash = new wxSplashScreen (bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, 0, -1);
+                                       wxYield ();
+                               }
                        }
+               } catch (boost::filesystem::filesystem_error& e) {
+                       /* Maybe we couldn't find the splash image; never mind */
                }
 
                SetAppName (_("DCP-o-matic"));
@@ -916,9 +923,22 @@ private:
                try {
                        throw;
                } catch (FileError& e) {
-                       error_dialog (0, wxString::Format (_("An exception occurred: %s (%s).\n\n" + REPORT_PROBLEM), e.what(), e.file().string().c_str ()));
+                       error_dialog (
+                               0,
+                               wxString::Format (
+                                       _("An exception occurred: %s (%s)\n\n") + REPORT_PROBLEM,
+                                       std_to_wx (e.what()),
+                                       std_to_wx (e.file().string().c_str ())
+                                       )
+                               );
                } catch (exception& e) {
-                       error_dialog (0, wxString::Format (_("An exception occurred: %s.\n\n"), e.what ()) + "  " + REPORT_PROBLEM);
+                       error_dialog (
+                               0,
+                               wxString::Format (
+                                       _("An exception occurred: %s.\n\n") + " " + REPORT_PROBLEM,
+                                       std_to_wx (e.what ())
+                                       )
+                               );
                } catch (...) {
                        error_dialog (0, _("An unknown exception occurred.") + "  " + REPORT_PROBLEM);
                }