summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-09 21:20:10 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-09 21:20:10 +0200
commitc27d14badb229c24533db65dbaee1939dce89455 (patch)
tree250f422babe86b56bac69fe45142fd1fd4d0ec11 /src/wx
parentf10849bd52470a93f54bb90686aa9a3b1e72e796 (diff)
Make DCP text track language properly optional and ignore bad values on imported DCPs (#1950).
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/closed_captions_dialog.cc2
-rw-r--r--src/wx/dcp_text_track_dialog.cc4
-rw-r--r--src/wx/text_panel.cc2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/wx/closed_captions_dialog.cc b/src/wx/closed_captions_dialog.cc
index e386beccf..7fcfc0808 100644
--- a/src/wx/closed_captions_dialog.cc
+++ b/src/wx/closed_captions_dialog.cc
@@ -249,7 +249,7 @@ ClosedCaptionsDialog::update_tracks (shared_ptr<const Film> film)
_track->Clear ();
for (auto const& i: _tracks) {
- _track->Append (std_to_wx(String::compose("%1 (%2)", i.name, i.language)));
+ _track->Append (std_to_wx(String::compose("%1 (%2)", i.name, i.language ? i.language->to_string() : wx_to_std(_("Unknown")))));
}
if (_track->GetCount() > 0) {
diff --git a/src/wx/dcp_text_track_dialog.cc b/src/wx/dcp_text_track_dialog.cc
index b884aba51..be31de0ce 100644
--- a/src/wx/dcp_text_track_dialog.cc
+++ b/src/wx/dcp_text_track_dialog.cc
@@ -33,7 +33,7 @@ DCPTextTrackDialog::DCPTextTrackDialog (wxWindow* parent)
add (_("Name"), true);
add (_name = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(300, -1)));
add (_("Language"), true);
- _language = new LanguageTagWidget (this, wxT(""), dcp::LanguageTag("en-US"));
+ _language = new LanguageTagWidget (this, wxT(""), boost::none);
add (_language->sizer());
layout ();
@@ -44,5 +44,5 @@ DCPTextTrack
DCPTextTrackDialog::get () const
{
DCPOMATIC_ASSERT (_language->get());
- return DCPTextTrack(wx_to_std(_name->GetValue()), _language->get()->to_string());
+ return DCPTextTrack(wx_to_std(_name->GetValue()), _language->get());
}
diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc
index cdd61e109..8e6d5cd68 100644
--- a/src/wx/text_panel.cc
+++ b/src/wx/text_panel.cc
@@ -343,7 +343,7 @@ TextPanel::update_dcp_tracks ()
/* XXX: don't display the "magic" track which has empty name and language;
this is a nasty hack (see also Film::closed_caption_tracks)
*/
- if (!i.name.empty() || !i.language.empty()) {
+ if (!i.name.empty() || i.language) {
_dcp_track->Append (std_to_wx(i.summary()));
}
}