summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-03-14 00:09:09 +0100
committerCarl Hetherington <cth@carlh.net>2022-03-14 00:09:09 +0100
commitd9338a75602429347e36e5b393728c10cda731b3 (patch)
treea844d223a7e336488d060ce0e026361390c051a2
parente97d91c544d95c618fa4cb66db6f3a8ad73a7281 (diff)
Remember the state of the write to/email checkboxes in the KDM creator across runs (#2213).
-rw-r--r--src/lib/config.cc6
-rw-r--r--src/lib/config.h18
-rw-r--r--src/wx/kdm_output_panel.cc23
-rw-r--r--src/wx/kdm_output_panel.h2
4 files changed, 46 insertions, 3 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 0de19f70f..b66154038 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -180,6 +180,8 @@ Config::set_defaults ()
_custom_languages.clear ();
_add_files_path = boost::none;
_use_isdcf_name_by_default = true;
+ _write_kdms_to_disk = true;
+ _email_kdms = false;
_allowed_dcp_frame_rates.clear ();
_allowed_dcp_frame_rates.push_back (24);
@@ -567,6 +569,8 @@ try
_add_files_path = f.optional_string_child("AddFilesPath");
_use_isdcf_name_by_default = f.optional_bool_child("UseISDCFNameByDefault").get_value_or(true);
+ _write_kdms_to_disk = f.optional_bool_child("WriteKDMsToDisk").get_value_or(true);
+ _email_kdms = f.optional_bool_child("EmailKDMs").get_value_or(false);
if (boost::filesystem::exists (_cinemas_file)) {
cxml::Document f ("Cinemas");
@@ -997,6 +1001,8 @@ Config::write_config () const
root->add_child("AddFilesPath")->add_child_text(_add_files_path->string());
}
root->add_child("UseISDCFNameByDefault")->add_child_text(_use_isdcf_name_by_default ? "1" : "0");
+ root->add_child("WriteKDMsToDisk")->add_child_text(_write_kdms_to_disk ? "1" : "0");
+ root->add_child("EmailKDMs")->add_child_text(_email_kdms ? "1" : "0");
auto target = config_write_file();
diff --git a/src/lib/config.h b/src/lib/config.h
index 3277dc153..ec152b969 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -555,6 +555,14 @@ public:
return _use_isdcf_name_by_default;
}
+ bool write_kdms_to_disk () const {
+ return _write_kdms_to_disk;
+ }
+
+ bool email_kdms () const {
+ return _email_kdms;
+ }
+
/* SET (mostly) */
void set_master_encoding_threads (int n) {
@@ -1063,6 +1071,14 @@ public:
maybe_set (_use_isdcf_name_by_default, use);
}
+ void set_write_kdms_to_disk (bool write) {
+ maybe_set (_write_kdms_to_disk, write);
+ }
+
+ void set_email_kdms (bool email) {
+ maybe_set (_email_kdms, email);
+ }
+
void changed (Property p = OTHER);
boost::signals2::signal<void (Property)> Changed;
/** Emitted if read() failed on an existing Config file. There is nothing
@@ -1279,6 +1295,8 @@ private:
std::vector<dcp::LanguageTag> _custom_languages;
boost::optional<boost::filesystem::path> _add_files_path;
bool _use_isdcf_name_by_default;
+ bool _write_kdms_to_disk;
+ bool _email_kdms;
static int const _current_version;
diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc
index 8a2757557..11f921aad 100644
--- a/src/wx/kdm_output_panel.cc
+++ b/src/wx/kdm_output_panel.cc
@@ -153,10 +153,11 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent)
break;
}
- _write_to->SetValue (true);
+ _write_to->SetValue (Config::instance()->write_kdms_to_disk());
+ _email->SetValue (Config::instance()->email_kdms());
- _write_to->Bind (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
- _email->Bind (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+ _write_to->Bind (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::write_to_changed, this));
+ _email->Bind (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::email_changed, this));
_write_flat->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
_write_folder->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
_write_zip->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
@@ -167,6 +168,22 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent)
void
+KDMOutputPanel::write_to_changed ()
+{
+ Config::instance()->set_write_kdms_to_disk(_write_to->GetValue());
+ setup_sensitivity ();
+}
+
+
+void
+KDMOutputPanel::email_changed ()
+{
+ Config::instance()->set_email_kdms(_email->GetValue());
+ setup_sensitivity ();
+}
+
+
+void
KDMOutputPanel::setup_sensitivity ()
{
bool const write = _write_to->GetValue ();
diff --git a/src/wx/kdm_output_panel.h b/src/wx/kdm_output_panel.h
index e8515d2c6..1f7373165 100644
--- a/src/wx/kdm_output_panel.h
+++ b/src/wx/kdm_output_panel.h
@@ -60,6 +60,8 @@ public:
private:
void kdm_write_type_changed ();
void advanced_clicked ();
+ void write_to_changed ();
+ void email_changed ();
wxChoice* _type;
NameFormatEditor* _container_name_format;