summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-11-19 21:34:56 +0100
committerCarl Hetherington <cth@carlh.net>2023-11-20 07:31:44 +0100
commit16557827b252bd653b15eead479ec5699eda7360 (patch)
treef94f6822143802f2676c44e711984029eb3fb6cc /src/wx
parent9d1d75e474bc92d8b0f823141073ad9dd639c8e0 (diff)
Add a dialog to show which screens have potentially-problematic
certificate validity periods when making KDMs (#2645).
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/invalid_certificate_period_dialog.cc103
-rw-r--r--src/wx/invalid_certificate_period_dialog.h45
-rw-r--r--src/wx/kdm_dialog.cc24
-rw-r--r--src/wx/wscript1
4 files changed, 160 insertions, 13 deletions
diff --git a/src/wx/invalid_certificate_period_dialog.cc b/src/wx/invalid_certificate_period_dialog.cc
new file mode 100644
index 000000000..54f699ba7
--- /dev/null
+++ b/src/wx/invalid_certificate_period_dialog.cc
@@ -0,0 +1,103 @@
+/*
+ Copyright (C) 2023 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "invalid_certificate_period_dialog.h"
+#include "wx_util.h"
+#include "lib/kdm_util.h"
+#include <wx/listctrl.h>
+#include <wx/scrolwin.h>
+
+
+InvalidCertificatePeriodDialog::InvalidCertificatePeriodDialog(wxWindow* parent, std::vector<KDMCertificatePeriod> const& periods)
+ : wxDialog(parent, wxID_ANY, _("Invalid certificates"))
+ , _list(new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT))
+{
+ {
+ wxListItem ip;
+ ip.SetId(0);
+ ip.SetText(_("Cinema"));
+ ip.SetWidth(200);
+ _list->InsertColumn(0, ip);
+ }
+
+ {
+ wxListItem ip;
+ ip.SetId(1);
+ ip.SetText(_("Screen"));
+ ip.SetWidth(50);
+ _list->InsertColumn(1, ip);
+ }
+
+ {
+ wxListItem ip;
+ ip.SetId(2);
+ ip.SetText(_("Certificate start"));
+ ip.SetWidth(200);
+ _list->InsertColumn(2, ip);
+ }
+
+ {
+ wxListItem ip;
+ ip.SetId(3);
+ ip.SetText(_("Certificate end"));
+ ip.SetWidth(200);
+ _list->InsertColumn(3, ip);
+ }
+
+ int id = 0;
+ for (auto const& period: periods) {
+ wxListItem item;
+ item.SetId(id);
+ _list->InsertItem(item);
+ _list->SetItem(0, 0, std_to_wx(period.cinema_name));
+ _list->SetItem(0, 1, std_to_wx(period.screen_name));
+ _list->SetItem(0, 2, std_to_wx(period.from.as_string()));
+ _list->SetItem(0, 3, std_to_wx(period.to.as_string()));
+ }
+
+ auto overall_sizer = new wxBoxSizer(wxVERTICAL);
+
+ auto constexpr width = 700;
+
+ 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?"));
+ question->Wrap(width);
+ overall_sizer->Add(
+ question,
+ 0,
+ wxALL,
+ DCPOMATIC_DIALOG_BORDER
+ );
+
+ _list->SetSize({width, -1});
+ overall_sizer->Add(_list, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
+
+ auto buttons = CreateStdDialogButtonSizer(0);
+ if (buttons) {
+ overall_sizer->Add(CreateSeparatedSizer(buttons), wxSizerFlags().Expand().DoubleBorder());
+ buttons->SetAffirmativeButton(new wxButton(this, wxID_OK, _("Create KDMs anyway")));
+ buttons->SetCancelButton(new wxButton(this, wxID_CANCEL, _("Cancel")));
+ buttons->Realize();
+ }
+
+ overall_sizer->Layout();
+ SetSizerAndFit(overall_sizer);
+}
+
diff --git a/src/wx/invalid_certificate_period_dialog.h b/src/wx/invalid_certificate_period_dialog.h
new file mode 100644
index 000000000..08933b70d
--- /dev/null
+++ b/src/wx/invalid_certificate_period_dialog.h
@@ -0,0 +1,45 @@
+/*
+ Copyright (C) 2023 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#ifndef DCPOMATIC_INVALID_CERTIFICATE_PERIOD_DIALOG_H
+#define DCPOMATIC_INVALID_CERTIFICATE_PERIOD_DIALOG_H
+
+
+#include <wx/wx.h>
+
+
+class KDMCertificatePeriod;
+class wxListCtrl;
+
+
+class InvalidCertificatePeriodDialog : public wxDialog
+{
+public:
+ InvalidCertificatePeriodDialog(wxWindow* parent, std::vector<KDMCertificatePeriod> const& periods);
+
+private:
+ wxListCtrl* _list;
+};
+
+
+#endif
+
+
diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc
index bec880852..9135baf23 100644
--- a/src/wx/kdm_dialog.cc
+++ b/src/wx/kdm_dialog.cc
@@ -21,6 +21,7 @@
#include "confirm_kdm_email_dialog.h"
#include "dcpomatic_button.h"
+#include "invalid_certificate_period_dialog.h"
#include "kdm_cpl_panel.h"
#include "kdm_dialog.h"
#include "kdm_output_panel.h"
@@ -185,19 +186,16 @@ KDMDialog::make_clicked ()
}
}
- if (find(period_checks.begin(), period_checks.end(), KDMCertificatePeriod::KDM_OUTSIDE_CERTIFICATE) != period_checks.end()) {
- error_dialog(
- this,
- _("Some KDMs would have validity periods which are completely outside the recipient certificate periods. Such KDMs are very unlikely to work, so will not be created.")
- );
- return;
- }
-
- if (find(period_checks.begin(), period_checks.end(), KDMCertificatePeriod::KDM_OVERLAPS_CERTIFICATE) != period_checks.end()) {
- message_dialog(
- this,
- _("For some of these KDMs the recipient certificate's validity period will not cover the whole of the KDM validity period. This might cause problems with the KDMs.")
- );
+ if (
+ find_if(
+ period_checks.begin(),
+ period_checks.end(),
+ [](KDMCertificatePeriod const& p) { return p.overlap != KDMCertificateOverlap::KDM_WITHIN_CERTIFICATE; }
+ ) != period_checks.end()) {
+ InvalidCertificatePeriodDialog dialog(this, period_checks);
+ if (dialog.ShowModal() == wxID_CANCEL) {
+ return;
+ }
}
} catch (dcp::BadKDMDateError& e) {
diff --git a/src/wx/wscript b/src/wx/wscript
index 3e5483647..9c6ea6b84 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -88,6 +88,7 @@ sources = """
html_dialog.cc
i18n_hook.cc
image_sequence_dialog.cc
+ invalid_certificate_period_dialog.cc
instant_i18n_dialog.cc
interop_metadata_dialog.cc
job_manager_view.cc