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 <wx/listctrl.h>
26 #include <wx/scrolwin.h>
29 InvalidCertificatePeriodDialog::InvalidCertificatePeriodDialog(wxWindow* parent, std::vector<KDMCertificatePeriod> const& periods)
30 : wxDialog(parent, wxID_ANY, _("Invalid certificates"))
31 , _list(new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT))
36 ip.SetText(_("Cinema"));
38 _list->InsertColumn(0, ip);
44 ip.SetText(_("Screen"));
46 _list->InsertColumn(1, ip);
52 ip.SetText(_("Certificate start"));
54 _list->InsertColumn(2, ip);
60 ip.SetText(_("Certificate end"));
62 _list->InsertColumn(3, ip);
66 for (auto const& period: periods) {
69 _list->InsertItem(item);
70 _list->SetItem(0, 0, std_to_wx(period.cinema_name));
71 _list->SetItem(0, 1, std_to_wx(period.screen_name));
72 _list->SetItem(0, 2, std_to_wx(period.from.as_string()));
73 _list->SetItem(0, 3, std_to_wx(period.to.as_string()));
76 auto overall_sizer = new wxBoxSizer(wxVERTICAL);
78 auto constexpr width = 700;
80 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?"));
81 question->Wrap(width);
86 DCPOMATIC_DIALOG_BORDER
89 _list->SetSize({width, -1});
90 overall_sizer->Add(_list, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
92 auto buttons = CreateStdDialogButtonSizer(0);
94 overall_sizer->Add(CreateSeparatedSizer(buttons), wxSizerFlags().Expand().DoubleBorder());
95 buttons->SetAffirmativeButton(new wxButton(this, wxID_OK, _("Create KDMs anyway")));
96 buttons->SetCancelButton(new wxButton(this, wxID_CANCEL, _("Cancel")));
100 overall_sizer->Layout();
101 SetSizerAndFit(overall_sizer);