Supporters update.
[dcpomatic.git] / src / wx / drive_wipe_warning_dialog.cc
1 /*
2     Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
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.
10
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.
15
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/>.
18
19 */
20
21
22 #include "drive_wipe_warning_dialog.h"
23 #include "static_text.h"
24 #include "wx_util.h"
25
26
27 DriveWipeWarningDialog::DriveWipeWarningDialog (wxWindow* parent, wxString drive)
28         : wxDialog (parent, wxID_ANY, _("Important notice"))
29 {
30         wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
31         wxStaticText* text = new StaticText (this, wxEmptyString, wxDefaultPosition, wxSize(600, 400));
32         sizer->Add (text, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
33         _yes = new wxTextCtrl (this, wxID_ANY);
34         sizer->Add (_yes, 0, wxALL, DCPOMATIC_DIALOG_BORDER);
35
36         wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
37         if (buttons) {
38                 sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder());
39         }
40
41         SetSizer (sizer);
42         sizer->Layout ();
43         sizer->SetSizeHints (this);
44
45         /// TRANSLATORS: the user will be asked to type this phrase into a text entry to confirm that they have read
46         /// the warning about a disk being wiped
47         auto const confirmation = _("yes");
48
49         text->SetLabelMarkup (
50                 wxString::Format(
51                         _("If you continue with this operation\n\n<span weight=\"bold\" size=\"20480\" foreground=\"red\">ALL DATA</span>\n\n"
52                           "on the drive\n\n<b>%s</b>\n\nwill be\n\n<span weight=\"bold\" size=\"20480\" foreground=\"red\">PERMANENTLY DESTROYED.</span>\n\n"
53                           "If you are sure you want to continue please type\n\n<tt>%s</tt>\n\ninto the box below, then click OK."), drive, confirmation
54                         )
55                 );
56 }
57
58 bool
59 DriveWipeWarningDialog::confirmed () const
60 {
61         return _yes->GetValue() == _("yes");
62 }