summaryrefslogtreecommitdiff
path: root/src/wx/recreate_chain_dialog.cc
blob: d4dc7431546b1b9fe2f6fe10fbc182ee08dc7912 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
    Copyright (C) 2018 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 "recreate_chain_dialog.h"
#include "wx_util.h"
#include "static_text.h"
#include "check_box.h"
#include "lib/config.h"
#include "lib/cinema_kdms.h"
#include <boost/foreach.hpp>

using std::list;
using std::string;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif

RecreateChainDialog::RecreateChainDialog (wxWindow* parent, Config::BadSignerChainReason reason)
	: QuestionDialog (parent, _("Certificate chain"), _("Recreate signing certificates"), _("Do nothing"))
	, _reason (reason)
{
	wxString message;
	if (_reason & Config::BadSignerChainReason::BAD_SIGNER_CHAIN_VALIDITY_TOO_LONG) {
		message = _("The certificate chain that DCP-o-matic uses for signing DCPs and KDMs has a validity period\n"
			    "that is too long.  This will cause problems playing back DCPs on some systems.\n"
			    "Do you want to re-create the certificate chain for signing DCPs and KDMs?");
	} else {
		message = _("The certificate chain that DCP-o-matic uses for signing DCPs and KDMs contains a small error\n"
			    "which will prevent DCPs from being validated correctly on some systems.  Do you want to re-create\n"
			    "the certificate chain for signing DCPs and KDMs?");
	}

	_sizer->Add (new StaticText (this, message), 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);

	wxCheckBox* shut_up = new CheckBox (this, _("Don't ask this again"));
	_sizer->Add (shut_up, 0, wxALL, DCPOMATIC_DIALOG_BORDER);

	shut_up->Bind (wxEVT_CHECKBOX, bind (&RecreateChainDialog::shut_up, this, _1));

	layout ();
}

void
RecreateChainDialog::shut_up (wxCommandEvent& ev)
{
	if (_reason & Config::BadSignerChainReason::BAD_SIGNER_CHAIN_VALIDITY_TOO_LONG) {
		Config::instance()->set_nagged (Config::NAG_BAD_SIGNER_CHAIN_VALIDITY_TOO_LONG, ev.IsChecked());
	} else {
		Config::instance()->set_nagged (Config::NAG_BAD_SIGNER_CHAIN_UTF8_STRINGS, ev.IsChecked());
	}
}