diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-01-13 00:29:56 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-01-13 00:35:30 +0100 |
| commit | dd0d98fefd7520752a603ff262aae293c50a917c (patch) | |
| tree | 8b283a7b2ad94fd5324758d21f097972e14d480e | |
| parent | 501096cb9a14e1722ee3d84ecdbd41f79df6467a (diff) | |
Add context menu option to verify DCPs from the main DoM (#2054).
| -rw-r--r-- | src/wx/content_menu.cc | 30 | ||||
| -rw-r--r-- | src/wx/content_menu.h | 2 | ||||
| -rw-r--r-- | src/wx/verify_dcp_dialog.cc | 38 | ||||
| -rw-r--r-- | src/wx/verify_dcp_dialog.h | 12 |
4 files changed, 78 insertions, 4 deletions
diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc index d042abf90..a9f698340 100644 --- a/src/wx/content_menu.cc +++ b/src/wx/content_menu.cc @@ -31,6 +31,7 @@ #include "id.h" #include "repeat_dialog.h" #include "wx_util.h" +#include "verify_dcp_dialog.h" #include "lib/audio_content.h" #include "lib/config.h" #include "lib/content_factory.h" @@ -88,7 +89,8 @@ enum { ID_choose_cpl, ID_set_dcp_settings, ID_set_dcp_markers, - ID_remove + ID_remove, + ID_verify }; @@ -102,6 +104,7 @@ ContentMenu::ContentMenu(wxWindow* p, FilmViewer& viewer) _join = _menu->Append(ID_join, _("Join")); _find_missing = _menu->Append(ID_find_missing, _("Find missing...")); _re_examine = _menu->Append(ID_re_examine, _("Re-examine...")); + _verify = _menu->Append(ID_verify, _("Verify...")); _auto_crop = _menu->Append(ID_auto_crop, _("Auto-crop...")); _copy_settings = _menu->Append(ID_copy_settings, _("Copy settings from another project...")); _properties = _menu->Append(ID_properties, _("Properties...")); @@ -122,6 +125,7 @@ ContentMenu::ContentMenu(wxWindow* p, FilmViewer& viewer) _parent->Bind(wxEVT_MENU, boost::bind(&ContentMenu::properties, this), ID_properties); _parent->Bind(wxEVT_MENU, boost::bind(&ContentMenu::advanced, this), ID_advanced); _parent->Bind(wxEVT_MENU, boost::bind(&ContentMenu::re_examine, this), ID_re_examine); + _parent->Bind(wxEVT_MENU, boost::bind(&ContentMenu::verify, this), ID_verify); _parent->Bind(wxEVT_MENU, boost::bind(&ContentMenu::auto_crop, this), ID_auto_crop); _parent->Bind(wxEVT_MENU, boost::bind(&ContentMenu::copy_settings, this), ID_copy_settings); _parent->Bind(wxEVT_MENU, boost::bind(&ContentMenu::kdm, this), ID_kdm); @@ -152,12 +156,19 @@ ContentMenu::popup(weak_ptr<Film> film, ContentList c, TimelineContentViewList v [](shared_ptr<Content> content) { return static_cast<bool>(dynamic_pointer_cast<FFmpegContent>(content)); } ); + auto dcp_count = std::count_if( + _content.begin(), + _content.end(), + [](shared_ptr<Content> content) { return static_cast<bool>(dynamic_pointer_cast<DCPContent>(content)); } + ); + _join->Enable(ffmpeg_count > 1); _find_missing->Enable(_content.size() == 1 && (!paths_exist(_content.front()->paths()) || !paths_exist(_content.front()->font_paths()))); _properties->Enable(_content.size() == 1); _advanced->Enable(_content.size() == 1); _re_examine->Enable(!_content.empty()); + _verify->Enable(dcp_count == 1); _auto_crop->Enable(_content.size() == 1); _copy_settings->Enable(_content.size() == 1); @@ -400,6 +411,23 @@ ContentMenu::re_examine() void +ContentMenu::verify() +{ + DCPOMATIC_ASSERT(!_content.empty()); + auto dcp = std::dynamic_pointer_cast<DCPContent>(_content.front()); + DCPOMATIC_ASSERT(dcp); + + vector<dcp::EncryptedKDM> kdms; + if (dcp->kdm()) { + kdms.push_back(*dcp->kdm()); + } + + VerifyDCPDialog dialog(_parent, _("Verify DCP"), dcp->directories(), kdms); + dialog.ShowModal(); +} + + +void ContentMenu::kdm() { DCPOMATIC_ASSERT(!_content.empty()); diff --git a/src/wx/content_menu.h b/src/wx/content_menu.h index b09556831..31da5eace 100644 --- a/src/wx/content_menu.h +++ b/src/wx/content_menu.h @@ -58,6 +58,7 @@ private: void properties(); void advanced(); void re_examine(); + void verify(); void auto_crop(); void copy_settings(); void kdm(); @@ -82,6 +83,7 @@ private: wxMenuItem* _properties; wxMenuItem* _advanced; wxMenuItem* _re_examine; + wxMenuItem* _verify; wxMenuItem* _auto_crop; wxMenuItem* _copy_settings; wxMenuItem* _kdm; diff --git a/src/wx/verify_dcp_dialog.cc b/src/wx/verify_dcp_dialog.cc index 9fd77c367..c25899e2d 100644 --- a/src/wx/verify_dcp_dialog.cc +++ b/src/wx/verify_dcp_dialog.cc @@ -52,7 +52,41 @@ VerifyDCPDialog::VerifyDCPDialog( , _result_panel(new VerifyDCPResultPanel(this)) , _cancel_pending(false) , _dcp_directories(std::move(dcp_directories)) - , _kdms(std::move(kdms)) +{ + setup(); + + if (auto key = Config::instance()->decryption_chain()->key()) { + for (auto const& kdm: kdms) { + _kdms.push_back(dcp::DecryptedKDM{dcp::EncryptedKDM(dcp::file_to_string(kdm)), *key}); + } + } +} + + +VerifyDCPDialog::VerifyDCPDialog( + wxWindow* parent, + wxString title, + vector<boost::filesystem::path> dcp_directories, + vector<dcp::EncryptedKDM> const& kdms + ) + : wxDialog (parent, wxID_ANY, title) + , _progress_panel(new VerifyDCPProgressPanel(this)) + , _result_panel(new VerifyDCPResultPanel(this)) + , _cancel_pending(false) + , _dcp_directories(std::move(dcp_directories)) +{ + setup(); + + if (auto key = Config::instance()->decryption_chain()->key()) { + for (auto const& kdm: kdms) { + _kdms.push_back(dcp::DecryptedKDM{kdm, *key}); + } + } +} + + +void +VerifyDCPDialog::setup() { auto overall_sizer = new wxBoxSizer (wxVERTICAL); @@ -76,7 +110,7 @@ VerifyDCPDialog::VerifyDCPDialog( overall_sizer->Add(_progress_panel, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); overall_sizer->Add(_result_panel, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); - SetSizerAndFit (overall_sizer); + SetSizerAndFit(overall_sizer); _verify->bind(&VerifyDCPDialog::verify_clicked, this); _cancel->bind(&VerifyDCPDialog::cancel_clicked, this); diff --git a/src/wx/verify_dcp_dialog.h b/src/wx/verify_dcp_dialog.h index ffed80b91..3f7aebfb9 100644 --- a/src/wx/verify_dcp_dialog.h +++ b/src/wx/verify_dcp_dialog.h @@ -19,6 +19,8 @@ */ +#include <dcp/decrypted_kdm.h> +#include <dcp/encrypted_kdm.h> #include <dcp/warnings.h> LIBDCP_DISABLE_WARNINGS #include <wx/wx.h> @@ -41,10 +43,18 @@ public: wxWindow* parent, wxString title, std::vector<boost::filesystem::path> dcp_directories, + std::vector<dcp::EncryptedKDM> const& kdms + ); + + VerifyDCPDialog( + wxWindow* parent, + wxString title, + std::vector<boost::filesystem::path> dcp_directories, std::vector<boost::filesystem::path> kdms ); private: + void setup(); void verify_clicked(); void cancel_clicked(); @@ -55,7 +65,7 @@ private: Button* _verify; bool _cancel_pending; std::vector<boost::filesystem::path> _dcp_directories; - std::vector<boost::filesystem::path> _kdms; + std::vector<dcp::DecryptedKDM> _kdms; }; |
