Basics of subtitle split.
[dcpomatic.git] / src / lib / screen.cc
index 0876e770b03b4cd43b86d8d4892f11f45ec4a718..96a59236d82a565612c384865fb26da628056efd 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include "screen.h"
 #include <libxml++/libxml++.h>
+#include <boost/foreach.hpp>
 
 Screen::Screen (cxml::ConstNodePtr node)
-       : name (node->string_child ("Name"))
+       : name (node->string_child("Name"))
+       , notes (node->optional_string_child("Notes").get_value_or (""))
 {
        if (node->optional_string_child ("Certificate")) {
                recipient = dcp::Certificate (node->string_child ("Certificate"));
        } else if (node->optional_string_child ("Recipient")) {
                recipient = dcp::Certificate (node->string_child ("Recipient"));
        }
+
+       BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children ("TrustedDevice")) {
+               trusted_devices.push_back (dcp::Certificate (i->content ()));
+       }
 }
 
 void
@@ -37,4 +43,10 @@ Screen::as_xml (xmlpp::Element* parent) const
        if (recipient) {
                parent->add_child("Recipient")->add_child_text (recipient->certificate (true));
        }
+
+       parent->add_child("Notes")->add_child_text (notes);
+
+       BOOST_FOREACH (dcp::Certificate const & i, trusted_devices) {
+               parent->add_child("TrustedDevice")->add_child_text (i.certificate (true));
+       }
 }