Add a dialog to show which screens have potentially-problematic
[dcpomatic.git] / src / tools / dcpomatic_kdm.cc
index 8cf38128347c58e00a45fc102152a7a78c337d8b..9bb8e20a86ea1c2c208e583326a75cb46f85e6d5 100644 (file)
@@ -22,6 +22,7 @@
 #include "wx/about_dialog.h"
 #include "wx/dcpomatic_button.h"
 #include "wx/editable_list.h"
+#include "wx/invalid_certificate_period_dialog.h"
 #include "wx/file_dialog.h"
 #include "wx/file_picker_ctrl.h"
 #include "wx/full_config_dialog.h"
@@ -419,19 +420,16 @@ private:
                                return;
                        }
 
-                       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;
+                               }
                        }
 
                        auto result = _output->make (