From d361b99f8dc8b9b1bcde40e0056e3fc796e5583c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 15 Jan 2023 20:26:20 +0100 Subject: [PATCH] Tell user what just happened if they get either of the disk writer confirmations wrong (#2417). --- src/tools/dcpomatic_disk.cc | 20 +++++++++++--------- src/wx/drive_wipe_warning_dialog.cc | 8 ++++++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/tools/dcpomatic_disk.cc b/src/tools/dcpomatic_disk.cc index e2cd108c1..d3235c1bb 100644 --- a/src/tools/dcpomatic_disk.cc +++ b/src/tools/dcpomatic_disk.cc @@ -367,12 +367,12 @@ private: } - auto * d = new DriveWipeWarningDialog (this, _drive->GetString(_drive->GetSelection())); - int const r = d->ShowModal (); - bool ok = r == wxID_OK && d->confirmed(); - d->Destroy (); - - if (!ok) { + auto d = make_wx(this, _drive->GetString(_drive->GetSelection())); + if (d->ShowModal() != wxID_OK) { + return; + } + if (!d->confirmed()) { + message_dialog(this, _("You did not correctly confirm that you read the warning that was just shown. Please try again.")); return; } @@ -478,12 +478,14 @@ public: Config::drop (); if (!_skip_alpha_check) { - auto warning = new DiskWarningDialog (); - warning->ShowModal (); + auto warning = make_wx(); + if (warning->ShowModal() != wxID_OK) { + return false; + } if (!warning->confirmed()) { + message_dialog(nullptr, _("You did not correctly confirm that you read the warning that was just shown. DCP-o-matic Disk Writer will close now. Please try again.")); return false; } - warning->Destroy (); } _frame = new DOMFrame (_("DCP-o-matic Disk Writer")); diff --git a/src/wx/drive_wipe_warning_dialog.cc b/src/wx/drive_wipe_warning_dialog.cc index 094a1dded..f011fdbf1 100644 --- a/src/wx/drive_wipe_warning_dialog.cc +++ b/src/wx/drive_wipe_warning_dialog.cc @@ -42,11 +42,15 @@ DriveWipeWarningDialog::DriveWipeWarningDialog (wxWindow* parent, wxString drive sizer->Layout (); sizer->SetSizeHints (this); + /// TRANSLATORS: the user will be asked to type this phrase into a text entry to confirm that they have read + /// the warning about a disk being wiped + auto const confirmation = _("yes"); + text->SetLabelMarkup ( wxString::Format( _("If you continue with this operation\n\nALL DATA\n\n" "on the drive\n\n%s\n\nwill be\n\nPERMANENTLY DESTROYED.\n\n" - "If you are sure you want to continue please type\n\nyes\n\ninto the box below, then click OK."), drive + "If you are sure you want to continue please type\n\n%s\n\ninto the box below, then click OK."), drive, confirmation ) ); } @@ -54,5 +58,5 @@ DriveWipeWarningDialog::DriveWipeWarningDialog (wxWindow* parent, wxString drive bool DriveWipeWarningDialog::confirmed () const { - return _yes->GetValue() == "yes"; + return _yes->GetValue() == _("yes"); } -- 2.30.2