diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-20 21:22:52 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-20 21:22:52 +0100 |
| commit | d8d7ddd4c39e3ea347afd1fccc037d8b0a31bc87 (patch) | |
| tree | a9071c33d3a6e60f970e5e6c08c70a9efa142838 /src/wx/content_menu.cc | |
| parent | 72ae435a9b2a554d5de7280ad51793ed6a835f42 (diff) | |
Basic support for decryption of imported DCPs.
Diffstat (limited to 'src/wx/content_menu.cc')
| -rw-r--r-- | src/wx/content_menu.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc index b91c82ab1..b396ceb41 100644 --- a/src/wx/content_menu.cc +++ b/src/wx/content_menu.cc @@ -26,6 +26,7 @@ #include "lib/examine_content_job.h" #include "lib/job_manager.h" #include "lib/exceptions.h" +#include "lib/dcp_content.h" #include "content_menu.h" #include "repeat_dialog.h" #include "wx_util.h" @@ -40,6 +41,7 @@ enum { ID_repeat = 1, ID_join, ID_find_missing, + ID_kdm, ID_remove }; @@ -50,12 +52,14 @@ ContentMenu::ContentMenu (wxWindow* p) _repeat = _menu->Append (ID_repeat, _("Repeat...")); _join = _menu->Append (ID_join, _("Join")); _find_missing = _menu->Append (ID_find_missing, _("Find missing...")); + _kdm = _menu->Append (ID_kdm, _("Add KDM...")); _menu->AppendSeparator (); _remove = _menu->Append (ID_remove, _("Remove")); _parent->Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&ContentMenu::repeat, this), ID_repeat); _parent->Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&ContentMenu::join, this), ID_join); _parent->Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&ContentMenu::find_missing, this), ID_find_missing); + _parent->Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&ContentMenu::kdm, this), ID_kdm); _parent->Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&ContentMenu::remove, this), ID_remove); } @@ -81,6 +85,14 @@ ContentMenu::popup (weak_ptr<Film> f, ContentList c, wxPoint p) _join->Enable (n > 1); _find_missing->Enable (_content.size() == 1 && !_content.front()->paths_valid ()); + + if (_content.size() == 1) { + shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (_content.front ()); + _kdm->Enable (dcp && dcp->encrypted ()); + } else { + _kdm->Enable (false); + } + _remove->Enable (!_content.empty ()); _parent->PopupMenu (_menu, p); } @@ -226,3 +238,22 @@ ContentMenu::maybe_found_missing (weak_ptr<Job> j, weak_ptr<Content> oc, weak_pt old_content->set_path (new_content->path (0)); } + +void +ContentMenu::kdm () +{ + assert (!_content.empty ()); + shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (_content.front ()); + assert (dcp); + + wxFileDialog* d = new wxFileDialog (_parent, _("Select KDM")); + + if (d->ShowModal() == wxID_OK) { + dcp->add_kdm (dcp::EncryptedKDM (wx_to_std (d->GetPath ()))); + shared_ptr<Film> film = _film.lock (); + assert (film); + film->examine_content (dcp); + } + + d->Destroy (); +} |
