2 Copyright (C) 2023 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 "invalid_certificate_period_dialog.h"
24 #include "lib/kdm_util.h"
25 #include <dcp/warnings.h>
26 LIBDCP_DISABLE_WARNINGS
27 #include <wx/listctrl.h>
28 #include <wx/scrolwin.h>
29 LIBDCP_ENABLE_WARNINGS
32 InvalidCertificatePeriodDialog::InvalidCertificatePeriodDialog(wxWindow* parent, std::vector<KDMCertificatePeriod> const& periods)
33 : wxDialog(parent, wxID_ANY, _("Invalid certificates"))
34 , _list(new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT))
39 ip.SetText(_("Cinema"));
41 _list->InsertColumn(0, ip);
47 ip.SetText(_("Screen"));
49 _list->InsertColumn(1, ip);
55 ip.SetText(_("Certificate start"));
57 _list->InsertColumn(2, ip);
63 ip.SetText(_("Certificate end"));
65 _list->InsertColumn(3, ip);
69 for (auto const& period: periods) {
72 _list->InsertItem(item);
73 _list->SetItem(0, 0, std_to_wx(period.cinema_name));
74 _list->SetItem(0, 1, std_to_wx(period.screen_name));
75 _list->SetItem(0, 2, std_to_wx(period.from.as_string()));
76 _list->SetItem(0, 3, std_to_wx(period.to.as_string()));
79 auto overall_sizer = new wxBoxSizer(wxVERTICAL);
81 auto constexpr width = 700;
83 auto question = new wxStaticText(this, wxID_ANY, _("Some KDMs would have validity periods which are outside the recipient certificate validity periods. What do you want to do?"));
84 question->Wrap(width);
89 DCPOMATIC_DIALOG_BORDER
92 _list->SetSize({width, -1});
93 overall_sizer->Add(_list, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
95 auto buttons = CreateStdDialogButtonSizer(0);
97 overall_sizer->Add(CreateSeparatedSizer(buttons), wxSizerFlags().Expand().DoubleBorder());
98 buttons->SetAffirmativeButton(new wxButton(this, wxID_OK, _("Create KDMs anyway")));
99 buttons->SetCancelButton(new wxButton(this, wxID_CANCEL, _("Cancel")));
103 overall_sizer->Layout();
104 SetSizerAndFit(overall_sizer);