Extract common code out into kdm_for_screen()
[dcpomatic.git] / src / wx / screen_dialog.h
1 /*
2     Copyright (C) 2012-2018 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 "editable_list.h"
22 #include "lib/screen.h"
23 #include <dcp/certificate.h>
24 #include <wx/wx.h>
25 #include <boost/shared_ptr.hpp>
26 #include <boost/optional.hpp>
27
28 class Progress;
29 class TrustedDeviceDialog;
30
31 class ScreenDialog : public wxDialog
32 {
33 public:
34         ScreenDialog (
35                 wxWindow *,
36                 wxString,
37                 std::string name = "",
38                 std::string notes = "",
39                 boost::optional<dcp::Certificate> c = boost::optional<dcp::Certificate> (),
40                 std::vector<TrustedDevice> d = std::vector<TrustedDevice>()
41                 );
42
43         std::string name () const;
44         std::string notes () const;
45         boost::optional<dcp::Certificate> recipient () const;
46         std::vector<TrustedDevice> trusted_devices () {
47                 return _trusted_devices;
48         }
49
50 private:
51         void get_recipient_from_file ();
52         void load_recipient (boost::filesystem::path);
53         void download_recipient ();
54         void setup_sensitivity ();
55         void set_recipient (boost::optional<dcp::Certificate>);
56
57         void set_trusted_devices (std::vector<TrustedDevice> d) {
58                 _trusted_devices = d;
59         }
60
61         wxGridBagSizer* _sizer;
62         wxTextCtrl* _name;
63         wxTextCtrl* _notes;
64         wxStaticText* _recipient_thumbprint;
65         wxButton* _get_recipient_from_file;
66         wxButton* _download_recipient;
67         EditableList<TrustedDevice, TrustedDeviceDialog>* _trusted_device_list;
68
69         boost::optional<dcp::Certificate> _recipient;
70         std::vector<TrustedDevice> _trusted_devices;
71 };