From: Carl Hetherington Date: Sun, 13 Mar 2022 23:09:09 +0000 (+0100) Subject: Remember the state of the write to/email checkboxes in the KDM creator across runs... X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=fa413e203b864571ca00ec937088b87793f312df;p=dcpomatic.git Remember the state of the write to/email checkboxes in the KDM creator across runs (#2213). --- diff --git a/src/lib/config.cc b/src/lib/config.cc index bc03377b6..2859d548f 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -186,6 +186,8 @@ Config::set_defaults () _add_files_path = boost::none; _auto_crop_threshold = 0.1; _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); @@ -575,6 +577,8 @@ try _add_files_path = f.optional_string_child("AddFilesPath"); _auto_crop_threshold = f.optional_number_child("AutoCropThreshold").get_value_or(0.1); _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"); @@ -1008,6 +1012,8 @@ Config::write_config () const } root->add_child("AutoCropThreshold")->add_child_text(raw_convert(_auto_crop_threshold)); 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 0f565fe50..cb4ed1365 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -564,6 +564,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) { @@ -1080,6 +1088,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 Changed; /** Emitted if read() failed on an existing Config file. There is nothing @@ -1298,6 +1314,8 @@ private: boost::optional _add_files_path; double _auto_crop_threshold; 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 33b9cb4f0..7b739720f 100644 --- a/src/wx/kdm_output_panel.cc +++ b/src/wx/kdm_output_panel.cc @@ -154,10 +154,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 () { 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;