2015-04-29 Carl Hetherington <cth@carlh.net>
+ * Allow configuration of the encryption key (from master).
+
* Various fixes to bad timeline drag behaviour when
snapping (from master).
-8471ccb29ff258722ea27405dc10312e625c132d
4156be8147c324623b266bd59366ff8accb34778
937b382efbeb9b7151359b8feb535e95f99f397c
signal_changed (ENCRYPTED);
}
+void
+Film::set_key (dcp::Key key)
+{
+ _key = key;
+ signal_changed (KEY);
+}
+
shared_ptr<Playlist>
Film::playlist () const
{
dcp::Formulation formulation
) const;
- dcp::Key key () const {
- return _key;
- }
-
int state_version () const {
return _state_version;
}
RESOLUTION,
SIGNED,
ENCRYPTED,
+ KEY,
J2K_BANDWIDTH,
ISDCF_METADATA,
VIDEO_FRAME_RATE,
return _encrypted;
}
+ dcp::Key key () const {
+ return _key;
+ }
+
int j2k_bandwidth () const {
return _j2k_bandwidth;
}
void set_resolution (Resolution);
void set_signed (bool);
void set_encrypted (bool);
+ void set_key (dcp::Key key);
void set_j2k_bandwidth (int);
void set_isdcf_metadata (ISDCFMetadata);
void set_video_frame_rate (int);
#include "dcp_panel.h"
#include "wx_util.h"
+#include "key_dialog.h"
#include "isdcf_metadata_dialog.h"
#include "lib/ratio.h"
#include "lib/config.h"
#include "lib/util.h"
#include "lib/film.h"
#include "lib/ffmpeg_content.h"
+#include <dcp/key.h>
#include <wx/wx.h>
#include <wx/notebook.h>
#include <wx/gbsizer.h>
grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
+ wxClientDC dc (_panel);
+ wxSize size = dc.GetTextExtent (wxT ("GGGGGGGG..."));
+ size.SetHeight (-1);
+
+ {
+ add_label_to_grid_bag_sizer (grid, _panel, _("Key"), true, wxGBPosition (r, 0));
+ wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ _key = new wxStaticText (_panel, wxID_ANY, "", wxDefaultPosition, size);
+ s->Add (_key, 1, wxALIGN_CENTER_VERTICAL);
+ _edit_key = new wxButton (_panel, wxID_ANY, _("Edit..."));
+ s->Add (_edit_key);
+ grid->Add (s, wxGBPosition (r, 1));
+ ++r;
+ }
+
add_label_to_grid_bag_sizer (grid, _panel, _("Standard"), true, wxGBPosition (r, 0));
_standard = new wxChoice (_panel, wxID_ANY);
grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
_dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::dcp_content_type_changed, this));
_signed->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::signed_toggled, this));
_encrypted->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::encrypted_toggled, this));
+ _edit_key->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::edit_key_clicked, this));
_standard->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::standard_changed, this));
vector<DCPContentType const *> const ct = DCPContentType::all ();
Config::instance()->Changed.connect (boost::bind (&DCPPanel::config_changed, this));
}
+void
+DCPPanel::edit_key_clicked ()
+{
+ KeyDialog* d = new KeyDialog (_panel, _film->key ());
+ if (d->ShowModal () == wxID_OK) {
+ _film->set_key (d->key ());
+ }
+ d->Destroy ();
+}
+
void
DCPPanel::name_changed ()
{
if (_film->encrypted ()) {
_film->set_signed (true);
_signed->Enable (false);
+ _key->Enable (_generally_sensitive);
+ _edit_key->Enable (_generally_sensitive);
} else {
_signed->Enable (_generally_sensitive);
+ _key->Enable (false);
+ _edit_key->Enable (false);
}
break;
+ case Film::KEY:
+ checked_set (_key, _film->key().hex().substr (0, 8) + "...");
+ break;
case Film::RESOLUTION:
checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
setup_dcp_name ();
film_changed (Film::SIGNED);
film_changed (Film::BURN_SUBTITLES);
film_changed (Film::ENCRYPTED);
+ film_changed (Film::KEY);
film_changed (Film::J2K_BANDWIDTH);
film_changed (Film::ISDCF_METADATA);
film_changed (Film::VIDEO_FRAME_RATE);
_signed->Enable (si);
_encrypted->Enable (s);
+ _key->Enable (s && _film && _film->encrypted ());
+ _edit_key->Enable (s && _film && _film->encrypted ());
_frame_rate_choice->Enable (s);
_frame_rate_spin->Enable (s);
_audio_channels->Enable (s);
void signed_toggled ();
void burn_subtitles_toggled ();
void encrypted_toggled ();
+ void edit_key_clicked ();
void setup_frame_rate_widget ();
void setup_container ();
wxCheckBox* _signed;
wxCheckBox* _burn_subtitles;
wxCheckBox* _encrypted;
+ wxStaticText* _key;
+ wxButton* _edit_key;
boost::shared_ptr<Film> _film;
bool _generally_sensitive;
--- /dev/null
+/*
+ Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+
+ This program 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.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "key_dialog.h"
+#include "wx_util.h"
+
+using std::cout;
+
+KeyDialog::KeyDialog (wxWindow* parent, dcp::Key key)
+ : TableDialog (parent, _("Key"), 3, true)
+{
+ add (_("Key"), true);
+
+ wxClientDC dc (parent);
+ wxSize size = dc.GetTextExtent (wxT ("0123456790ABCDEF0123456790ABCDEF"));
+ size.SetHeight (-1);
+
+ wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST);
+ wxArrayString list;
+
+ wxString n (wxT ("0123456789abcdefABCDEF"));
+ for (size_t i = 0; i < n.Length(); ++i) {
+ list.Add (n[i]);
+ }
+
+ validator.SetIncludes (list);
+
+ _key = add (new wxTextCtrl (this, wxID_ANY, _(""), wxDefaultPosition, size, 0, validator));
+ _key->SetValue (std_to_wx (key.hex ()));
+ _key->SetMaxLength (32);
+
+ _random = add (new wxButton (this, wxID_ANY, _("Random")));
+
+ _key->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KeyDialog::key_changed, this));
+ _random->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeyDialog::random, this));
+
+ layout ();
+}
+
+dcp::Key
+KeyDialog::key () const
+{
+ return dcp::Key (wx_to_std (_key->GetValue ()));
+}
+
+void
+KeyDialog::key_changed ()
+{
+ wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK));
+ ok->Enable (_key->GetValue().Length() == 32);
+}
+
+void
+KeyDialog::random ()
+{
+ _key->SetValue (dcp::Key().hex ());
+}
--- /dev/null
+/*
+ Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+
+ This program 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.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "table_dialog.h"
+#include <dcp/key.h>
+
+class KeyDialog : public TableDialog
+{
+public:
+ KeyDialog (wxWindow *, dcp::Key);
+
+ dcp::Key key () const;
+
+private:
+ void key_changed ();
+ void random ();
+
+ wxTextCtrl* _key;
+ wxButton* _random;
+};
if (_snap) {
- DCPTime const new_end = new_position + _down_view->content()->length_after_trim () - 1;
+ DCPTime const new_end = new_position + _down_view->content()->length_after_trim () - DCPTime (1);
/* Signed `distance' to nearest thing (i.e. negative is left on the timeline,
positive is right).
*/
}
maybe_snap (cv->content()->position(), new_position, nearest_distance);
- maybe_snap (cv->content()->position(), new_end + 1, nearest_distance);
- maybe_snap (cv->content()->end() + 1, new_position, nearest_distance);
- maybe_snap (cv->content()->end() + 1, new_end, nearest_distance);
+ maybe_snap (cv->content()->position(), new_end + DCPTime (1), nearest_distance);
+ maybe_snap (cv->content()->end() + DCPTime (1), new_position, nearest_distance);
+ maybe_snap (cv->content()->end() + DCPTime (1), new_end, nearest_distance);
}
if (nearest_distance) {
hints_dialog.cc
job_manager_view.cc
kdm_dialog.cc
+ key_dialog.cc
make_signer_chain_dialog.cc
new_film_dialog.cc
preset_colour_conversion_dialog.cc