Add option to use (or not) ISDCF names by default.
authorCarl Hetherington <cth@carlh.net>
Wed, 26 Jan 2022 23:03:17 +0000 (00:03 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 26 Jan 2022 23:03:17 +0000 (00:03 +0100)
src/lib/config.cc
src/lib/config.h
src/lib/film.cc
src/wx/full_config_dialog.cc

index f8639692fe0b97013c4beb4c0e8b90fbf46da064..7311189adc7046008037b237aeb3964e0a3de9bf 100644 (file)
@@ -185,6 +185,7 @@ Config::set_defaults ()
        _custom_languages.clear ();
        _add_files_path = boost::none;
        _auto_crop_threshold = 0.1;
+       _use_isdcf_name_by_default = true;
 
        _allowed_dcp_frame_rates.clear ();
        _allowed_dcp_frame_rates.push_back (24);
@@ -586,6 +587,7 @@ try
 
        _add_files_path = f.optional_string_child("AddFilesPath");
        _auto_crop_threshold = f.optional_number_child<double>("AutoCropThreshold").get_value_or(0.1);
+       _use_isdcf_name_by_default = f.optional_bool_child("UseISDCFNameByDefault").get_value_or(true);
 
        if (boost::filesystem::exists (_cinemas_file)) {
                cxml::Document f ("Cinemas");
@@ -1018,6 +1020,7 @@ Config::write_config () const
                root->add_child("AddFilesPath")->add_child_text(_add_files_path->string());
        }
        root->add_child("AutoCropThreshold")->add_child_text(raw_convert<string>(_auto_crop_threshold));
+       root->add_child("UseISDCFNameByDefault")->add_child_text(_use_isdcf_name_by_default ? "1" : "0");
 
        auto target = config_write_file();
 
index 956d8aa9b6bfa37d1148b3db214fdf90ed110e71..177fffc3719178892d4d531f78b367b21662e911 100644 (file)
@@ -556,6 +556,10 @@ public:
                return _auto_crop_threshold;
        }
 
+       bool use_isdcf_name_by_default () const {
+               return _use_isdcf_name_by_default;
+       }
+
        /* SET (mostly) */
 
        void set_master_encoding_threads (int n) {
@@ -1068,6 +1072,10 @@ public:
                maybe_set (_auto_crop_threshold, threshold, AUTO_CROP_THRESHOLD);
        }
 
+       void set_use_isdcf_name_by_default (bool use) {
+               maybe_set (_use_isdcf_name_by_default, use);
+       }
+
        void changed (Property p = OTHER);
        boost::signals2::signal<void (Property)> Changed;
        /** Emitted if read() failed on an existing Config file.  There is nothing
@@ -1282,6 +1290,7 @@ private:
        std::vector<dcp::LanguageTag> _custom_languages;
        boost::optional<boost::filesystem::path> _add_files_path;
        double _auto_crop_threshold;
+       bool _use_isdcf_name_by_default;
 
        static int const _current_version;
 
index 57aa7a146d9728112ee9ef89426e6bc223137787..e9b4675be0a604f69d397f6a09c9a82fc49eeec2 100644 (file)
@@ -155,7 +155,7 @@ int const Film::current_state_version = 38;
 
 Film::Film (optional<boost::filesystem::path> dir)
        : _playlist (new Playlist)
-       , _use_isdcf_name (true)
+       , _use_isdcf_name (Config::instance()->use_isdcf_name_by_default())
        , _dcp_content_type (Config::instance()->default_dcp_content_type ())
        , _container (Config::instance()->default_container ())
        , _resolution (Resolution::TWO_K)
index ef13314c3e0d1fcf77499e7b3aa5424b8c34e27e..bd09d249a93a37564db83e7629661ff961240f82 100644 (file)
@@ -334,12 +334,16 @@ private:
 
                table->Add (_kdm_directory, 1, wxEXPAND);
 
+               table->Add (_use_isdcf_name_by_default = new CheckBox(_panel, _("Use ISDCF name by default")), 0, wxALIGN_CENTRE_VERTICAL);
+
                _still_length->SetRange (1, 3600);
                _still_length->Bind (wxEVT_SPINCTRL, boost::bind (&DefaultsPage::still_length_changed, this));
 
                _directory->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::directory_changed, this));
                _kdm_directory->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::kdm_directory_changed, this));
 
+               _use_isdcf_name_by_default->Bind (wxEVT_CHECKBOX, boost::bind(&DefaultsPage::use_isdcf_name_by_default_changed, this));
+
                for (auto i: Ratio::containers()) {
                        _container->Append (std_to_wx(i->container_nickname()));
                }
@@ -395,6 +399,7 @@ private:
                checked_set (_still_length, config->default_still_length ());
                _directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ()));
                _kdm_directory->SetPath (std_to_wx (config->default_kdm_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ()));
+               checked_set (_use_isdcf_name_by_default, config->use_isdcf_name_by_default());
                checked_set (_j2k_bandwidth, config->default_j2k_bandwidth() / 1000000);
                _j2k_bandwidth->SetRange (50, config->maximum_j2k_bandwidth() / 1000000);
                checked_set (_dcp_audio_channels, locale_convert<string> (config->default_dcp_audio_channels()));
@@ -453,6 +458,11 @@ private:
                Config::instance()->set_default_kdm_directory (wx_to_std (_kdm_directory->GetPath ()));
        }
 
+       void use_isdcf_name_by_default_changed ()
+       {
+               Config::instance()->set_use_isdcf_name_by_default (_use_isdcf_name_by_default->GetValue());
+       }
+
        void still_length_changed ()
        {
                Config::instance()->set_default_still_length (_still_length->GetValue ());
@@ -504,6 +514,7 @@ private:
        wxDirPickerCtrl* _directory;
        wxDirPickerCtrl* _kdm_directory;
 #endif
+       wxCheckBox* _use_isdcf_name_by_default;
        wxChoice* _container;
        wxChoice* _dcp_content_type;
        wxChoice* _dcp_audio_channels;