X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fconfig_dialog.cc;h=0098ecb2bb9e7dfd82d8d0bbb2a5b716c7e8d305;hb=73654117144c6de0ec4efe39ddc88485df546cc9;hp=a68f4576dc69f50a5955f64ed1e94bdf8c8383fd;hpb=fbe2784c136fa1550815babfce89589f66b35a29;p=dcpomatic.git diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index a68f4576d..0098ecb2b 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -39,12 +39,11 @@ #include "lib/dcp_content_type.h" #include "lib/log.h" #include "lib/util.h" -#include "lib/raw_convert.h" #include "lib/cross.h" #include "lib/exceptions.h" +#include #include #include -#include #include #include #include @@ -64,6 +63,7 @@ using boost::bind; using boost::shared_ptr; using boost::function; using boost::optional; +using dcp::raw_convert; class Page { @@ -732,7 +732,7 @@ public: ++r; _button_sizer = new wxBoxSizer (wxHORIZONTAL); - _remake_certificates = new wxButton (this, wxID_ANY, _("Re-make certificates and key...")); + _remake_certificates = new wxButton (this, wxID_ANY, _("Re-make certificates\nand key...")); _button_sizer->Add (_remake_certificates, 1, wxRIGHT, border); table->Add (_button_sizer, wxGBPosition (r, 0), wxGBSpan (1, 4)); ++r; @@ -760,7 +760,7 @@ public: void add_button (wxWindow* button) { - _button_sizer->Add (button); + _button_sizer->Add (button, 0, wxLEFT | wxRIGHT, DCPOMATIC_SIZER_X_GAP); _sizer->Layout (); } @@ -1039,10 +1039,13 @@ private: _panel->GetSizer()->Add (_decryption); - _export_decryption_certificate = new wxButton (_decryption, wxID_ANY, _("Export DCP decryption certificate...")); + _export_decryption_certificate = new wxButton (_decryption, wxID_ANY, _("Export DCP decryption\ncertificate...")); _decryption->add_button (_export_decryption_certificate); + _export_decryption_chain = new wxButton (_decryption, wxID_ANY, _("Export DCP decryption\nchain...")); + _decryption->add_button (_export_decryption_chain); _export_decryption_certificate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::export_decryption_certificate, this)); + _export_decryption_chain->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::export_decryption_chain, this)); } void export_decryption_certificate () @@ -1065,6 +1068,26 @@ private: d->Destroy (); } + void export_decryption_chain () + { + wxFileDialog* d = new wxFileDialog ( + _panel, _("Select Chain File"), wxEmptyString, wxEmptyString, wxT ("PEM files (*.pem)|*.pem"), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT + ); + + if (d->ShowModal () == wxID_OK) { + FILE* f = fopen_boost (wx_to_std (d->GetPath ()), "w"); + if (!f) { + throw OpenFileError (wx_to_std (d->GetPath ())); + } + + string const s = Config::instance()->decryption_chain()->chain(); + fwrite (s.c_str(), 1, s.length(), f); + fclose (f); + } + d->Destroy (); + } + void config_changed () { _signer->config_changed (); @@ -1074,6 +1097,7 @@ private: CertificateChainEditor* _signer; CertificateChainEditor* _decryption; wxButton* _export_decryption_certificate; + wxButton* _export_decryption_chain; }; class TMSPage : public StandardPage @@ -1376,6 +1400,17 @@ public: {} private: + void add_top_aligned_label_to_sizer (wxSizer* table, wxWindow* parent, wxString text) + { + int flags = wxALIGN_TOP | wxTOP | wxLEFT; +#ifdef __WXOSX__ + flags |= wxALIGN_RIGHT; + text += wxT (":"); +#endif + wxStaticText* m = new wxStaticText (parent, wxID_ANY, text); + table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP); + } + void setup () { wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); @@ -1400,34 +1435,39 @@ private: table->AddSpacer (0); { - int flags = wxALIGN_TOP | wxTOP | wxLEFT; - wxString t = _("DCP filename format"); -#ifdef __WXOSX__ - flags |= wxALIGN_RIGHT; - t += wxT (":"); -#endif - wxStaticText* m = new wxStaticText (_panel, wxID_ANY, t); - table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP); + add_top_aligned_label_to_sizer (table, _panel, _("DCP metadata filename format")); + dcp::NameFormat::Map titles; + titles['t'] = "type (cpl/pkl)"; + titles['i'] = "unique ID"; + titles['c'] = "content filename"; + dcp::NameFormat::Map examples; + examples['t'] = "cpl"; + examples['i'] = "eb1c112c-ca3c-4ae6-9263-c6714ff05d64"; + examples['c'] = "myfile.mp4"; + _dcp_metadata_filename_format = new NameFormatEditor (_panel, Config::instance()->dcp_metadata_filename_format(), titles, examples); + table->Add (_dcp_metadata_filename_format->panel(), 1, wxEXPAND | wxALL); } - dcp::NameFormat::Map titles; - titles['t'] = "type (j2c/pcm/sub/cpl/pkl)"; - titles['i'] = "unique ID"; - dcp::NameFormat::Map examples; - examples['t'] = "j2c"; - examples['i'] = "eb1c112c-ca3c-4ae6-9263-c6714ff05d64"; - _dcp_filename_format = new NameFormatEditor (_panel, Config::instance()->dcp_filename_format(), titles, examples); - table->Add (_dcp_filename_format->panel(), 1, wxEXPAND | wxALL); - -#ifdef __WXOSX__ - wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Log:")); - table->Add (m, 0, wxALIGN_TOP | wxLEFT | wxRIGHT | wxEXPAND | wxALL | wxALIGN_RIGHT, 6); -#else - wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Log")); - table->Add (m, 0, wxALIGN_TOP | wxLEFT | wxRIGHT | wxEXPAND | wxALL, 6); -#endif + { + add_top_aligned_label_to_sizer (table, _panel, _("DCP asset filename format")); + dcp::NameFormat::Map titles; + titles['t'] = "type (j2c/pcm/sub)"; + titles['i'] = "unique ID"; + titles['r'] = "reel number"; + titles['n'] = "number of reels"; + titles['c'] = "content filename"; + dcp::NameFormat::Map examples; + examples['t'] = "j2c"; + examples['i'] = "eb1c112c-ca3c-4ae6-9263-c6714ff05d64"; + examples['r'] = "1"; + examples['n'] = "4"; + examples['c'] = "myfile.mp4"; + _dcp_asset_filename_format = new NameFormatEditor (_panel, Config::instance()->dcp_asset_filename_format(), titles, examples); + table->Add (_dcp_asset_filename_format->panel(), 1, wxEXPAND | wxALL); + } { + add_top_aligned_label_to_sizer (table, _panel, _("Log")); wxBoxSizer* t = new wxBoxSizer (wxVERTICAL); _log_general = new wxCheckBox (_panel, wxID_ANY, _("General")); t->Add (_log_general, 1, wxEXPAND | wxALL); @@ -1457,7 +1497,8 @@ private: _maximum_j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&AdvancedPage::maximum_j2k_bandwidth_changed, this)); _allow_any_dcp_frame_rate->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::allow_any_dcp_frame_rate_changed, this)); _only_servers_encode->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::only_servers_encode_changed, this)); - _dcp_filename_format->Changed.connect (boost::bind (&AdvancedPage::dcp_filename_format_changed, this)); + _dcp_metadata_filename_format->Changed.connect (boost::bind (&AdvancedPage::dcp_metadata_filename_format_changed, this)); + _dcp_asset_filename_format->Changed.connect (boost::bind (&AdvancedPage::dcp_asset_filename_format_changed, this)); _log_general->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this)); _log_warning->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this)); _log_error->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this)); @@ -1504,9 +1545,14 @@ private: Config::instance()->set_only_servers_encode (_only_servers_encode->GetValue ()); } - void dcp_filename_format_changed () + void dcp_metadata_filename_format_changed () + { + Config::instance()->set_dcp_metadata_filename_format (_dcp_metadata_filename_format->get ()); + } + + void dcp_asset_filename_format_changed () { - Config::instance()->set_dcp_filename_format (_dcp_filename_format->get ()); + Config::instance()->set_dcp_asset_filename_format (_dcp_asset_filename_format->get ()); } void log_changed () @@ -1546,7 +1592,8 @@ private: wxSpinCtrl* _maximum_j2k_bandwidth; wxCheckBox* _allow_any_dcp_frame_rate; wxCheckBox* _only_servers_encode; - NameFormatEditor* _dcp_filename_format; + NameFormatEditor* _dcp_metadata_filename_format; + NameFormatEditor* _dcp_asset_filename_format; wxCheckBox* _log_general; wxCheckBox* _log_warning; wxCheckBox* _log_error;