if (cinemas_file.extension() == ".xml") {
auto sqlite = cinemas_file;
sqlite.replace_extension(".sqlite3");
+ bool const had_sqlite = dcp::filesystem::exists(sqlite);
- if (dcp::filesystem::exists(cinemas_file) && !dcp::filesystem::exists(sqlite)) {
- _instance->set_cinemas_file(sqlite);
+ _instance->set_cinemas_file(sqlite);
+
+ if (dcp::filesystem::exists(cinemas_file) && !had_sqlite) {
CinemaList cinemas;
cinemas.read_legacy_file(cinemas_file);
}
/* [XML:opt] Language Language to use in the GUI e.g. <code>fr_FR</code>. */
cxml::add_text_child(root, "Language", _language.get());
}
- if (_default_dcp_content_type) {
- /* [XML:opt] DefaultDCPContentType Default content type to use when creating new films (<code>FTR</code>, <code>SHR</code>,
- <code>TLR</code>, <code>TST</code>, <code>XSN</code>, <code>RTG</code>, <code>TSR</code>, <code>POL</code>,
- <code>PSA</code> or <code>ADV</code>). */
- cxml::add_text_child(root, "DefaultDCPContentType", _default_dcp_content_type->isdcf_name());
- }
- /* [XML] DefaultDCPAudioChannels Default number of audio channels to use when creating new films. */
- cxml::add_text_child(root, "DefaultDCPAudioChannels", raw_convert<string>(_default_dcp_audio_channels));
/* [XML] DCPIssuer Issuer text to write into CPL files. */
cxml::add_text_child(root, "DCPIssuer", _dcp_issuer);
/* [XML] DCPCreator Creator text to write into CPL files. */
h.insert (h.begin (), p);
if (h.size() > HISTORY_SIZE) {
- h.pop_back ();
+ h.resize(HISTORY_SIZE);
}
changed (HISTORY);
}
+void
+Config::save_default_template(shared_ptr<const Film> film) const
+{
+ film->write_template(write_path("default.xml"));
+}
+
+
void
Config::save_template (shared_ptr<const Film> film, string name) const
{
}
-list<string>
+vector<string>
Config::templates () const
{
if (!dcp::filesystem::exists(read_path("templates"))) {
return {};
}
- list<string> n;
+ vector<string> n;
for (auto const& i: dcp::filesystem::directory_iterator(read_path("templates"))) {
n.push_back (i.path().filename().string());
}
}
+boost::filesystem::path
+Config::default_template_read_path() const
+{
+ if (!boost::filesystem::exists(read_path("default.xml"))) {
+ auto film = std::make_shared<const Film>(optional<boost::filesystem::path>());
+ save_default_template(film);
+ }
+
+ return read_path("default.xml");
+}
+
+
boost::filesystem::path
Config::template_write_path (string name) const
{