* @brief A dialogue to edit DCP-o-matic configuration.
*/
-#include <iostream>
-#include <boost/lexical_cast.hpp>
-#include <boost/filesystem.hpp>
-#include <wx/stdpaths.h>
-#include <wx/preferences.h>
-#include <wx/filepicker.h>
-#include <wx/spinctrl.h>
-#include <dcp/exceptions.h>
-#include <dcp/signer.h>
-#include "lib/config.h"
-#include "lib/ratio.h"
-#include "lib/filter.h"
-#include "lib/dcp_content_type.h"
-#include "lib/log.h"
-#include "lib/util.h"
-#include "lib/cross.h"
-#include "lib/exceptions.h"
#include "config_dialog.h"
#include "wx_util.h"
#include "editable_list.h"
#include "isdcf_metadata_dialog.h"
#include "server_dialog.h"
#include "make_signer_chain_dialog.h"
+#include "lib/config.h"
+#include "lib/ratio.h"
+#include "lib/filter.h"
+#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/exceptions.h>
+#include <dcp/certificate_chain.h>
+#include <wx/stdpaths.h>
+#include <wx/preferences.h>
+#include <wx/filepicker.h>
+#include <wx/spinctrl.h>
+#include <boost/lexical_cast.hpp>
+#include <boost/filesystem.hpp>
+#include <iostream>
using std::vector;
using std::string;
_language->Append (wxT ("Nederlands"));
_language->Append (wxT ("Svenska"));
_language->Append (wxT ("Русский"));
+ _language->Append (wxT ("Polski"));
+ _language->Append (wxT ("Danske"));
table->Add (_language);
wxStaticText* restart = add_label_to_sizer (table, _panel, _("(restart DCP-o-matic to see language changes)"), false);
checked_set (_set_language, config->language ());
if (config->language().get_value_or ("") == "fr") {
- _language->SetSelection (3);
+ checked_set (_language, 3);
} else if (config->language().get_value_or ("") == "it") {
- _language->SetSelection (4);
+ checked_set (_language, 4);
} else if (config->language().get_value_or ("") == "es") {
- _language->SetSelection (2);
+ checked_set (_language, 2);
} else if (config->language().get_value_or ("") == "sv") {
- _language->SetSelection (6);
+ checked_set (_language, 6);
} else if (config->language().get_value_or ("") == "de") {
- _language->SetSelection (0);
+ checked_set (_language, 0);
} else if (config->language().get_value_or ("") == "nl") {
- _language->SetSelection (5);
+ checked_set (_language, 5);
} else if (config->language().get_value_or ("") == "ru") {
- _language->SetSelection (7);
+ checked_set (_language, 7);
+ } else if (config->language().get_value_or ("") == "pl") {
+ checked_set (_language, 8);
+ } else if (config->language().get_value_or ("") == "da") {
+ checked_set (_language, 9);
} else {
_language->SetSelection (1);
}
case 7:
Config::instance()->set_language ("ru");
break;
+ case 8:
+ Config::instance()->set_language ("pl");
+ break;
+ case 9:
+ Config::instance()->set_language ("da");
+ break;
}
}
private:
void setup ()
{
- wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Certificate chain for signing DCPs and KDMs:"));
- _panel->GetSizer()->Add (m, 0, wxALL, _border);
+ wxFont subheading_font (*wxNORMAL_FONT);
+ subheading_font.SetWeight (wxFONTWEIGHT_BOLD);
+
+ {
+ wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Signing DCPs and KDMs"));
+ m->SetFont (subheading_font);
+ _panel->GetSizer()->Add (m, 0, wxALL, _border);
+ }
wxBoxSizer* certificates_sizer = new wxBoxSizer (wxHORIZONTAL);
_panel->GetSizer()->Add (certificates_sizer, 0, wxLEFT | wxRIGHT, _border);
int r = 0;
- _remake_certificates = new wxButton (_panel, wxID_ANY, _("Re-make certificates..."));
- table->Add (_remake_certificates, wxGBPosition (r, 0), wxGBSpan (1, 3));
- ++r;
-
- add_label_to_grid_bag_sizer (table, _panel, _("Private key for leaf certificate"), true, wxGBPosition (r, 0));
+ add_label_to_grid_bag_sizer (table, _panel, _("Leaf private key"), true, wxGBPosition (r, 0));
_signer_private_key = new wxStaticText (_panel, wxID_ANY, wxT (""));
wxFont font = _signer_private_key->GetFont ();
font.SetFamily (wxFONTFAMILY_TELETYPE);
table->Add (_load_signer_private_key, wxGBPosition (r, 2));
++r;
- add_label_to_grid_bag_sizer (table, _panel, _("Certificate for decrypting DCPs"), true, wxGBPosition (r, 0));
+ _remake_certificates = new wxButton (_panel, wxID_ANY, _("Re-make certificates and key..."));
+ table->Add (_remake_certificates, wxGBPosition (r, 0), wxGBSpan (1, 3));
+ ++r;
+
+ {
+ wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Decrypting DCPs"));
+ m->SetFont (subheading_font);
+ table->Add (m, wxGBPosition (r, 0), wxGBSpan (1, 3), wxTOP, _border * 1.5);
+ ++r;
+ }
+
+ add_label_to_grid_bag_sizer (table, _panel, _("Certificate"), true, wxGBPosition (r, 0));
_decryption_certificate = new wxStaticText (_panel, wxID_ANY, wxT (""));
_decryption_certificate->SetFont (font);
table->Add (_decryption_certificate, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
table->Add (_load_decryption_certificate, wxGBPosition (r, 2));
++r;
- add_label_to_grid_bag_sizer (table, _panel, _("Private key for decrypting DCPs"), true, wxGBPosition (r, 0));
+ add_label_to_grid_bag_sizer (table, _panel, _("Private key"), true, wxGBPosition (r, 0));
_decryption_private_key = new wxStaticText (_panel, wxID_ANY, wxT (""));
_decryption_private_key->SetFont (font);
table->Add (_decryption_private_key, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
void config_changed ()
{
- _signer.reset (new dcp::Signer (*Config::instance()->signer().get ()));
+ _signer.reset (new dcp::CertificateChain (*Config::instance()->signer().get ()));
update_certificate_list ();
update_signer_private_key ();
if (d->ShowModal() == wxID_OK) {
try {
dcp::Certificate c (dcp::file_to_string (wx_to_std (d->GetPath ())));
- _signer->certificates().add (c);
+ _signer->add (c);
Config::instance()->set_signer (_signer);
update_certificate_list ();
} catch (dcp::MiscError& e) {
}
_certificates->DeleteItem (i);
- _signer->certificates().remove (i);
+ _signer->remove (i);
Config::instance()->set_signer (_signer);
update_sensitivity ();
void update_certificate_list ()
{
_certificates->DeleteAllItems ();
- dcp::CertificateChain::List certs = _signer->certificates().root_to_leaf ();
+ dcp::CertificateChain::List certs = _signer->root_to_leaf ();
size_t n = 0;
for (dcp::CertificateChain::List::const_iterator i = certs.begin(); i != certs.end(); ++i) {
wxListItem item;
void remake_certificates ()
{
- MakeSignerChainDialog* d = new MakeSignerChainDialog (_panel);
+ shared_ptr<const dcp::CertificateChain> chain = Config::instance()->signer();
+
+ string intermediate_common_name;
+ if (chain->root_to_leaf().size() >= 3) {
+ dcp::CertificateChain::List all = chain->root_to_leaf ();
+ dcp::CertificateChain::List::iterator i = all.begin ();
+ ++i;
+ intermediate_common_name = i->subject_common_name ();
+ }
+
+ MakeSignerChainDialog* d = new MakeSignerChainDialog (
+ _panel,
+ chain->root().subject_organization_name (),
+ chain->root().subject_organizational_unit_name (),
+ chain->root().subject_common_name (),
+ intermediate_common_name,
+ chain->leaf().subject_common_name ()
+ );
+
if (d->ShowModal () == wxID_OK) {
_signer.reset (
- new dcp::Signer (
+ new dcp::CertificateChain (
openssl_path (),
d->organisation (),
d->organisational_unit (),
void update_signer_private_key ()
{
- checked_set (_signer_private_key, dcp::private_key_fingerprint (_signer->key ()));
+ checked_set (_signer_private_key, dcp::private_key_fingerprint (_signer->key().get ()));
}
void load_signer_private_key ()
wxStaticText* _decryption_private_key;
wxButton* _load_decryption_private_key;
wxButton* _export_decryption_certificate;
- shared_ptr<dcp::Signer> _signer;
+ shared_ptr<dcp::CertificateChain> _signer;
};
class TMSPage : public StandardPage
table->AddGrowableCol (1, 1);
_panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
+ add_label_to_sizer (table, _panel, _("Protocol"), true);
+ _tms_protocol = new wxChoice (_panel, wxID_ANY);
+ table->Add (_tms_protocol, 1, wxEXPAND);
+
add_label_to_sizer (table, _panel, _("IP address"), true);
_tms_ip = new wxTextCtrl (_panel, wxID_ANY);
table->Add (_tms_ip, 1, wxEXPAND);
_tms_password = new wxTextCtrl (_panel, wxID_ANY);
table->Add (_tms_password, 1, wxEXPAND);
+ _tms_protocol->Append (_("SCP (for AAM)"));
+ _tms_protocol->Append (_("FTP (for Dolby)"));
+
+ _tms_protocol->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&TMSPage::tms_protocol_changed, this));
_tms_ip->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TMSPage::tms_ip_changed, this));
_tms_path->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TMSPage::tms_path_changed, this));
_tms_user->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TMSPage::tms_user_changed, this));
{
Config* config = Config::instance ();
+ checked_set (_tms_protocol, config->tms_protocol ());
checked_set (_tms_ip, config->tms_ip ());
checked_set (_tms_path, config->tms_path ());
checked_set (_tms_user, config->tms_user ());
checked_set (_tms_password, config->tms_password ());
}
+ void tms_protocol_changed ()
+ {
+ Config::instance()->set_tms_protocol (static_cast<Protocol> (_tms_protocol->GetSelection ()));
+ }
+
void tms_ip_changed ()
{
Config::instance()->set_tms_ip (wx_to_std (_tms_ip->GetValue ()));
Config::instance()->set_tms_password (wx_to_std (_tms_password->GetValue ()));
}
+ wxChoice* _tms_protocol;
wxTextCtrl* _tms_ip;
wxTextCtrl* _tms_path;
wxTextCtrl* _tms_user;
_panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border);
add_label_to_sizer (table, _panel, _("Outgoing mail server"), true);
- _mail_server = new wxTextCtrl (_panel, wxID_ANY);
- table->Add (_mail_server, 1, wxEXPAND | wxALL);
+ {
+ wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ _mail_server = new wxTextCtrl (_panel, wxID_ANY);
+ s->Add (_mail_server, 1, wxEXPAND | wxALL);
+ add_label_to_sizer (s, _panel, _("port"), false);
+ _mail_port = new wxSpinCtrl (_panel, wxID_ANY);
+ _mail_port->SetRange (0, 65535);
+ s->Add (_mail_port);
+ table->Add (s, 1, wxEXPAND | wxALL);
+ }
add_label_to_sizer (table, _panel, _("Mail user name"), true);
_mail_user = new wxTextCtrl (_panel, wxID_ANY);
_mail_password = new wxTextCtrl (_panel, wxID_ANY);
table->Add (_mail_password, 1, wxEXPAND | wxALL);
- wxStaticText* plain = add_label_to_sizer (table, _panel, _("(password will be stored on disk in plaintext)"), false);
- wxFont font = plain->GetFont();
- font.SetStyle (wxFONTSTYLE_ITALIC);
- font.SetPointSize (font.GetPointSize() - 1);
- plain->SetFont (font);
- table->AddSpacer (0);
-
add_label_to_sizer (table, _panel, _("Subject"), true);
_kdm_subject = new wxTextCtrl (_panel, wxID_ANY);
table->Add (_kdm_subject, 1, wxEXPAND | wxALL);
_panel->GetSizer()->Add (_reset_kdm_email, 0, wxEXPAND | wxALL, _border);
_mail_server->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::mail_server_changed, this));
+ _mail_port->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&KDMEmailPage::mail_port_changed, this));
_mail_user->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::mail_user_changed, this));
_mail_password->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::mail_password_changed, this));
_kdm_subject->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_subject_changed, this));
Config* config = Config::instance ();
checked_set (_mail_server, config->mail_server ());
+ checked_set (_mail_port, config->mail_port ());
checked_set (_mail_user, config->mail_user ());
checked_set (_mail_password, config->mail_password ());
checked_set (_kdm_subject, config->kdm_subject ());
Config::instance()->set_mail_server (wx_to_std (_mail_server->GetValue ()));
}
+ void mail_port_changed ()
+ {
+ Config::instance()->set_mail_port (_mail_port->GetValue ());
+ }
+
void mail_user_changed ()
{
Config::instance()->set_mail_user (wx_to_std (_mail_user->GetValue ()));
}
wxTextCtrl* _mail_server;
+ wxSpinCtrl* _mail_port;
wxTextCtrl* _mail_user;
wxTextCtrl* _mail_password;
wxTextCtrl* _kdm_subject;