Various work on certificate handling for screens; need XML config here, now.
[dcpomatic.git] / src / tools / dvdomatic.cc
index 993c41563ba1be47dcfbfcf7e38460e3fac5756e..b6662f281d2f9fa777ead37bc233637aeaf3deb4 100644 (file)
@@ -31,6 +31,7 @@
 #include "wx/new_film_dialog.h"
 #include "wx/properties_dialog.h"
 #include "wx/wx_ui_signaller.h"
+#include "wx/kdm_dialog.h"
 #include "lib/film.h"
 #include "lib/format.h"
 #include "lib/config.h"
@@ -137,6 +138,7 @@ enum {
        ID_file_quit,
        ID_edit_preferences,
        ID_jobs_make_dcp,
+       ID_jobs_make_kdms,
        ID_jobs_send_dcp_to_tms,
        ID_jobs_examine_content,
        ID_jobs_make_dcp_from_existing_transcode,
@@ -161,6 +163,7 @@ setup_menu (wxMenuBar* m)
 
        wxMenu* jobs = new wxMenu;
        add_item (jobs, "&Make DCP", ID_jobs_make_dcp, NEEDS_FILM);
+       add_item (jobs, "Make &KDMs...", ID_jobs_make_kdms, NEEDS_FILM);
        add_item (jobs, "&Send DCP to TMS", ID_jobs_send_dcp_to_tms, NEEDS_FILM);
        jobs->AppendSeparator ();
        add_item (jobs, "&Examine content", ID_jobs_examine_content, NEEDS_FILM);
@@ -199,6 +202,7 @@ public:
                Connect (ID_file_quit, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::file_quit));
                Connect (ID_edit_preferences, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::edit_preferences));
                Connect (ID_jobs_make_dcp, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_make_dcp));
+               Connect (ID_jobs_make_kdms, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_make_kdms));
                Connect (ID_jobs_send_dcp_to_tms, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_send_dcp_to_tms));
                Connect (ID_jobs_examine_content, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_examine_content));
                Connect (ID_jobs_make_dcp_from_existing_transcode, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_make_dcp_from_existing_transcode));
@@ -226,7 +230,6 @@ public:
 
                /* XXX: calling these here is a bit of a hack */
                film_editor->setup_visibility ();
-               film_viewer->setup_visibility ();
                
                film_editor->FileChanged.connect (bind (&Frame::file_changed, this, _1));
                if (film) {
@@ -289,9 +292,13 @@ public:
                
                if (r == wxID_OK) {
                        maybe_save_then_delete_film ();
-                       film.reset (new Film (wx_to_std (c->GetPath ())));
-                       film->log()->set_level (log_level);
-                       set_film ();
+                       try {
+                               film.reset (new Film (wx_to_std (c->GetPath ())));
+                               film->log()->set_level (log_level);
+                               set_film ();
+                       } catch (std::exception& e) {
+                               error_dialog (this, String::compose ("Could not open film at %1 (%2)", wx_to_std (c->GetPath()), e.what()));
+                       }
                }
 
                c->Destroy ();
@@ -327,6 +334,25 @@ public:
        {
                JobWrapper::make_dcp (this, film, true);
        }
+
+       void jobs_make_kdms (wxCommandEvent &)
+       {
+               if (!film) {
+                       return;
+               }
+               
+               KDMDialog* d = new KDMDialog (this);
+               if (d->ShowModal () == wxID_OK) {
+                       film->make_kdms (
+                               d->screens (),
+                               d->from (),
+                               d->until (),
+                               d->directory ()
+                               );
+               }
+               
+               d->Destroy ();
+       }
        
        void jobs_make_dcp_from_existing_transcode (wxCommandEvent &)
        {
@@ -347,7 +373,11 @@ public:
        {
                wxAboutDialogInfo info;
                info.SetName (_("DVD-o-matic"));
-               info.SetVersion (std_to_wx (String::compose ("version %1 git %2", dvdomatic_version, dvdomatic_git_commit)));
+               if (strcmp (dvdomatic_git_commit, "release") == 0) {
+                       info.SetVersion (std_to_wx (String::compose ("version %1", dvdomatic_version)));
+               } else {
+                       info.SetVersion (std_to_wx (String::compose ("version %1 git %2", dvdomatic_version, dvdomatic_git_commit)));
+               }
                info.SetDescription (_("Free, open-source DCP generation from almost anything."));
                info.SetCopyright (_("(C) Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole Laursen"));
                wxArrayString authors;
@@ -365,13 +395,13 @@ public:
 static const wxCmdLineEntryDesc command_line_description[] = {
        { wxCMD_LINE_OPTION, "l", "log", "set log level (silent, verbose or timing)", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
         { wxCMD_LINE_PARAM, 0, 0, "film to load", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL },
-       { wxCMD_LINE_NONE }
+       { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 }
 };
 #else
 static const wxCmdLineEntryDesc command_line_description[] = {
        { wxCMD_LINE_OPTION, wxT("l"), wxT("log"), wxT("set log level (silent, verbose or timing)"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
         { wxCMD_LINE_PARAM, 0, 0, wxT("film to load"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL },
-       { wxCMD_LINE_NONE }
+       { wxCMD_LINE_NONE, wxT(""), wxT(""), wxT(""), wxCmdLineParamType (0), 0 }
 };
 #endif