Display the filename / URL that a screen certificate was obtained from (#1894).
[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 <wx/wx.h>
26 #include <boost/optional.hpp>
27
28
29 class Progress;
30 class TrustedDeviceDialog;
31
32
33 class ScreenDialog : public wxDialog
34 {
35 public:
36         ScreenDialog (
37                 wxWindow *,
38                 wxString,
39                 std::string name = "",
40                 std::string notes = "",
41                 boost::optional<dcp::Certificate> c = {},
42                 boost::optional<std::string> f = {},
43                 std::vector<TrustedDevice> d = {}
44                 );
45
46         std::string name () const;
47         std::string notes () const;
48         boost::optional<dcp::Certificate> recipient () const;
49         boost::optional<std::string> recipient_file () const;
50         std::vector<TrustedDevice> trusted_devices () {
51                 return _trusted_devices;
52         }
53
54 private:
55         void get_recipient_from_file ();
56         void load_recipient (boost::filesystem::path);
57         void download_recipient ();
58         void setup_sensitivity ();
59         void set_recipient (boost::optional<dcp::Certificate>);
60
61         void set_trusted_devices (std::vector<TrustedDevice> d) {
62                 _trusted_devices = d;
63         }
64
65         wxGridBagSizer* _sizer;
66         wxTextCtrl* _name;
67         wxTextCtrl* _notes;
68         wxStaticText* _recipient_thumbprint;
69         wxStaticText* _recipient_file;
70         wxButton* _get_recipient_from_file;
71         wxButton* _download_recipient;
72         EditableList<TrustedDevice, TrustedDeviceDialog>* _trusted_device_list;
73
74         boost::optional<dcp::Certificate> _recipient;
75         std::vector<TrustedDevice> _trusted_devices;
76 };