#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 <dcp/locale_convert.h>
#include <dcp/exceptions.h>
#include <dcp/certificate_chain.h>
-#include <dcp/raw_convert.h>
#include <wx/stdpaths.h>
#include <wx/preferences.h>
#include <wx/spinctrl.h>
using boost::shared_ptr;
using boost::function;
using boost::optional;
+using dcp::locale_convert;
class Page
{
_directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ()));
checked_set (_j2k_bandwidth, config->default_j2k_bandwidth() / 1000000);
_j2k_bandwidth->SetRange (50, config->maximum_j2k_bandwidth() / 1000000);
- checked_set (_dcp_audio_channels, raw_convert<string> (config->default_dcp_audio_channels()));
+ checked_set (_dcp_audio_channels, locale_convert<string> (config->default_dcp_audio_channels()));
checked_set (_audio_delay, config->default_audio_delay ());
checked_set (_standard, config->default_interop() ? 1 : 0);
}
{
int const s = _dcp_audio_channels->GetSelection ();
if (s != wxNOT_FOUND) {
- Config::instance()->set_default_dcp_audio_channels (dcp::raw_convert<int> (string_client_data (_dcp_audio_channels->GetClientObject (s))));
+ Config::instance()->set_default_dcp_audio_channels (
+ locale_convert<int> (string_client_data (_dcp_audio_channels->GetClientObject (s)))
+ );
}
}
columns,
boost::bind (&Config::servers, Config::instance()),
boost::bind (&Config::set_servers, Config::instance(), _1),
- boost::bind (&always_valid),
boost::bind (&EncodingServersPage::server_column, this, _1)
);
++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;
void add_button (wxWindow* button)
{
- _button_sizer->Add (button);
+ _button_sizer->Add (button, 0, wxLEFT | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
_sizer->Layout ();
}
if (d->ShowModal() == wxID_OK) {
try {
- dcp::Certificate c (dcp::file_to_string (wx_to_std (d->GetPath ())));
- if (c.extra_data ()) {
+ dcp::Certificate c;
+ string const extra = c.read_string (dcp::file_to_string (wx_to_std (d->GetPath ())));
+ if (!extra.empty ()) {
message_dialog (
this,
_("This file contains other certificates (or other data) after its first certificate. "
if (d->ShowModal () == wxID_OK) {
FILE* f = fopen_boost (wx_to_std (d->GetPath ()), "w");
if (!f) {
- throw OpenFileError (wx_to_std (d->GetPath ()));
+ throw OpenFileError (wx_to_std (d->GetPath ()), errno, false);
}
string const s = j->certificate (true);
if (d->ShowModal () == wxID_OK) {
FILE* f = fopen_boost (wx_to_std (d->GetPath ()), "w");
if (!f) {
- throw OpenFileError (wx_to_std (d->GetPath ()));
+ throw OpenFileError (wx_to_std (d->GetPath ()), errno, false);
}
string const s = _chain->key().get ();
_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 ()
if (d->ShowModal () == wxID_OK) {
FILE* f = fopen_boost (wx_to_std (d->GetPath ()), "w");
if (!f) {
- throw OpenFileError (wx_to_std (d->GetPath ()));
+ throw OpenFileError (wx_to_std (d->GetPath ()), errno, false);
}
string const s = Config::instance()->decryption_chain()->leaf().certificate (true);
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 ()), errno, false);
+ }
+
+ 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 ();
CertificateChainEditor* _signer;
CertificateChainEditor* _decryption;
wxButton* _export_decryption_certificate;
+ wxButton* _export_decryption_chain;
};
class TMSPage : public StandardPage
columns,
bind (&Config::kdm_cc, Config::instance()),
bind (&Config::set_kdm_cc, Config::instance(), _1),
- bind (&string_not_empty, _1),
bind (&column, _1)
);
table->Add (_kdm_cc, 1, wxEXPAND | wxALL);
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);
+ _dcp_metadata_filename_format = new NameFormatEditor (
+ _panel, Config::instance()->dcp_metadata_filename_format(), titles, examples, "_eb1c112c-ca3c-4ae6-9263-c6714ff05d64.xml"
+ );
table->Add (_dcp_metadata_filename_format->panel(), 1, wxEXPAND | wxALL);
}
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);
+ _dcp_asset_filename_format = new NameFormatEditor (
+ _panel, Config::instance()->dcp_asset_filename_format(), titles, examples, "_eb1c112c-ca3c-4ae6-9263-c6714ff05d64.mxf"
+ );
table->Add (_dcp_asset_filename_format->panel(), 1, wxEXPAND | wxALL);
}