using std::exception;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
+using boost::optional;
class FilmChangedDialog : public boost::noncopyable
{
return;
}
+ optional<dcp::EncryptedKDM> kdm;
try {
- 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
- )
+ 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
);
-
- Config::instance()->set_dkdms (dkdms);
} catch (dcp::NotEncryptedError& e) {
error_dialog (this, _("CPL's content is not encrypted."));
} catch (exception& e) {
error_dialog (this, _("An unknown exception occurred."));
}
+ if (kdm) {
+ if (d->internal ()) {
+ vector<dcp::EncryptedKDM> dkdms = Config::instance()->dkdms ();
+ dkdms.push_back (kdm.get());
+ Config::instance()->set_dkdms (dkdms);
+ } else {
+ boost::filesystem::path path = d->directory() / (_film->dcp_name(false) + "_DKDM.xml");
+ kdm->as_xml (path);
+ }
+ }
+
d->Destroy ();
}
#include "lib/film.h"
#include "lib/screen.h"
#include <libcxml/cxml.h>
+#ifdef DCPOMATIC_USE_OWN_PICKER
+#include "dir_picker_ctrl.h"
+#else
+#include <wx/filepicker.h>
+#endif
#include <wx/treectrl.h>
#include <wx/listctrl.h>
#include <wx/stdpaths.h>
using std::vector;
using std::make_pair;
using boost::shared_ptr;
+using boost::bind;
SelfDKDMDialog::SelfDKDMDialog (wxWindow* parent, boost::shared_ptr<const Film> film)
: wxDialog (parent, wxID_ANY, _("Make DKDM for DCP-o-matic"))
_cpl = new KDMCPLPanel (this, film->cpls ());
vertical->Add (_cpl);
+ /* Sub-heading: output */
+ h = new wxStaticText (this, wxID_ANY, _("Output"));
+ h->SetFont (subheading_font);
+ vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2);
+
+ _internal = new wxRadioButton (this, wxID_ANY, _("Save to KDM creator tool's list"));
+ vertical->Add (_internal, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP);
+
+ wxBoxSizer* w = new wxBoxSizer (wxHORIZONTAL);
+
+ _write_to = new wxRadioButton (this, wxID_ANY, _("Write to"));
+ w->Add (_write_to, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, DCPOMATIC_SIZER_GAP);
+
+#ifdef DCPOMATIC_USE_OWN_PICKER
+ _folder = new DirPickerCtrl (this);
+#else
+ _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1));
+#endif
+
+ _folder->SetPath (wxStandardPaths::Get().GetDocumentsDir());
+
+ w->Add (_folder, 1, wxEXPAND);
+
+ vertical->Add (w, 0, wxBOTTOM, DCPOMATIC_SIZER_Y_GAP);
+
/* Make an overall sizer to get a nice border, and put some buttons in */
wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
SetSizer (overall_sizer);
overall_sizer->Layout ();
overall_sizer->SetSizeHints (this);
+
+ _internal->Bind (wxEVT_COMMAND_RADIOBUTTON_SELECTED, bind (&SelfDKDMDialog::setup_sensitivity, this));
+ _write_to->Bind (wxEVT_COMMAND_RADIOBUTTON_SELECTED, bind (&SelfDKDMDialog::setup_sensitivity, this));
}
void
SelfDKDMDialog::setup_sensitivity ()
{
+ _folder->Enable (_write_to->GetValue ());
+
wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
if (ok) {
ok->Enable (_cpl->has_selected ());
{
return _cpl->cpl ();
}
+
+bool
+SelfDKDMDialog::internal () const
+{
+ return _internal->GetValue ();
+}
+
+boost::filesystem::path
+SelfDKDMDialog::directory () const
+{
+ return wx_to_std (_folder->GetPath ());
+}