2 Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
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.
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.
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/>.
21 #include "christie_certificate_panel.h"
22 #include "download_certificate_dialog.h"
24 #include "lib/internet.h"
25 #include "lib/compose.hpp"
26 #include "lib/config.h"
29 using boost::optional;
31 ChristieCertificatePanel::ChristieCertificatePanel (DownloadCertificateDialog* dialog)
32 : DownloadCertificatePanel (dialog)
38 ChristieCertificatePanel::do_download ()
40 Config* config = Config::instance ();
41 if (!config->christie_username() || !config->christie_password()) {
42 _dialog->message()->SetLabel(wxT(""));
43 error_dialog (this, _("No Christie username/password configured. Add your account details to the Accounts page in Preferences."));
47 string const prefix = String::compose(
48 "ftp://%1:%2@certificates.christiedigital.com/Certificates/",
49 Config::instance()->christie_username().get(),
50 Config::instance()->christie_password().get()
53 string serial = wx_to_std (_serial->GetValue());
54 serial.insert (0, 12 - serial.length(), '0');
56 string const url = String::compose ("%1F-IMB/F-IMB_%2_sha256.pem", prefix, serial);
58 optional<string> all_errors;
60 optional<string> error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
64 string const url = String::compose ("%1IMB-S2/IMB-S2_%2_sha256.pem", prefix, serial);
66 error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
68 *all_errors += "\n" + *error;
73 _dialog->message()->SetLabel(wxT(""));
74 error_dialog (this, std_to_wx(*all_errors));
76 _dialog->message()->SetLabel (_("Certificate downloaded"));
77 _dialog->setup_sensitivity ();
82 ChristieCertificatePanel::name () const