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"
36 #include <dcp/certificate_chain.h>
37 #include <dcp/exceptions.h>
38 #include <dcp/locale_convert.h>
39 #include <dcp/warnings.h>
40 LIBDCP_DISABLE_WARNINGS
41 #include <wx/filepicker.h>
42 #include <wx/preferences.h>
43 #include <wx/spinctrl.h>
44 #include <wx/stdpaths.h>
46 LIBDCP_ENABLE_WARNINGS
47 #include <boost/filesystem.hpp>
50 class AudioMappingView;
54 class Page : public wxPreferencesPage
57 Page (wxSize panel_size, int border);
60 wxWindow* CreateWindow (wxWindow* parent) override;
63 wxWindow* create_window (wxWindow* parent);
69 virtual void config_changed () = 0;
70 virtual void setup () = 0;
72 void config_changed_wrapper ();
73 void window_destroyed ();
76 boost::signals2::scoped_connection _config_connection;
81 class GeneralPage : public Page
84 GeneralPage (wxSize panel_size, int border);
86 wxString GetName () const override;
89 wxBitmap GetLargeIcon () const override
91 return wxBitmap(icon_path("general"), wxBITMAP_TYPE_PNG);
96 void add_language_controls (wxGridBagSizer* table, int& r);
97 void add_update_controls (wxGridBagSizer* table, int& r);
98 void config_changed () override;
101 void setup_sensitivity ();
102 void set_language_changed ();
103 void language_changed ();
104 void check_for_updates_changed ();
105 void check_for_test_updates_changed ();
107 CheckBox* _set_language;
109 CheckBox* _check_for_updates;
110 CheckBox* _check_for_test_updates;
114 class CertificateChainEditor : public wxDialog
117 CertificateChainEditor (
121 std::function<void (std::shared_ptr<dcp::CertificateChain>)> set,
122 std::function<std::shared_ptr<const dcp::CertificateChain> (void)> get,
123 std::function<bool (void)> nag_alter
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 ();
138 void export_chain ();
140 wxListCtrl* _certificates;
141 wxButton* _add_certificate;
142 wxButton* _export_certificate;
143 wxButton* _remove_certificate;
144 wxButton* _remake_certificates;
145 wxStaticText* _private_key;
146 wxButton* _import_private_key;
147 wxButton* _export_private_key;
148 wxButton* _export_chain;
149 wxStaticText* _private_key_bad;
151 wxBoxSizer* _button_sizer;
152 std::function<void (std::shared_ptr<dcp::CertificateChain>)> _set;
153 std::function<std::shared_ptr<const dcp::CertificateChain> (void)> _get;
154 std::function<bool (void)> _nag_alter;
157 class KeysPage : public Page
160 KeysPage (wxSize panel_size, int border)
161 : Page (panel_size, border)
164 wxString GetName () const override;
167 wxBitmap GetLargeIcon () const override
169 return wxBitmap(icon_path("keys"), wxBITMAP_TYPE_PNG);
175 void setup () override;
177 void export_decryption_certificate ();
178 void config_changed () override {}
179 bool nag_alter_decryption_chain ();
180 void decryption_advanced ();
181 void signing_advanced ();
182 void export_decryption_chain_and_key ();
183 void import_decryption_chain_and_key ();
184 void remake_signing ();
188 class SoundPage : public Page
191 SoundPage (wxSize panel_size, int border)
192 : Page (panel_size, border)
195 wxString GetName() const override;
198 wxBitmap GetLargeIcon () const override
200 return wxBitmap(icon_path("sound"), wxBITMAP_TYPE_PNG);
206 void setup () override;
207 void config_changed () override;
208 boost::optional<std::string> get_sound_output ();
209 void sound_changed ();
210 void sound_output_changed ();
211 void setup_sensitivity ();
212 void map_changed (AudioMapping m);
213 void reset_to_default ();
216 wxChoice* _sound_output;
217 wxStaticText* _sound_output_details;
218 AudioMappingView* _map;
219 Button* _reset_to_default;
223 class LocationsPage : public Page
226 LocationsPage (wxSize panel_size, int border);
228 wxString GetName () const override;
231 wxBitmap GetLargeIcon () const override;
235 void setup () override;
236 void config_changed () override;
237 void content_directory_changed ();
238 void playlist_directory_changed ();
239 void kdm_directory_changed ();
241 wxDirPickerCtrl* _content_directory;
242 wxDirPickerCtrl* _playlist_directory;
243 wxDirPickerCtrl* _kdm_directory;