diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-01-03 20:47:53 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-01-04 10:25:10 +0100 |
| commit | 94903b113b78ad8b939c067f91739a2752b8019e (patch) | |
| tree | 303b8008e1e996061e6fed5aefaa4b5418d9837e | |
| parent | 13fae8b9710e1f630fafdc62ecd06c723edf7ff0 (diff) | |
Use FileDialog for Add DKDM in the KDM creator.
| -rw-r--r-- | src/lib/config.cc | 1 | ||||
| -rw-r--r-- | src/tools/dcpomatic_kdm.cc | 20 |
2 files changed, 7 insertions, 14 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 21e670306..30e80b938 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -187,6 +187,7 @@ Config::set_defaults () _custom_languages.clear (); _initial_paths.clear(); _initial_paths["AddFilesPath"] = boost::none; + _initial_paths["AddDKDMPath"] = boost::none; _use_isdcf_name_by_default = true; _write_kdms_to_disk = true; _email_kdms = false; diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 0d6ecbab0..851dacd54 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -22,6 +22,7 @@ #include "wx/about_dialog.h" #include "wx/dcpomatic_button.h" #include "wx/editable_list.h" +#include "wx/file_dialog.h" #include "wx/file_picker_ctrl.h" #include "wx/full_config_dialog.h" #include "wx/job_view_dialog.h" @@ -489,29 +490,20 @@ private: void add_dkdm_clicked () { - auto d = new wxFileDialog( - this, - _("Select DKDM file"), - wxEmptyString, - wxEmptyString, - wxT("XML files|*.xml|All files|*.*"), - wxFD_MULTIPLE - ); + auto dialog = new FileDialog(this, _("Select DKDM file"), wxT("XML files|*.xml|All files|*.*"), wxFD_MULTIPLE, "AddDKDMPath"); - ScopeGuard sg = [d]() { d->Destroy(); }; + ScopeGuard sg = [dialog]() { dialog->Destroy(); }; - if (d->ShowModal() != wxID_OK) { + if (!dialog->show()) { return; } auto chain = Config::instance()->decryption_chain(); DCPOMATIC_ASSERT (chain->key()); - wxArrayString paths; - d->GetPaths(paths); - for (unsigned int i = 0; i < paths.GetCount(); ++i) { + for (auto path: dialog->paths()) { try { - dcp::EncryptedKDM ekdm(dcp::file_to_string(wx_to_std(paths[i]), MAX_KDM_SIZE)); + dcp::EncryptedKDM ekdm(dcp::file_to_string(path, MAX_KDM_SIZE)); /* Decrypt the DKDM to make sure that we can */ dcp::DecryptedKDM dkdm(ekdm, chain->key().get()); |
