2 Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
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.
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.
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/>.
21 #ifndef DCPOMATIC_CONFIG_DIALOG_H
22 #define DCPOMATIC_CONFIG_DIALOG_H
25 #include "editable_list.h"
26 #include "make_chain_dialog.h"
27 #include "lib/config.h"
28 #include "lib/ratio.h"
29 #include "lib/filter.h"
30 #include "lib/dcp_content_type.h"
33 #include "lib/cross.h"
34 #include "lib/exceptions.h"
35 #include <dcp/locale_convert.h>
36 #include <dcp/exceptions.h>
37 #include <dcp/certificate_chain.h>
38 #include <wx/stdpaths.h>
39 #include <wx/preferences.h>
40 #include <wx/spinctrl.h>
41 #include <wx/filepicker.h>
43 #include <boost/filesystem.hpp>
44 #include <boost/foreach.hpp>
50 Page (wxSize panel_size, int border);
54 wxWindow* create_window (wxWindow* parent);
60 virtual void config_changed () = 0;
61 virtual void setup () = 0;
63 void config_changed_wrapper ();
64 void window_destroyed ();
67 boost::signals2::scoped_connection _config_connection;
71 class StockPage : public wxStockPreferencesPage, public Page
74 StockPage (Kind kind, wxSize panel_size, int border);
75 wxWindow* CreateWindow (wxWindow* parent);
78 class StandardPage : public wxPreferencesPage, public Page
81 StandardPage (wxSize panel_size, int border);
82 wxWindow* CreateWindow (wxWindow* parent);
85 class GeneralPage : public StockPage
88 GeneralPage (wxSize panel_size, int border);
91 void add_language_controls (wxGridBagSizer* table, int& r);
92 void add_play_sound_controls (wxGridBagSizer* table, int& r);
93 void add_update_controls (wxGridBagSizer* table, int& r);
94 virtual void config_changed ();
97 void setup_sensitivity ();
98 boost::optional<std::string> get_sound_output ();
99 void set_language_changed ();
100 void language_changed ();
101 void check_for_updates_changed ();
102 void check_for_test_updates_changed ();
103 void sound_changed ();
104 void sound_output_changed ();
106 wxCheckBox* _set_language;
109 wxChoice* _sound_output;
110 wxCheckBox* _check_for_updates;
111 wxCheckBox* _check_for_test_updates;
114 class CertificateChainEditor : public wxDialog
117 CertificateChainEditor (
121 boost::function<void (boost::shared_ptr<dcp::CertificateChain>)> set,
122 boost::function<boost::shared_ptr<const dcp::CertificateChain> (void)> get,
123 boost::function<bool (void)> nag_remake
126 void add_button (wxWindow* button);
129 void add_certificate ();
130 void remove_certificate ();
131 void export_certificate ();
132 void update_certificate_list ();
133 void remake_certificates ();
134 void update_sensitivity ();
135 void update_private_key ();
136 void import_private_key ();
137 void export_private_key ();
139 wxListCtrl* _certificates;
140 wxButton* _add_certificate;
141 wxButton* _export_certificate;
142 wxButton* _remove_certificate;
143 wxButton* _remake_certificates;
144 wxStaticText* _private_key;
145 wxButton* _import_private_key;
146 wxButton* _export_private_key;
147 wxStaticText* _private_key_bad;
149 wxBoxSizer* _button_sizer;
150 boost::function<void (boost::shared_ptr<dcp::CertificateChain>)> _set;
151 boost::function<boost::shared_ptr<const dcp::CertificateChain> (void)> _get;
152 boost::function<bool (void)> _nag_remake;
155 class KeysPage : public StandardPage
158 KeysPage (wxSize panel_size, int border)
159 : StandardPage (panel_size, border)
162 wxString GetName () const;
165 wxBitmap GetLargeIcon () const
167 return wxBitmap ("keys", wxBITMAP_TYPE_PNG_RESOURCE);
175 void export_decryption_certificate ();
176 void export_decryption_chain ();
177 void config_changed () {}
178 bool nag_remake_decryption_chain ();
179 void decryption_advanced ();
180 void signing_advanced ();
181 void export_decryption_chain_and_key ();
182 void import_decryption_chain_and_key ();