From 9b5cff118fe03649c0c404b35f2900ff36008637 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 20 Nov 2023 00:20:44 +0100 Subject: [PATCH 1/1] Cleanup: use stack-allocated FileDialog and accept multiple KDMs. --- src/tools/dcpomatic_player.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 6c6e756ec..d1668975c 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -19,6 +19,7 @@ */ #include "wx/about_dialog.h" +#include "wx/file_dialog.h" #include "wx/film_viewer.h" #include "wx/nag_dialog.h" #include "wx/player_config_dialog.h" @@ -698,9 +699,9 @@ private: void file_add_kdm () { - auto d = make_wx(this, _("Select KDM")); + FileDialog dialog(this, _("Select KDM"), wxT("XML files|*.xml|All files|*.*"), wxFD_MULTIPLE, "AddKDMPath"); - if (d->ShowModal() == wxID_OK) { + if (dialog.show()) { DCPOMATIC_ASSERT (_film); auto dcp = std::dynamic_pointer_cast(_film->content().front()); DCPOMATIC_ASSERT (dcp); @@ -710,7 +711,9 @@ private: _viewer.set_coalesce_player_changes(false); }); _viewer.set_coalesce_player_changes(true); - dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE))); + for (auto path: dialog.paths()) { + dcp->add_kdm(dcp::EncryptedKDM(dcp::file_to_string(path))); + } examine_content(); } } catch (exception& e) { -- 2.30.2