diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-10-31 00:03:49 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-11-05 00:43:19 +0100 |
| commit | e8ce097ce705446c27b51199a321a9918deaa0db (patch) | |
| tree | 0a52cbc9c52791d453fa4bd478609aedde98c831 /src/wx | |
| parent | ef65a179e8c907029d0d9254863d4884581f3d60 (diff) | |
Allow specification of which parts of the DCP to encrypt (#3099).
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/dcp_panel.cc | 34 | ||||
| -rw-r--r-- | src/wx/dcp_panel.h | 6 | ||||
| -rw-r--r-- | src/wx/encryption_settings_dialog.cc | 64 | ||||
| -rw-r--r-- | src/wx/encryption_settings_dialog.h | 43 | ||||
| -rw-r--r-- | src/wx/wscript | 1 |
5 files changed, 142 insertions, 6 deletions
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 755ecfbaa..96b4b3cb5 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -27,6 +27,7 @@ #include "dcpomatic_button.h" #include "dcpomatic_choice.h" #include "dcpomatic_spin_ctrl.h" +#include "encryption_settings_dialog.h" #include "film_viewer.h" #include "focus_manager.h" #include "interop_metadata_dialog.h" @@ -103,6 +104,7 @@ DCPPanel::DCPPanel(wxNotebook* n, shared_ptr<Film> film, FilmViewer& viewer) _dcp_content_type = new Choice(_panel); _encrypted = new CheckBox(_panel, _("Encrypted")); + _encryption_settings = new Button(_panel, _("Encryption settings...")); wxClientDC dc(_panel); auto size = dc.GetTextExtent(char_to_wx("GGGGGGGG...")); @@ -126,6 +128,7 @@ DCPPanel::DCPPanel(wxNotebook* n, shared_ptr<Film> film, FilmViewer& viewer) _copy_isdcf_name_button->Bind(wxEVT_BUTTON, boost::bind(&DCPPanel::copy_isdcf_name_button_clicked, this)); _dcp_content_type->Bind(wxEVT_CHOICE, boost::bind(&DCPPanel::dcp_content_type_changed, this)); _encrypted->bind(&DCPPanel::encrypted_toggled, this); + _encryption_settings->bind(&DCPPanel::encryption_settings_clicked, this); _standard->Bind(wxEVT_CHOICE, boost::bind(&DCPPanel::standard_changed, this)); _markers->Bind(wxEVT_BUTTON, boost::bind(&DCPPanel::markers_clicked, this)); _metadata->Bind(wxEVT_BUTTON, boost::bind(&DCPPanel::metadata_clicked, this)); @@ -242,7 +245,8 @@ DCPPanel::add_to_grid() _grid->Add(_dcp_content_type, wxGBPosition(r, 1)); ++r; - _grid->Add(_encrypted, wxGBPosition(r, 0), wxGBSpan(1, 2)); + _grid->Add(_encrypted, wxGBPosition(r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); + _grid->Add(_encryption_settings, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); ++r; add_label_to_sizer(_grid, _standard_label, true, wxGBPosition(r, 0)); @@ -287,7 +291,23 @@ DCPPanel::encrypted_toggled() return; } - _film->set_encrypted(_encrypted->GetValue()); + auto new_value = !_film->encrypted(); + + _film->set_encrypt_picture(new_value); + _film->set_encrypt_sound(new_value); + _film->set_encrypt_text(new_value); +} + + +void +DCPPanel::encryption_settings_clicked() +{ + EncryptionSettingsDialog dialog(_panel, _film); + dialog.ShowModal(); + + _film->set_encrypt_picture(dialog.picture()); + _film->set_encrypt_sound(dialog.sound()); + _film->set_encrypt_text(dialog.text()); } @@ -394,8 +414,11 @@ DCPPanel::film_changed(FilmProperty p) setup_dcp_name(); break; } - case FilmProperty::ENCRYPTED: + case FilmProperty::ENCRYPT_PICTURE: + case FilmProperty::ENCRYPT_SOUND: + case FilmProperty::ENCRYPT_TEXT: checked_set(_encrypted, _film->encrypted()); + setup_sensitivity(); break; case FilmProperty::RESOLUTION: checked_set(_resolution, _film->resolution() == Resolution::TWO_K ? 0 : 1); @@ -624,7 +647,9 @@ DCPPanel::set_film(shared_ptr<Film> film) film_changed(FilmProperty::DCP_CONTENT_TYPE); film_changed(FilmProperty::CONTAINER); film_changed(FilmProperty::RESOLUTION); - film_changed(FilmProperty::ENCRYPTED); + film_changed(FilmProperty::ENCRYPT_PICTURE); + film_changed(FilmProperty::ENCRYPT_SOUND); + film_changed(FilmProperty::ENCRYPT_TEXT); film_changed(FilmProperty::VIDEO_BIT_RATE); film_changed(FilmProperty::VIDEO_FRAME_RATE); film_changed(FilmProperty::AUDIO_CHANNELS); @@ -664,6 +689,7 @@ DCPPanel::setup_sensitivity() _audio_language->Enable (_enable_audio_language->GetValue()); _edit_audio_language->Enable (_enable_audio_language->GetValue()); _encrypted->Enable (_generally_sensitive); + _encryption_settings->Enable (_generally_sensitive && _encrypted->GetValue()); _markers->Enable (_generally_sensitive && _film && !_film->interop()); _metadata->Enable (_generally_sensitive); _reels->Enable (_generally_sensitive && _film); diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h index 2196e8927..29ad83eaf 100644 --- a/src/wx/dcp_panel.h +++ b/src/wx/dcp_panel.h @@ -81,6 +81,7 @@ private: void three_d_changed(); void standard_changed(); void encrypted_toggled(); + void encryption_settings_clicked(); void audio_processor_changed(); void show_audio_clicked(); void markers_clicked(); @@ -153,8 +154,9 @@ private: wxStaticText* _standard_label; Choice* _standard; CheckBox* _encrypted; - wxButton* _markers; - wxButton* _metadata; + Button* _encryption_settings; + Button* _markers; + Button* _metadata; Button* _reels; wxSizer* _audio_panel_sizer; diff --git a/src/wx/encryption_settings_dialog.cc b/src/wx/encryption_settings_dialog.cc new file mode 100644 index 000000000..2fdb689c9 --- /dev/null +++ b/src/wx/encryption_settings_dialog.cc @@ -0,0 +1,64 @@ +/* + Copyright (C) 2025 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "check_box.h" +#include "encryption_settings_dialog.h" +#include "lib/film.h" + + +using std::shared_ptr; + + +EncryptionSettingsDialog::EncryptionSettingsDialog(wxWindow* parent, shared_ptr<const Film> film) + : TableDialog(parent, _("Encryption settings"), 1, 0, true) +{ + _picture = add(new CheckBox(this, _("Encrypt picture"))); + _sound = add(new CheckBox(this, _("Encrypt sound"))); + _text = add(new CheckBox(this, _("Encrypt text"))); + + layout(); + + _picture->set(film->encrypt_picture()); + _sound->set(film->encrypt_sound()); + _text->set(film->encrypt_text()); +} + + +bool +EncryptionSettingsDialog::picture() const +{ + return _picture->get(); +} + + +bool +EncryptionSettingsDialog::sound() const +{ + return _sound->get(); +} + + +bool +EncryptionSettingsDialog::text() const +{ + return _text->get(); +} + diff --git a/src/wx/encryption_settings_dialog.h b/src/wx/encryption_settings_dialog.h new file mode 100644 index 000000000..4ea3151c9 --- /dev/null +++ b/src/wx/encryption_settings_dialog.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2025 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "table_dialog.h" + + +class CheckBox; +class Film; + + +class EncryptionSettingsDialog : public TableDialog +{ +public: + EncryptionSettingsDialog(wxWindow* parent, std::shared_ptr<const Film> film); + + bool picture() const; + bool sound() const; + bool text() const; + +private: + CheckBox* _picture; + CheckBox* _sound; + CheckBox* _text; +}; + diff --git a/src/wx/wscript b/src/wx/wscript index ace747514..d3f3db88a 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -80,6 +80,7 @@ sources = """ drive_wipe_warning_dialog.cc email_dialog.cc email_preferences_page.cc + encryption_settings_dialog.cc export_subtitles_dialog.cc export_video_file_dialog.cc extra_kdm_email_dialog.cc |
