No-op; fix GPL address and use the explicit-program-name version.
[dcpomatic.git] / src / wx / download_certificate_panel.cc
1 /*
2     Copyright (C) 2014-2015 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 "wx_util.h"
22 #include "download_certificate_panel.h"
23 #include <dcp/util.h>
24 #include <dcp/exceptions.h>
25 #include <boost/bind.hpp>
26
27 using boost::function;
28 using boost::optional;
29
30 DownloadCertificatePanel::DownloadCertificatePanel (wxWindow* parent, DownloadCertificateDialog* dialog)
31         : wxPanel (parent, wxID_ANY)
32         , _dialog (dialog)
33 {
34         _overall_sizer = new wxBoxSizer (wxVERTICAL);
35         SetSizer (_overall_sizer);
36
37         _table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
38         _table->AddGrowableCol (1, 1);
39
40         _overall_sizer->Add (_table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
41 }
42
43 void
44 DownloadCertificatePanel::layout ()
45 {
46         _overall_sizer->Layout ();
47         _overall_sizer->SetSizeHints (this);
48 }
49
50 void
51 DownloadCertificatePanel::load (boost::filesystem::path file)
52 {
53         try {
54                 _certificate = dcp::Certificate (dcp::file_to_string (file));
55         } catch (dcp::MiscError& e) {
56                 error_dialog (this, wxString::Format (_("Could not read certificate file (%s)"), std_to_wx(e.what()).data()));
57         }
58 }
59
60 optional<dcp::Certificate>
61 DownloadCertificatePanel::certificate () const
62 {
63         return _certificate;
64 }