summaryrefslogtreecommitdiff
path: root/src/lib/film.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-05-09 21:33:56 +0200
committerCarl Hetherington <cth@carlh.net>2024-05-25 01:30:31 +0200
commit1e6484e0fe9e3fa090ef58e17433333a5378043c (patch)
tree5bbb2e4efa39c5aee1d93bd618e5805b38ceb39f /src/lib/film.cc
parent00706c7d9ded27a537af4e8182e67b460ec316bc (diff)
Improve save-template dialog and always use a default template.
Diffstat (limited to 'src/lib/film.cc')
-rw-r--r--src/lib/film.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index b25228ff9..32c236d36 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -153,6 +153,14 @@ int const Film::current_state_version = 38;
/** Construct a Film object in a given directory.
*
+ * Some initial values are taken from the Config object, and usually then overwritten
+ * by reading in the default template. Setting up things like _dcp_content_type in
+ * this constructor is useful so that if people configured such things in old versions
+ * they are used when the first default template is written by Config
+ *
+ * At some point these config entries can be removed, and this constructor could
+ * perhaps read the default template itself.
+ *
* @param dir Film directory.
*/
@@ -1953,10 +1961,14 @@ Film::content_summary (DCPTimePeriod period) const
}
void
-Film::use_template (string name)
+Film::use_template(optional<string> name)
{
- _template_film.reset (new Film (optional<boost::filesystem::path>()));
- _template_film->read_metadata (Config::instance()->template_read_path(name));
+ _template_film = std::make_shared<Film>(optional<boost::filesystem::path>());
+ if (name) {
+ _template_film->read_metadata(Config::instance()->template_read_path(*name));
+ } else {
+ _template_film->read_metadata(Config::instance()->default_template_read_path());
+ }
_use_isdcf_name = _template_film->_use_isdcf_name;
_dcp_content_type = _template_film->_dcp_content_type;
_container = _template_film->_container;