Extract common code out into kdm_for_screen()
[dcpomatic.git] / src / wx / disk_warning_dialog.cc
1 /*
2     Copyright (C) 2020 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 #include "disk_warning_dialog.h"
22 #include "static_text.h"
23 #include "wx_util.h"
24
25 DiskWarningDialog::DiskWarningDialog ()
26         : wxDialog (0, wxID_ANY, _("Important notice"))
27 {
28         wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
29         wxStaticText* text = new StaticText (this, wxEmptyString, wxDefaultPosition, wxSize(400, 300));
30         sizer->Add (text, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
31         _yes = new wxTextCtrl (this, wxID_ANY);
32         sizer->Add (_yes, 0, wxALL, DCPOMATIC_DIALOG_BORDER);
33
34         wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
35         if (buttons) {
36                 sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder());
37         }
38
39         SetSizer (sizer);
40         sizer->Layout ();
41         sizer->SetSizeHints (this);
42
43         text->SetLabelMarkup (
44                 _("The <b>DCP-o-matic Disk Writer</b> is\n\n<span weight=\"bold\" size=\"20480\" foreground=\"red\">ALPHA-GRADE TEST SOFTWARE</span>\n\n"
45                   "and can\n\n<span weight=\"bold\" size=\"20480\" foreground=\"red\">DESTROY DATA!</span>\n\n"
46                   "Please do not continue unless Carl has asked you to test the software. "
47                   "If you are sure you want to continue please type\n\n<tt>I am sure</tt>\n\ninto the box below, then click OK.")
48                 );
49 }
50
51 bool
52 DiskWarningDialog::confirmed () const
53 {
54         return _yes->GetValue() == "I am sure";
55 }