Supporters update.
[dcpomatic.git] / src / wx / screen_dialog.h
1 /*
2     Copyright (C) 2012-2022 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 "editable_list.h"
23 #include "lib/screen.h"
24 #include <dcp/certificate.h>
25 #include <dcp/warnings.h>
26 LIBDCP_DISABLE_WARNINGS
27 #include <wx/wx.h>
28 LIBDCP_ENABLE_WARNINGS
29 #include <boost/optional.hpp>
30
31
32 class Progress;
33 class TrustedDeviceDialog;
34
35
36 class ScreenDialog : public wxDialog
37 {
38 public:
39         ScreenDialog (
40                 wxWindow *,
41                 wxString,
42                 std::string name = "",
43                 std::string notes = "",
44                 boost::optional<dcp::Certificate> c = {},
45                 boost::optional<std::string> f = {},
46                 std::vector<TrustedDevice> d = {}
47                 );
48
49         std::string name () const;
50         std::string notes () const;
51         boost::optional<dcp::Certificate> recipient () const;
52         boost::optional<std::string> recipient_file () const;
53         std::vector<TrustedDevice> trusted_devices () {
54                 return _trusted_devices;
55         }
56
57 private:
58         void get_recipient_from_file ();
59         void load_recipient (boost::filesystem::path);
60         void download_recipient ();
61         void setup_sensitivity ();
62         void set_recipient (boost::optional<dcp::Certificate>);
63         void set_recipient_file(std::string file);
64
65         void set_trusted_devices (std::vector<TrustedDevice> d) {
66                 _trusted_devices = d;
67         }
68
69         wxGridBagSizer* _sizer;
70         wxTextCtrl* _name;
71         wxTextCtrl* _notes;
72         wxStaticText* _recipient_thumbprint;
73         wxStaticText* _recipient_file;
74         wxStaticText* _subject_common_name;
75         wxStaticText* _subject_organization_name;
76         wxStaticText* _issuer_common_name;
77         wxStaticText* _issuer_organization_name;
78         wxStaticText* _not_valid_before;
79         wxStaticText* _not_valid_after;
80         wxButton* _get_recipient_from_file;
81         wxButton* _download_recipient;
82         EditableList<TrustedDevice, TrustedDeviceDialog>* _trusted_device_list;
83
84         boost::optional<dcp::Certificate> _recipient;
85         std::vector<TrustedDevice> _trusted_devices;
86 };