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>
47 #include <boost/foreach.hpp>
50 class AudioMappingView;
52 class Page : public wxPreferencesPage
55 Page (wxSize panel_size, int border);
58 wxWindow* CreateWindow (wxWindow* parent);
61 wxWindow* create_window (wxWindow* parent);
67 virtual void config_changed () = 0;
68 virtual void setup () = 0;
70 void config_changed_wrapper ();
71 void window_destroyed ();
74 boost::signals2::scoped_connection _config_connection;
78 class GeneralPage : public Page
81 GeneralPage (wxSize panel_size, int border);
83 wxString GetName () const;
86 wxBitmap GetLargeIcon () const
88 return wxBitmap ("general", wxBITMAP_TYPE_PNG_RESOURCE);
93 void add_language_controls (wxGridBagSizer* table, int& r);
94 void add_update_controls (wxGridBagSizer* table, int& r);
95 virtual void config_changed ();
98 void setup_sensitivity ();
99 void set_language_changed ();
100 void language_changed ();
101 void check_for_updates_changed ();
102 void check_for_test_updates_changed ();
104 wxCheckBox* _set_language;
106 wxCheckBox* _check_for_updates;
107 wxCheckBox* _check_for_test_updates;
110 class CertificateChainEditor : public wxDialog
113 CertificateChainEditor (
117 boost::function<void (boost::shared_ptr<dcp::CertificateChain>)> set,
118 boost::function<boost::shared_ptr<const dcp::CertificateChain> (void)> get,
119 boost::function<bool (void)> nag_alter
122 void add_button (wxWindow* button);
125 void add_certificate ();
126 void remove_certificate ();
127 void export_certificate ();
128 void update_certificate_list ();
129 void remake_certificates ();
130 void update_sensitivity ();
131 void update_private_key ();
132 void import_private_key ();
133 void export_private_key ();
134 void export_chain ();
136 wxListCtrl* _certificates;
137 wxButton* _add_certificate;
138 wxButton* _export_certificate;
139 wxButton* _remove_certificate;
140 wxButton* _remake_certificates;
141 wxStaticText* _private_key;
142 wxButton* _import_private_key;
143 wxButton* _export_private_key;
144 wxButton* _export_chain;
145 wxStaticText* _private_key_bad;
147 wxBoxSizer* _button_sizer;
148 boost::function<void (boost::shared_ptr<dcp::CertificateChain>)> _set;
149 boost::function<boost::shared_ptr<const dcp::CertificateChain> (void)> _get;
150 boost::function<bool (void)> _nag_alter;
153 class KeysPage : public Page
156 KeysPage (wxSize panel_size, int border)
157 : Page (panel_size, border)
160 wxString GetName () const;
163 wxBitmap GetLargeIcon () const
165 return wxBitmap ("keys", wxBITMAP_TYPE_PNG_RESOURCE);
173 void export_decryption_certificate ();
174 void config_changed () {}
175 bool nag_alter_decryption_chain ();
176 void decryption_advanced ();
177 void signing_advanced ();
178 void export_decryption_chain_and_key ();
179 void import_decryption_chain_and_key ();
183 class SoundPage : public Page
186 SoundPage (wxSize panel_size, int border)
187 : Page (panel_size, border)
190 wxString GetName() const;
193 wxBitmap GetLargeIcon () const
195 return wxBitmap ("sound", wxBITMAP_TYPE_PNG_RESOURCE);
202 void config_changed ();
203 boost::optional<std::string> get_sound_output ();
204 void sound_changed ();
205 void sound_output_changed ();
206 void setup_sensitivity ();
207 void map_changed (AudioMapping m);
208 void reset_to_default ();
211 wxChoice* _sound_output;
212 wxStaticText* _sound_output_details;
213 AudioMappingView* _map;
214 Button* _reset_to_default;
217 class LocationsPage : public Page
220 LocationsPage (wxSize panel_size, int border);
222 wxString GetName () const;
225 wxBitmap GetLargeIcon () const;
230 void config_changed ();
231 void content_directory_changed ();
232 void playlist_directory_changed ();
233 void kdm_directory_changed ();
235 #ifdef DCPOMATIC_VARIANT_SWAROOP
236 void background_image_changed ();
239 wxDirPickerCtrl* _content_directory;
240 wxDirPickerCtrl* _playlist_directory;
241 wxDirPickerCtrl* _kdm_directory;
242 #ifdef DCPOMATIC_VARIANT_SWAROOP
243 FilePickerCtrl* _background_image;