More automated renaming.
[dcpomatic.git] / src / lib / types.cc
index 68e00c8d532c55a4fce389721991b9b56a43b6c6..7f0bf43057d75f9c770e7369b6ffde721c8b522a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -25,6 +25,8 @@
 #include <libxml++/libxml++.h>
 #include <libcxml/cxml.h>
 
+#include "i18n.h"
+
 using std::max;
 using std::min;
 using std::string;
@@ -92,25 +94,38 @@ Crop::as_xml (xmlpp::Node* node) const
 }
 
 TextType
-string_to_text_type (string s)
+string_to_caption_type (string s)
 {
-       if (s == "subtitle") {
-               return TEXT_SUBTITLE;
-       } else if (s == "ccap") {
-               return TEXT_CLOSED_CAPTION;
+       if (s == "open") {
+               return CAPTION_OPEN;
+       } else if (s == "closed") {
+               return CAPTION_CLOSED;
        } else {
-               throw MetadataError (String::compose ("Unknown text type %1", s));
+               throw MetadataError (String::compose ("Unknown caption type %1", s));
+       }
+}
+
+string
+caption_type_to_string (TextType t)
+{
+       switch (t) {
+       case CAPTION_OPEN:
+               return "open";
+       case CAPTION_CLOSED:
+               return "closed";
+       default:
+               DCPOMATIC_ASSERT (false);
        }
 }
 
 string
-text_type_to_string (TextType t)
+caption_type_to_name (TextType t)
 {
        switch (t) {
-       case TEXT_SUBTITLE:
-               return "subtitle";
-       case TEXT_CLOSED_CAPTION:
-               return "ccap";
+       case CAPTION_OPEN:
+               return _("Subtitles");
+       case CAPTION_CLOSED:
+               return _("Closed captions");
        default:
                DCPOMATIC_ASSERT (false);
        }