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