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 "lib/warnings.h"
36 #include <dcp/locale_convert.h>
37 #include <dcp/exceptions.h>
38 #include <dcp/certificate_chain.h>
39 DCPOMATIC_DISABLE_WARNINGS
40 #include <wx/stdpaths.h>
41 #include <wx/preferences.h>
42 #include <wx/spinctrl.h>
43 #include <wx/filepicker.h>
44 DCPOMATIC_ENABLE_WARNINGS
46 #include <boost/filesystem.hpp>
49 class AudioMappingView;
51 class Page : public wxPreferencesPage
54 Page (wxSize panel_size, int border);
57 wxWindow* CreateWindow (wxWindow* parent);
60 wxWindow* create_window (wxWindow* parent);
66 virtual void config_changed () = 0;
67 virtual void setup () = 0;
69 void config_changed_wrapper ();
70 void window_destroyed ();
73 boost::signals2::scoped_connection _config_connection;
77 class GeneralPage : public Page
80 GeneralPage (wxSize panel_size, int border);
82 wxString GetName () const;
85 wxBitmap GetLargeIcon () const
87 return wxBitmap ("general", wxBITMAP_TYPE_PNG_RESOURCE);
92 void add_language_controls (wxGridBagSizer* table, int& r);
93 void add_update_controls (wxGridBagSizer* table, int& r);
94 virtual void config_changed ();
97 void setup_sensitivity ();
98 void set_language_changed ();
99 void language_changed ();
100 void check_for_updates_changed ();
101 void check_for_test_updates_changed ();
103 wxCheckBox* _set_language;
105 wxCheckBox* _check_for_updates;
106 wxCheckBox* _check_for_test_updates;
109 class CertificateChainEditor : public wxDialog
112 CertificateChainEditor (
116 std::function<void (std::shared_ptr<dcp::CertificateChain>)> set,
117 std::function<std::shared_ptr<const dcp::CertificateChain> (void)> get,
118 std::function<bool (void)> nag_alter
121 void add_button (wxWindow* button);
124 void add_certificate ();
125 void remove_certificate ();
126 void export_certificate ();
127 void update_certificate_list ();
128 void remake_certificates ();
129 void update_sensitivity ();
130 void update_private_key ();
131 void import_private_key ();
132 void export_private_key ();
133 void export_chain ();
135 wxListCtrl* _certificates;
136 wxButton* _add_certificate;
137 wxButton* _export_certificate;
138 wxButton* _remove_certificate;
139 wxButton* _remake_certificates;
140 wxStaticText* _private_key;
141 wxButton* _import_private_key;
142 wxButton* _export_private_key;
143 wxButton* _export_chain;
144 wxStaticText* _private_key_bad;
146 wxBoxSizer* _button_sizer;
147 std::function<void (std::shared_ptr<dcp::CertificateChain>)> _set;
148 std::function<std::shared_ptr<const dcp::CertificateChain> (void)> _get;
149 std::function<bool (void)> _nag_alter;
152 class KeysPage : public Page
155 KeysPage (wxSize panel_size, int border)
156 : Page (panel_size, border)
159 wxString GetName () const;
162 wxBitmap GetLargeIcon () const
164 return wxBitmap ("keys", wxBITMAP_TYPE_PNG_RESOURCE);
172 void export_decryption_certificate ();
173 void config_changed () {}
174 bool nag_alter_decryption_chain ();
175 void decryption_advanced ();
176 void signing_advanced ();
177 void export_decryption_chain_and_key ();
178 void import_decryption_chain_and_key ();
182 class SoundPage : public Page
185 SoundPage (wxSize panel_size, int border)
186 : Page (panel_size, border)
189 wxString GetName() const;
192 wxBitmap GetLargeIcon () const
194 return wxBitmap ("sound", wxBITMAP_TYPE_PNG_RESOURCE);
201 void config_changed ();
202 boost::optional<std::string> get_sound_output ();
203 void sound_changed ();
204 void sound_output_changed ();
205 void setup_sensitivity ();
206 void map_changed (AudioMapping m);
207 void reset_to_default ();
210 wxChoice* _sound_output;
211 wxStaticText* _sound_output_details;
212 AudioMappingView* _map;
213 Button* _reset_to_default;
216 class LocationsPage : public Page
219 LocationsPage (wxSize panel_size, int border);
221 wxString GetName () const;
224 wxBitmap GetLargeIcon () const;
229 void config_changed ();
230 void content_directory_changed ();
231 void playlist_directory_changed ();
232 void kdm_directory_changed ();
234 wxDirPickerCtrl* _content_directory;
235 wxDirPickerCtrl* _playlist_directory;
236 wxDirPickerCtrl* _kdm_directory;