From 00b60f52add041a36fa62118baf4b5ac78993980 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 20 Oct 2016 11:42:14 +0100 Subject: Give a better error if the user tries to load a non-KDM as a DKDM into the KDM creator. --- src/tools/dcpomatic_kdm.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/tools') diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 362d8105f..21dd01940 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -62,6 +62,7 @@ using std::string; using std::vector; using boost::shared_ptr; using boost::bind; +using boost::optional; enum { ID_help_report_a_problem = 1, @@ -75,6 +76,17 @@ public: { } + + optional get () + { + try { + return dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (_dialog->GetPath ()))); + } catch (cxml::Error& e) { + error_dialog (_parent, wxString::Format ("This file does not look like a KDM (%s)", std_to_wx (e.what()).data())); + } + + return optional (); + } }; static string @@ -156,7 +168,7 @@ public: vector columns; columns.push_back (wx_to_std (_("CPL"))); _dkdm = new EditableList ( - overall_panel, columns, bind (&DOMFrame::dkdms, this), bind (&DOMFrame::set_dkdms, this, _1), bind (&always_valid), bind (&column, _1), false + overall_panel, columns, bind (&DOMFrame::dkdms, this), bind (&DOMFrame::set_dkdms, this, _1), bind (&column, _1), false ); right->Add (_dkdm, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_Y_GAP); -- cgit v1.2.3