From: Carl Hetherington Date: Tue, 7 Mar 2017 10:18:31 +0000 (+0000) Subject: Merge. X-Git-Tag: v2.11.1~152 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=e340b96b4a33725e70e3703b0c60ba8da95bca3b;hp=-c Merge. --- e340b96b4a33725e70e3703b0c60ba8da95bca3b diff --combined ChangeLog index f7e10cc3e,5e38fc742..19cd66c71 --- a/ChangeLog +++ b/ChangeLog @@@ -1,7 -1,8 +1,12 @@@ +2017-03-07 Carl Hetherington + + * Handle failure to write to cinemas file more nicely. + + 2017-03-03 Carl Hetherington + + * Add option to write KDMs to separate folders + or ZIP files. + 2017-02-28 Carl Hetherington * Updated de_DE translation from Carsten Kurz. diff --combined src/lib/config.cc index 6a08125cf,a7ef7d2a5..f41d40e09 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@@ -111,6 -111,7 +111,7 @@@ Config::set_defaults ( _cinemas_file = path ("cinemas.xml"); _show_hints_before_make_dcp = true; _confirm_kdm_email = true; + _kdm_container_name_format = dcp::NameFormat ("KDM %f %c"); _kdm_filename_format = dcp::NameFormat ("KDM %f %c %s"); _dcp_metadata_filename_format = dcp::NameFormat ("%t"); _dcp_asset_filename_format = dcp::NameFormat ("%t"); @@@ -302,6 -303,7 +303,7 @@@ tr _cinemas_file = f.optional_string_child("CinemasFile").get_value_or (path ("cinemas.xml").string ()); _show_hints_before_make_dcp = f.optional_bool_child("ShowHintsBeforeMakeDCP").get_value_or (true); _confirm_kdm_email = f.optional_bool_child("ConfirmKDMEmail").get_value_or (true); + _kdm_container_name_format = dcp::NameFormat (f.optional_string_child("KDMContainerNameFormat").get_value_or ("KDM %f %c")); _kdm_filename_format = dcp::NameFormat (f.optional_string_child("KDMFilenameFormat").get_value_or ("KDM %f %c %s")); _dcp_metadata_filename_format = dcp::NameFormat (f.optional_string_child("DCPMetadataFilenameFormat").get_value_or ("%t")); _dcp_asset_filename_format = dcp::NameFormat (f.optional_string_child("DCPAssetFilenameFormat").get_value_or ("%t")); @@@ -366,12 -368,12 +368,12 @@@ Config::instance ( void Config::write () const { - write_config_xml (); - write_cinemas_xml (); + write_config (); + write_cinemas (); } void -Config::write_config_xml () const +Config::write_config () const { xmlpp::Document doc; xmlpp::Element* root = doc.create_root_node ("Config"); @@@ -469,6 -471,7 +471,7 @@@ root->add_child("ShowHintsBeforeMakeDCP")->add_child_text (_show_hints_before_make_dcp ? "1" : "0"); root->add_child("ConfirmKDMEmail")->add_child_text (_confirm_kdm_email ? "1" : "0"); root->add_child("KDMFilenameFormat")->add_child_text (_kdm_filename_format.specification ()); + root->add_child("KDMContainerNameFormat")->add_child_text (_kdm_container_name_format.specification ()); root->add_child("DCPMetadataFilenameFormat")->add_child_text (_dcp_metadata_filename_format.specification ()); root->add_child("DCPAssetFilenameFormat")->add_child_text (_dcp_asset_filename_format.specification ()); @@@ -482,7 -485,7 +485,7 @@@ } void -Config::write_cinemas_xml () const +Config::write_cinemas () const { xmlpp::Document doc; xmlpp::Element* root = doc.create_root_node ("Cinemas"); diff --combined src/lib/config.h index 1bdbcb96e,5bd8df97d..c02b12eb5 --- a/src/lib/config.h +++ b/src/lib/config.h @@@ -66,7 -66,6 +66,7 @@@ public enum Property { USE_ANY_SERVERS, SERVERS, + CINEMAS, OTHER }; @@@ -286,6 -285,10 +286,10 @@@ return _confirm_kdm_email; } + dcp::NameFormat kdm_container_name_format () const { + return _kdm_container_name_format; + } + dcp::NameFormat kdm_filename_format () const { return _kdm_filename_format; } @@@ -346,12 -349,12 +350,12 @@@ void add_cinema (boost::shared_ptr c) { _cinemas.push_back (c); - changed (); + changed (CINEMAS); } void remove_cinema (boost::shared_ptr c) { _cinemas.remove (c); - changed (); + changed (CINEMAS); } void set_allowed_dcp_frame_rates (std::list const & r) { @@@ -513,6 -516,10 +517,10 @@@ maybe_set (_confirm_kdm_email, s); } + void set_kdm_container_name_format (dcp::NameFormat n) { + maybe_set (_kdm_container_name_format, n); + } + void set_kdm_filename_format (dcp::NameFormat n) { maybe_set (_kdm_filename_format, n); } @@@ -540,8 -547,6 +548,8 @@@ static boost::signals2::signal FailedToLoad; void write () const; + void write_config () const; + void write_cinemas () const; void save_template (boost::shared_ptr film, std::string name) const; bool existing_template (std::string name) const; @@@ -561,6 -566,8 +569,6 @@@ private void read (); void set_defaults (); void set_kdm_email_to_default (); - void write_config_xml () const; - void write_cinemas_xml () const; void read_cinemas (cxml::Document const & f); boost::shared_ptr create_certificate_chain (); boost::filesystem::path directory_or (boost::optional dir, boost::filesystem::path a) const; @@@ -650,6 -657,7 +658,7 @@@ bool _show_hints_before_make_dcp; bool _confirm_kdm_email; dcp::NameFormat _kdm_filename_format; + dcp::NameFormat _kdm_container_name_format; dcp::NameFormat _dcp_metadata_filename_format; dcp::NameFormat _dcp_asset_filename_format; diff --combined src/tools/dcpomatic.cc index d091512a0,19e770718..92de9a1f0 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@@ -61,6 -61,7 +61,7 @@@ #include "lib/cinema_kdms.h" #include "lib/dcpomatic_socket.h" #include "lib/hints.h" + #include "lib/dcp_content.h" #include #include #include @@@ -214,8 -215,8 +215,8 @@@ public SetIcon (wxIcon (std_to_wx ("id"))); #endif - _config_changed_connection = Config::instance()->Changed.connect (boost::bind (&DOMFrame::config_changed, this)); - config_changed (); + _config_changed_connection = Config::instance()->Changed.connect (boost::bind (&DOMFrame::config_changed, this, _1)); + config_changed (Config::OTHER); Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_new, this), ID_file_new); Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_open, this), ID_file_open); @@@ -277,6 -278,9 +278,6 @@@ wxAcceleratorTable accel_table (2, accel); SetAcceleratorTable (accel_table); - /* Instantly save any config changes when using the DCP-o-matic GUI */ - Config::instance()->Changed.connect (boost::bind (&Config::write, Config::instance ())); - UpdateChecker::instance()->StateChanged.connect (boost::bind (&DOMFrame::update_checker_state_changed, this)); } @@@ -922,35 -926,8 +923,35 @@@ private m->Append (help, _("&Help")); } - void config_changed () + void config_changed (Config::Property what) { + /* Instantly save any config changes when using the DCP-o-matic GUI */ + if (what == Config::CINEMAS) { + try { + Config::instance()->write_cinemas(); + } catch (exception& e) { + error_dialog ( + this, + wxString::Format ( + _("Could not write to cinemas file at %s. Your changes have not been saved."), + std_to_wx (Config::instance()->cinemas_file().string()).data() + ) + ); + } + } else { + try { + Config::instance()->write_config(); + } catch (exception& e) { + error_dialog ( + this, + wxString::Format ( + _("Could not write to config file at %s. Your changes have not been saved."), + std_to_wx (Config::instance()->cinemas_file().string()).data() + ) + ); + } + } + for (int i = 0; i < _history_items; ++i) { delete _file_menu->Remove (ID_file_history + i); } @@@ -1029,7 -1006,8 +1030,8 @@@ static const wxCmdLineEntryDesc command_line_description[] = { { wxCMD_LINE_SWITCH, "n", "new", "create new film", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, - { wxCMD_LINE_OPTION, "c", "content", "add content file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_OPTION, "c", "content", "add content file / directory", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_OPTION, "d", "dcp", "add content DCP", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_PARAM, 0, 0, "film to load or create", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 } }; @@@ -1127,6 -1105,9 +1129,9 @@@ private _frame->film()->examine_and_add_content (i); } } + if (!_dcp_to_add.empty ()) { + _frame->film()->examine_and_add_content (shared_ptr (new DCPContent (_frame->film(), _dcp_to_add))); + } } signal_manager = new wxSignalManager (this); @@@ -1169,6 -1150,11 +1174,11 @@@ _content_to_add = wx_to_std (content); } + wxString dcp; + if (parser.Found (wxT ("dcp"), &dcp)) { + _dcp_to_add = wx_to_std (dcp); + } + return true; } @@@ -1235,6 -1221,7 +1245,7 @@@ string _film_to_load; string _film_to_create; string _content_to_add; + string _dcp_to_add; }; IMPLEMENT_APP (App)