More capitalisation fixes.
[dcpomatic.git] / src / tools / dcpomatic.cc
index 8fc5f240b9a427a651529235eb1cd54d8ca45de4..4814d08a4f1a896133f61d48b11705574eb271dd 100644 (file)
@@ -57,7 +57,6 @@
 #include "lib/cinema_kdms.h"
 #include "lib/dcpomatic_socket.h"
 #include <dcp/exceptions.h>
-#include <dcp/raw_convert.h>
 #include <wx/generic/aboutdlgg.h>
 #include <wx/stdpaths.h>
 #include <wx/cmdline.h>
@@ -90,7 +89,6 @@ using std::list;
 using std::exception;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
-using dcp::raw_convert;
 
 class FilmChangedDialog
 {
@@ -153,7 +151,8 @@ enum {
        ID_tools_restore_default_preferences,
        ID_help_report_a_problem,
        /* IDs for shortcuts (with no associated menu item) */
-       ID_add_file
+       ID_add_file,
+       ID_remove
 };
 
 class DOMFrame : public wxFrame
@@ -248,10 +247,12 @@ public:
 
                overall_panel->SetSizer (main_sizer);
 
-               wxAcceleratorEntry accel[1];
+               wxAcceleratorEntry accel[2];
                accel[0].Set (wxACCEL_CTRL, static_cast<int>('A'), ID_add_file);
+               accel[1].Set (wxACCEL_NORMAL, WXK_DELETE, ID_remove);
                Bind (wxEVT_MENU, boost::bind (&ContentPanel::add_file_clicked, _film_editor->content_panel()), ID_add_file);
-               wxAcceleratorTable accel_table (1, accel);
+               Bind (wxEVT_MENU, boost::bind (&ContentPanel::remove_clicked, _film_editor->content_panel(), true), ID_remove);
+               wxAcceleratorTable accel_table (2, accel);
                SetAcceleratorTable (accel_table);
 
                /* Instantly save any config changes when using the DCP-o-matic GUI */
@@ -497,16 +498,15 @@ private:
 
                /* i = 0; try to connect via socket
                   i = 1; try again, and then try to start the batch converter
-                  i = 2; try again.
-                  i = 3; try again.
+                  i = 2 onwards; try again.
                */
-               for (int i = 0; i < 4; ++i) {
+               for (int i = 0; i < 8; ++i) {
                        try {
                                boost::asio::io_service io_service;
                                boost::asio::ip::tcp::resolver resolver (io_service);
                                boost::asio::ip::tcp::resolver::query query ("127.0.0.1", raw_convert<string> (Config::instance()->server_port_base() + 2));
                                boost::asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve (query);
-                               Socket socket (1);
+                               Socket socket (5);
                                socket.connect (*endpoint_iterator);
                                string s = _film->directory().string ();
                                socket.write (s.length() + 1);
@@ -516,7 +516,7 @@ private:
                                socket.read (ok, 3);
                                return;
                        } catch (exception& e) {
-                               std::cout << "start batch failed: " << e.what() << "\n";
+
                        }
 
                        if (i == 1) {
@@ -542,17 +542,19 @@ private:
                }
 
                try {
-                       dcp::EncryptedKDM kdm = _film->make_kdm (
-                               Config::instance()->decryption_chain()->leaf(),
-                               vector<dcp::Certificate> (),
-                               d->cpl (),
-                               dcp::LocalTime ("2012-01-01T01:00:00+00:00"),
-                               dcp::LocalTime ("2112-01-01T01:00:00+00:00"),
-                               dcp::MODIFIED_TRANSITIONAL_1
+                       vector<dcp::EncryptedKDM> dkdms = Config::instance()->dkdms ();
+                       dkdms.push_back (
+                               _film->make_kdm (
+                                       Config::instance()->decryption_chain()->leaf(),
+                                       vector<dcp::Certificate> (),
+                                       d->cpl (),
+                                       dcp::LocalTime ("2012-01-01T01:00:00+00:00"),
+                                       dcp::LocalTime ("2112-01-01T01:00:00+00:00"),
+                                       dcp::MODIFIED_TRANSITIONAL_1
+                                       )
                                );
 
-                       string const name = tidy_for_filename(_film->name()) + "_DKDM.kdm.xml";
-                       kdm.as_xml (d->directory() / name);
+                       Config::instance()->set_dkdms (dkdms);
                } catch (dcp::NotEncryptedError& e) {
                        error_dialog (this, _("CPL's content is not encrypted."));
                } catch (exception& e) {
@@ -931,7 +933,7 @@ private:
 
                wxSplashScreen* splash = 0;
                try {
-                       if (!Config::have_existing ()) {
+                       if (!Config::have_existing ("config.xml")) {
                                wxBitmap bitmap;
                                boost::filesystem::path p = shared_path () / "splash.png";
                                if (bitmap.LoadFile (std_to_wx (p.string ()), wxBITMAP_TYPE_PNG)) {
@@ -1062,7 +1064,7 @@ private:
                        error_dialog (
                                0,
                                wxString::Format (
-                                       _("An exception occurred: %s.\n\n") + " " + REPORT_PROBLEM,
+                                       _("An exception occurred: %s.\n\n") + REPORT_PROBLEM,
                                        std_to_wx (e.what ())
                                        )
                                );