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 <dcp/locale_convert.h>
36 #include <dcp/exceptions.h>
37 #include <dcp/certificate_chain.h>
38 #include <wx/stdpaths.h>
39 #include <wx/preferences.h>
40 #include <wx/spinctrl.h>
41 #include <wx/filepicker.h>
43 #include <boost/filesystem.hpp>
44 #include <boost/foreach.hpp>
47 class AudioMappingView;
49 class Page : public wxPreferencesPage
52 Page (wxSize panel_size, int border);
55 wxWindow* CreateWindow (wxWindow* parent);
58 wxWindow* create_window (wxWindow* parent);
64 virtual void config_changed () = 0;
65 virtual void setup () = 0;
67 void config_changed_wrapper ();
68 void window_destroyed ();
71 boost::signals2::scoped_connection _config_connection;
75 class GeneralPage : public Page
78 GeneralPage (wxSize panel_size, int border);
80 wxString GetName () const;
83 wxBitmap GetLargeIcon () const
85 return wxBitmap ("general", wxBITMAP_TYPE_PNG_RESOURCE);
90 void add_language_controls (wxGridBagSizer* table, int& r);
91 void add_update_controls (wxGridBagSizer* table, int& r);
92 virtual void config_changed ();
95 void setup_sensitivity ();
96 void set_language_changed ();
97 void language_changed ();
98 void check_for_updates_changed ();
99 void check_for_test_updates_changed ();
101 wxCheckBox* _set_language;
103 wxCheckBox* _check_for_updates;
104 wxCheckBox* _check_for_test_updates;
107 class CertificateChainEditor : public wxDialog
110 CertificateChainEditor (
114 boost::function<void (boost::shared_ptr<dcp::CertificateChain>)> set,
115 boost::function<boost::shared_ptr<const dcp::CertificateChain> (void)> get,
116 boost::function<bool (void)> nag_alter
119 void add_button (wxWindow* button);
122 void add_certificate ();
123 void remove_certificate ();
124 void export_certificate ();
125 void update_certificate_list ();
126 void remake_certificates ();
127 void update_sensitivity ();
128 void update_private_key ();
129 void import_private_key ();
130 void export_private_key ();
131 void export_chain ();
133 wxListCtrl* _certificates;
134 wxButton* _add_certificate;
135 wxButton* _export_certificate;
136 wxButton* _remove_certificate;
137 wxButton* _remake_certificates;
138 wxStaticText* _private_key;
139 wxButton* _import_private_key;
140 wxButton* _export_private_key;
141 wxButton* _export_chain;
142 wxStaticText* _private_key_bad;
144 wxBoxSizer* _button_sizer;
145 boost::function<void (boost::shared_ptr<dcp::CertificateChain>)> _set;
146 boost::function<boost::shared_ptr<const dcp::CertificateChain> (void)> _get;
147 boost::function<bool (void)> _nag_alter;
150 class KeysPage : public Page
153 KeysPage (wxSize panel_size, int border)
154 : Page (panel_size, border)
157 wxString GetName () const;
160 wxBitmap GetLargeIcon () const
162 return wxBitmap ("keys", wxBITMAP_TYPE_PNG_RESOURCE);
170 void export_decryption_certificate ();
171 void config_changed () {}
172 bool nag_alter_decryption_chain ();
173 void decryption_advanced ();
174 void signing_advanced ();
175 void export_decryption_chain_and_key ();
176 void import_decryption_chain_and_key ();
180 class SoundPage : public Page
183 SoundPage (wxSize panel_size, int border)
184 : Page (panel_size, border)
187 wxString GetName() const;
190 wxBitmap GetLargeIcon () const
192 return wxBitmap ("sound", wxBITMAP_TYPE_PNG_RESOURCE);
199 void config_changed ();
200 boost::optional<std::string> get_sound_output ();
201 void sound_changed ();
202 void sound_output_changed ();
203 void setup_sensitivity ();
204 void map_changed (AudioMapping m);
205 void reset_to_default ();
208 wxChoice* _sound_output;
209 wxStaticText* _sound_output_details;
210 AudioMappingView* _map;
211 Button* _reset_to_default;
214 class LocationsPage : public Page
217 LocationsPage (wxSize panel_size, int border);
219 wxString GetName () const;
222 wxBitmap GetLargeIcon () const;
227 void config_changed ();
228 void content_directory_changed ();
229 void playlist_directory_changed ();
230 void kdm_directory_changed ();
232 #ifdef DCPOMATIC_VARIANT_SWAROOP
233 void background_image_changed ();
236 wxDirPickerCtrl* _content_directory;
237 wxDirPickerCtrl* _playlist_directory;
238 wxDirPickerCtrl* _kdm_directory;
239 #ifdef DCPOMATIC_VARIANT_SWAROOP
240 FilePickerCtrl* _background_image;