Use a LanguageTag for closed caption tracks.
authorCarl Hetherington <cth@carlh.net>
Fri, 20 Nov 2020 15:52:56 +0000 (16:52 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 20 Nov 2020 22:47:03 +0000 (23:47 +0100)
src/lib/reel_writer.cc
src/wx/dcp_text_track_dialog.cc
src/wx/dcp_text_track_dialog.h

index 345bcdeb38d9c8832f4e2c4a59384c8f9d30f79b..fa84180f000179b5605804f944d96532c86d43f4 100644 (file)
@@ -608,7 +608,7 @@ ReelWriter::create_reel (list<ReferencedReelAsset> const & refs, list<shared_ptr
                        );
                if (a) {
                        a->set_annotation_text (i->first.name);
-                       a->set_language (i->first.language);
+                       a->set_language (dcp::LanguageTag(i->first.language));
                }
        }
 
index d48b3be2624d57b6036a8f8ea342f19708c13726..3e8750cd5bff82f405a19bf85ad0fcdca895e81b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #include "dcp_text_track_dialog.h"
+#include "language_tag_widget.h"
 #include <boost/algorithm/string.hpp>
 
+
 using std::string;
 
+
 DCPTextTrackDialog::DCPTextTrackDialog (wxWindow* parent)
        : TableDialog (parent, _("DCP Text Track"), 2, 1, true)
 {
        add (_("Name"), true);
        add (_name = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(300, -1)));
        add (_("Language"), true);
-       add (_language = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(150, -1)));
+       _language = new LanguageTagWidget (this, wxT(""), dcp::LanguageTag("en-US"));
+       add (_language->sizer());
 
        layout ();
 }
 
+
 DCPTextTrack
 DCPTextTrackDialog::get () const
 {
-       return DCPTextTrack(wx_to_std(_name->GetValue()), wx_to_std(_language->GetValue()));
+       return DCPTextTrack(wx_to_std(_name->GetValue()), _language->get().to_string());
 }
index dd4894aeb1ac143b0b06181de96f11800ae48b10..c073696376c241685b566bff9ff7bd754a6eaef9 100644 (file)
 #include "wx_util.h"
 #include "lib/dcp_text_track.h"
 
+
+class LanguageTagWidget;
+
+
 class DCPTextTrackDialog : public TableDialog
 {
 public:
@@ -34,7 +38,7 @@ public:
 
 private:
        wxTextCtrl* _name;
-       wxTextCtrl* _language;
+       LanguageTagWidget* _language;
 };
 
 #endif