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;
55 class Page : public wxPreferencesPage
58 Page (wxSize panel_size, int border);
61 wxWindow* CreateWindow (wxWindow* parent) override;
64 wxWindow* create_window (wxWindow* parent);
70 virtual void config_changed () = 0;
71 virtual void setup () = 0;
73 void config_changed_wrapper ();
74 void window_destroyed ();
77 boost::signals2::scoped_connection _config_connection;
82 class GeneralPage : public Page
85 GeneralPage (wxSize panel_size, int border);
87 wxString GetName () const override;
90 wxBitmap GetLargeIcon () const override
92 return wxBitmap(icon_path("general"), wxBITMAP_TYPE_PNG);
97 void add_language_controls (wxGridBagSizer* table, int& r);
98 void add_update_controls (wxGridBagSizer* table, int& r);
99 void config_changed () override;
102 void setup_sensitivity ();
103 void set_language_changed ();
104 void language_changed ();
105 void check_for_updates_changed ();
106 void check_for_test_updates_changed ();
108 CheckBox* _set_language;
110 CheckBox* _check_for_updates;
111 CheckBox* _check_for_test_updates;
115 class CertificateChainEditor : public wxDialog
118 CertificateChainEditor (
122 std::function<void (std::shared_ptr<dcp::CertificateChain>)> set,
123 std::function<std::shared_ptr<const dcp::CertificateChain> (void)> get,
124 std::function<bool (void)> nag_alter
127 void add_button (wxWindow* button);
130 void add_certificate ();
131 void remove_certificate ();
132 void export_certificate ();
133 void update_certificate_list ();
134 void remake_certificates ();
135 void update_sensitivity ();
136 void update_private_key ();
137 void import_private_key ();
138 void export_private_key ();
139 void export_chain ();
141 wxListCtrl* _certificates;
142 wxButton* _add_certificate;
143 wxButton* _export_certificate;
144 wxButton* _remove_certificate;
145 wxButton* _remake_certificates;
146 wxStaticText* _private_key;
147 wxButton* _import_private_key;
148 wxButton* _export_private_key;
149 wxButton* _export_chain;
150 wxStaticText* _private_key_bad;
152 wxBoxSizer* _button_sizer;
153 std::function<void (std::shared_ptr<dcp::CertificateChain>)> _set;
154 std::function<std::shared_ptr<const dcp::CertificateChain> (void)> _get;
155 std::function<bool (void)> _nag_alter;
158 class KeysPage : public Page
161 KeysPage (wxSize panel_size, int border)
162 : Page (panel_size, border)
165 wxString GetName () const override;
168 wxBitmap GetLargeIcon () const override
170 return wxBitmap(icon_path("keys"), wxBITMAP_TYPE_PNG);
176 void setup () override;
178 void export_decryption_certificate ();
179 void config_changed () override {}
180 bool nag_alter_decryption_chain ();
181 void decryption_advanced ();
182 void signing_advanced ();
183 void export_decryption_chain_and_key ();
184 void import_decryption_chain_and_key ();
185 void remake_signing ();
189 class SoundPage : public Page
192 SoundPage (wxSize panel_size, int border)
193 : Page (panel_size, border)
196 wxString GetName() const override;
199 wxBitmap GetLargeIcon () const override
201 return wxBitmap(icon_path("sound"), wxBITMAP_TYPE_PNG);
207 void setup () override;
208 void config_changed () override;
209 boost::optional<std::string> get_sound_output ();
210 void sound_changed ();
211 void sound_output_changed ();
212 void setup_sensitivity ();
213 void map_changed (AudioMapping m);
214 void reset_to_default ();
217 wxChoice* _sound_output;
218 wxStaticText* _sound_output_details;
219 AudioMappingView* _map;
220 Button* _reset_to_default;
224 class LocationsPage : public Page
227 LocationsPage (wxSize panel_size, int border);
229 wxString GetName () const override;
232 wxBitmap GetLargeIcon () const override;
236 void setup () override;
237 void config_changed () override;
238 void content_directory_changed ();
239 void playlist_directory_changed ();
240 void kdm_directory_changed ();
242 wxDirPickerCtrl* _content_directory;
243 wxDirPickerCtrl* _playlist_directory;
244 wxDirPickerCtrl* _kdm_directory;