2ed6d3f31f1591ee2a4d283cce446fb8de3c47e9
[dcpomatic.git] / src / wx / recipient_dialog.h
1 /*
2     Copyright (C) 2012-2020 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 "email_dialog.h"
24 #include "wx_util.h"
25 #include "lib/screen.h"
26 #include <dcp/certificate.h>
27 #include <dcp/warnings.h>
28 LIBDCP_DISABLE_WARNINGS
29 #include <wx/wx.h>
30 LIBDCP_ENABLE_WARNINGS
31 #include <boost/optional.hpp>
32
33
34 class Progress;
35 class TrustedDeviceDialog;
36
37
38 class RecipientDialog : public wxDialog
39 {
40 public:
41         RecipientDialog (
42                 wxWindow *,
43                 wxString,
44                 std::string name = "",
45                 std::string notes = "",
46                 std::list<std::string> emails = std::list<std::string>(),
47                 int utc_offset_hour = 0,
48                 int utc_offset_minute = 0,
49                 boost::optional<dcp::Certificate> c = boost::optional<dcp::Certificate>()
50                 );
51
52         std::string name () const;
53         std::string notes () const;
54         boost::optional<dcp::Certificate> recipient () const;
55         std::list<std::string> emails () const;
56         int utc_offset_hour () const;
57         int utc_offset_minute () const;
58
59 private:
60         void get_recipient_from_file ();
61         void load_recipient (boost::filesystem::path);
62         void setup_sensitivity ();
63         void set_recipient (boost::optional<dcp::Certificate>);
64         std::vector<std::string> get_emails () const;
65         void set_emails (std::vector<std::string>);
66
67         wxGridBagSizer* _sizer;
68         wxTextCtrl* _name;
69         wxTextCtrl* _notes;
70         wxStaticText* _recipient_thumbprint;
71         wxButton* _get_recipient_from_file;
72         EditableList<std::string, EmailDialog>* _email_list;
73         std::vector<std::string> _emails;
74         wxChoice* _utc_offset;
75         std::vector<Offset> _offsets;
76
77         boost::optional<dcp::Certificate> _recipient;
78 };