2 Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #include "interop_metadata_dialog.h"
23 #include "language_tag_widget.h"
24 #include "rating_dialog.h"
26 #include <dcp/types.h>
27 #include <dcp/warnings.h>
28 LIBDCP_DISABLE_WARNINGS
29 #include <wx/gbsizer.h>
30 LIBDCP_ENABLE_WARNINGS
33 using std::shared_ptr;
37 #if BOOST_VERSION >= 106100
38 using namespace boost::placeholders;
42 InteropMetadataDialog::InteropMetadataDialog (wxWindow* parent, weak_ptr<Film> film)
43 : MetadataDialog (parent, film)
49 InteropMetadataDialog::setup_standard (wxPanel* panel, wxSizer* sizer)
51 MetadataDialog::setup_standard (panel, sizer);
54 int flags = wxALIGN_TOP | wxLEFT | wxRIGHT | wxTOP;
56 flags |= wxALIGN_RIGHT;
58 auto m = create_label (panel, _("Ratings"), true);
59 sizer->Add (m, 0, flags, DCPOMATIC_SIZER_GAP);
62 sizer->Add (_ratings, 1, wxEXPAND);
64 add_label_to_sizer (sizer, panel, _("Content version"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL);
65 _content_version = new wxTextCtrl (panel, wxID_ANY);
66 sizer->Add (_content_version, 1, wxEXPAND);
68 auto cv = film()->content_versions();
69 _content_version->SetValue (std_to_wx(cv.empty() ? "" : cv[0]));
71 _content_version->Bind (wxEVT_TEXT, boost::bind(&InteropMetadataDialog::content_version_changed, this));
72 _content_version->SetFocus ();
77 InteropMetadataDialog::content_version_changed ()
79 auto version = wx_to_std(_content_version->GetValue());
80 if (version.empty()) {
81 film()->set_content_versions({});
83 film()->set_content_versions({version});