summaryrefslogtreecommitdiff
path: root/src/tools
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/tools
parent00706c7d9ded27a537af4e8182e67b460ec316bc (diff)
Improve save-template dialog and always use a default template.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/dcpomatic.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 63802279f..0a6728731 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -454,12 +454,13 @@ public:
}
}
+ /** Make a new film in the given path, using template_name as a template
+ * (or the default template if it's empty).
+ */
void new_film (boost::filesystem::path path, optional<string> template_name)
{
auto film = make_shared<Film>(path);
- if (template_name) {
- film->use_template (template_name.get());
- }
+ film->use_template(template_name);
film->set_name (path.filename().generic_string());
film->write_metadata ();
set_film (film);
@@ -626,7 +627,11 @@ private:
SaveTemplateDialog dialog(this);
if (dialog.ShowModal() == wxID_OK) {
try {
- Config::instance()->save_template(_film, dialog.name());
+ if (dialog.name()) {
+ Config::instance()->save_template(_film, *dialog.name());
+ } else {
+ Config::instance()->save_default_template(_film);
+ }
} catch (exception& e) {
error_dialog(this, _("Could not save template."), std_to_wx(e.what()));
}