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/>.
22 #ifndef DCPOMATIC_CONFIG_DIALOG_H
23 #define DCPOMATIC_CONFIG_DIALOG_H
26 #include "editable_list.h"
27 #include "make_chain_dialog.h"
29 #include "lib/config.h"
30 #include "lib/cross.h"
31 #include "lib/dcp_content_type.h"
32 #include "lib/exceptions.h"
33 #include "lib/filter.h"
35 #include "lib/ratio.h"
37 #include <dcp/certificate_chain.h>
38 #include <dcp/exceptions.h>
39 #include <dcp/locale_convert.h>
40 #include <dcp/warnings.h>
41 LIBDCP_DISABLE_WARNINGS
42 #include <wx/filepicker.h>
43 #include <wx/preferences.h>
44 #include <wx/spinctrl.h>
45 #include <wx/stdpaths.h>
47 LIBDCP_ENABLE_WARNINGS
48 #include <boost/filesystem.hpp>
51 class AudioMappingView;
56 class Page : public wxPreferencesPage
59 Page (wxSize panel_size, int border);
62 wxWindow* CreateWindow (wxWindow* parent) override;
65 wxWindow* create_window (wxWindow* parent);
71 virtual void config_changed () = 0;
72 virtual void setup () = 0;
74 void config_changed_wrapper ();
75 void window_destroyed ();
78 boost::signals2::scoped_connection _config_connection;
83 class GeneralPage : public Page
86 GeneralPage (wxSize panel_size, int border);
88 wxString GetName () const override;
91 wxBitmap GetLargeIcon () const override
93 return wxBitmap(icon_path("general"), wxBITMAP_TYPE_PNG);
98 void add_language_controls (wxGridBagSizer* table, int& r);
99 void add_update_controls (wxGridBagSizer* table, int& r);
100 void config_changed () override;
103 void setup_sensitivity ();
104 void set_language_changed ();
105 void language_changed ();
106 void check_for_updates_changed ();
107 void check_for_test_updates_changed ();
109 CheckBox* _set_language;
111 CheckBox* _check_for_updates;
112 CheckBox* _check_for_test_updates;
116 class CertificateChainEditor : public wxDialog
119 CertificateChainEditor (
123 std::function<void (std::shared_ptr<dcp::CertificateChain>)> set,
124 std::function<std::shared_ptr<const dcp::CertificateChain> (void)> get,
125 std::function<bool (void)> nag_alter
128 void add_button (wxWindow* button);
131 void add_certificate ();
132 void remove_certificate ();
133 void export_certificate ();
134 void update_certificate_list ();
135 void remake_certificates ();
136 void update_sensitivity ();
137 void update_private_key ();
138 void import_private_key ();
139 void export_private_key ();
140 void export_chain ();
142 wxListCtrl* _certificates;
143 wxButton* _add_certificate;
144 wxButton* _export_certificate;
145 wxButton* _remove_certificate;
146 wxButton* _remake_certificates;
147 wxStaticText* _private_key;
148 wxButton* _import_private_key;
149 wxButton* _export_private_key;
150 wxButton* _export_chain;
151 wxStaticText* _private_key_bad;
153 wxBoxSizer* _button_sizer;
154 std::function<void (std::shared_ptr<dcp::CertificateChain>)> _set;
155 std::function<std::shared_ptr<const dcp::CertificateChain> (void)> _get;
156 std::function<bool (void)> _nag_alter;
159 class KeysPage : public Page
162 KeysPage (wxSize panel_size, int border)
163 : Page (panel_size, border)
166 wxString GetName () const override;
169 wxBitmap GetLargeIcon () const override
171 return wxBitmap(icon_path("keys"), wxBITMAP_TYPE_PNG);
177 void setup () override;
179 void export_decryption_certificate ();
180 void config_changed () override {}
181 bool nag_alter_decryption_chain ();
182 void decryption_advanced ();
183 void signing_advanced ();
184 void export_decryption_chain_and_key ();
185 void import_decryption_chain_and_key ();
186 void remake_signing ();
190 class SoundPage : public Page
193 SoundPage (wxSize panel_size, int border)
194 : Page (panel_size, border)
197 wxString GetName() const override;
200 wxBitmap GetLargeIcon () const override
202 return wxBitmap(icon_path("sound"), wxBITMAP_TYPE_PNG);
208 void setup () override;
209 void config_changed () override;
210 boost::optional<std::string> get_sound_api();
211 boost::optional<std::string> get_sound_output ();
212 void sound_changed ();
213 void sound_api_changed();
214 void sound_output_changed ();
215 void setup_sensitivity ();
216 void map_changed (AudioMapping m);
217 void reset_to_default ();
218 void update_sound_outputs();
222 wxChoice* _sound_output;
223 wxStaticText* _sound_output_details;
224 AudioMappingView* _map;
225 Button* _reset_to_default;
229 class LocationsPage : public Page
232 LocationsPage (wxSize panel_size, int border);
234 wxString GetName () const override;
237 wxBitmap GetLargeIcon () const override;
241 void setup () override;
242 void config_changed () override;
243 void content_directory_changed ();
244 void playlist_directory_changed ();
245 void kdm_directory_changed ();
247 wxDirPickerCtrl* _content_directory;
248 wxDirPickerCtrl* _playlist_directory;
249 wxDirPickerCtrl* _kdm_directory;