Simple cover sheet support (#1039).
[dcpomatic.git] / src / lib / config.cc
index c0ab44923a4d8b9344de0b77a294ee12a0066e3d..a19a60f55aa06d5d16072f2cacea23f5bdd4ced6 100644 (file)
@@ -132,6 +132,7 @@ Config::set_defaults ()
        _allowed_dcp_frame_rates.push_back (60);
 
        set_kdm_email_to_default ();
+       set_cover_sheet_to_default ();
 }
 
 void
@@ -329,6 +330,9 @@ try
        }
        _preview_sound = f.optional_bool_child("PreviewSound").get_value_or (false);
        _preview_sound_output = f.optional_string_child("PreviewSoundOutput");
+       if (f.optional_string_child("CoverSheet")) {
+               _cover_sheet = f.optional_string_child("CoverSheet").get();
+       }
 
        /* Replace any cinemas from config.xml with those from the configured file */
        if (boost::filesystem::exists (_cinemas_file)) {
@@ -514,6 +518,7 @@ Config::write_config () const
        if (_preview_sound_output) {
                root->add_child("PreviewSoundOutput")->add_child_text (_preview_sound_output.get());
        }
+       root->add_child("CoverSheet")->add_child_text (_cover_sheet);
 
        try {
                doc.write_to_file_formatted (path("config.xml").string ());
@@ -607,6 +612,18 @@ Config::reset_kdm_email ()
        changed ();
 }
 
+void
+Config::set_cover_sheet_to_default ()
+{
+       _cover_sheet = _(
+               "$CPL_NAME\n\n"
+               "Type: $TYPE\n"
+               "Format: $CONTAINER\n"
+               "Audio: $AUDIO\n"
+               "Length: $LENGTH\n"
+               );
+}
+
 void
 Config::add_to_history (boost::filesystem::path p)
 {
@@ -707,3 +724,10 @@ Config::config_path ()
 {
        return path("config.xml", false);
 }
+
+void
+Config::reset_cover_sheet ()
+{
+       set_cover_sheet_to_default ();
+       changed ();
+}