summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-01-18 00:58:51 +0100
committerCarl Hetherington <cth@carlh.net>2024-01-18 00:58:51 +0100
commit5b10ee366f819c05d69ea8e78c8348eca99721b5 (patch)
tree7eae306a3a20ff2d3760e18a0e4b83b62b0a4f01 /src
parente0eecce56d975d9819f902cbb51c886b16e8ebf7 (diff)
Allow specification of KDM annotation text (#296).
Diffstat (limited to 'src')
-rw-r--r--src/tools/dcpomatic_kdm.cc16
-rw-r--r--src/wx/kdm_dialog.cc18
-rw-r--r--src/wx/kdm_dialog.h1
-rw-r--r--src/wx/kdm_output_panel.cc18
-rw-r--r--src/wx/kdm_output_panel.h4
5 files changed, 53 insertions, 4 deletions
diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc
index 8e5e75da0..c125428db 100644
--- a/src/tools/dcpomatic_kdm.cc
+++ b/src/tools/dcpomatic_kdm.cc
@@ -382,12 +382,12 @@ private:
vector<KDMCertificatePeriod> period_checks;
- std::function<dcp::DecryptedKDM (dcp::LocalTime, dcp::LocalTime)> make_kdm = [decrypted, title](dcp::LocalTime begin, dcp::LocalTime end) {
+ std::function<dcp::DecryptedKDM (dcp::LocalTime, dcp::LocalTime)> make_kdm = [this, decrypted, title](dcp::LocalTime begin, dcp::LocalTime end) {
/* Make an empty KDM */
dcp::DecryptedKDM kdm (
begin,
end,
- decrypted.annotation_text().get_value_or(""),
+ _output->annotation_text(),
title,
dcp::LocalTime().as_string()
);
@@ -487,7 +487,17 @@ private:
void dkdm_selection_changed()
{
- _selected_dkdm = selected_dkdm();
+ if (_selected_dkdm = selected_dkdm()) {
+ auto dkdm = std::dynamic_pointer_cast<DKDM>(_selected_dkdm);
+ if (dkdm) {
+ try {
+ dcp::DecryptedKDM decrypted(dkdm->dkdm(), Config::instance()->decryption_chain()->key().get());
+ if (decrypted.annotation_text()) {
+ _output->set_annotation_text(*decrypted.annotation_text());
+ }
+ } catch (...) {}
+ }
+ }
setup_sensitivity();
}
diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc
index c15156eee..c88a1ac40 100644
--- a/src/wx/kdm_dialog.cc
+++ b/src/wx/kdm_dialog.cc
@@ -37,6 +37,7 @@
#include "lib/kdm_util.h"
#include "lib/screen.h"
#include <libcxml/cxml.h>
+#include <dcp/cpl.h>
#include <dcp/exceptions.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
@@ -127,8 +128,9 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr<const Film> film)
_screens->ScreensChanged.connect (boost::bind (&KDMDialog::setup_sensitivity, this));
_timing->TimingChanged.connect (boost::bind (&KDMDialog::setup_sensitivity, this));
_make->Bind (wxEVT_BUTTON, boost::bind (&KDMDialog::make_clicked, this));
- _cpl->Changed.connect(boost::bind(&KDMDialog::setup_sensitivity, this));
+ _cpl->Changed.connect(boost::bind(&KDMDialog::cpl_changed, this));
+ cpl_changed();
setup_sensitivity ();
SetSizer (overall_sizer);
@@ -138,6 +140,20 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr<const Film> film)
void
+KDMDialog::cpl_changed()
+{
+ try {
+ dcp::CPL cpl(_cpl->cpl());
+ if (auto text = cpl.annotation_text()) {
+ _output->set_annotation_text(*text);
+ }
+ } catch (...) {}
+
+ setup_sensitivity();
+}
+
+
+void
KDMDialog::setup_sensitivity ()
{
_screens->setup_sensitivity ();
diff --git a/src/wx/kdm_dialog.h b/src/wx/kdm_dialog.h
index b475bde70..c1e9588fe 100644
--- a/src/wx/kdm_dialog.h
+++ b/src/wx/kdm_dialog.h
@@ -51,6 +51,7 @@ private:
void setup_sensitivity ();
void make_clicked ();
bool confirm_overwrite (boost::filesystem::path path);
+ void cpl_changed();
std::weak_ptr<const Film> _film;
ScreensPanel* _screens;
diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc
index 37c797192..b4d94838b 100644
--- a/src/wx/kdm_output_panel.cc
+++ b/src/wx/kdm_output_panel.cc
@@ -79,6 +79,10 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent)
type->Add (advanced, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
table->Add (type, 1, wxTOP, DCPOMATIC_CHOICE_TOP_PAD);
+ add_label_to_sizer(table, this, _("Annotation text"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL);
+ _annotation_text = new wxTextCtrl(this, wxID_ANY);
+ table->Add(_annotation_text, 1, wxEXPAND);
+
add_label_to_sizer (table, this, _("Folder / ZIP name format"), true, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT);
_container_name_format = new NameFormatEditor (this, Config::instance()->kdm_container_name_format(), dcp::NameFormat::Map(), dcp::NameFormat::Map(), "");
table->Add (_container_name_format->panel(), 1, wxEXPAND);
@@ -357,3 +361,17 @@ KDMOutputPanel::method_selected() const
return _write_to->GetValue() || _email->GetValue();
}
+
+void
+KDMOutputPanel::set_annotation_text(string text)
+{
+ checked_set(_annotation_text, std::move(text));
+}
+
+
+string
+KDMOutputPanel::annotation_text() const
+{
+ return wx_to_std(_annotation_text->GetValue());
+}
+
diff --git a/src/wx/kdm_output_panel.h b/src/wx/kdm_output_panel.h
index db898b44b..3b82321c6 100644
--- a/src/wx/kdm_output_panel.h
+++ b/src/wx/kdm_output_panel.h
@@ -65,6 +65,9 @@ public:
bool method_selected() const;
+ void set_annotation_text(std::string text);
+ std::string annotation_text() const;
+
boost::signals2::signal<void ()> MethodChanged;
private:
@@ -75,6 +78,7 @@ private:
void add_email_addresses_clicked ();
KDMChoice* _type;
+ wxTextCtrl* _annotation_text;
NameFormatEditor* _container_name_format;
NameFormatEditor* _filename_format;
CheckBox* _write_to;