summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-10-20 11:42:14 +0100
committerCarl Hetherington <cth@carlh.net>2016-10-20 11:42:14 +0100
commit00b60f52add041a36fa62118baf4b5ac78993980 (patch)
treea1427c61dc4ed0a17bb9f120985481f1772b9d50 /src/tools
parentbd3be0efd59054666fd04d69715275f257994f5e (diff)
Give a better error if the user tries to load a non-KDM as a DKDM into the KDM creator.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/dcpomatic_kdm.cc14
1 files changed, 13 insertions, 1 deletions
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<dcp::EncryptedKDM> 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<dcp::EncryptedKDM> ();
+ }
};
static string
@@ -156,7 +168,7 @@ public:
vector<string> columns;
columns.push_back (wx_to_std (_("CPL")));
_dkdm = new EditableList<dcp::EncryptedKDM, KDMFileDialogWrapper> (
- 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);