+ explicit TrustedDeviceDialog (wxWindow* parent)
+ : TableDialog (parent, _("Trusted Device"), 3, 1, true)
+ {
+ add (_("Thumbprint"), true);
+ _thumbprint = add (new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(300, -1)));
+ _file = add (new Button(this, _("Load certificate...")));
+
+ layout ();
+
+ _file->Bind (wxEVT_BUTTON, bind(&TrustedDeviceDialog::load_certificate, this));
+ }
+
+ void load_certificate ()
+ {
+ auto dialog = new FileDialog(this, _("Trusted Device certificate"), wxEmptyString, wxFD_DEFAULT_STYLE, "SelectCertificatePath");
+ ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+ if (!dialog->show()) {
+ return;
+ }
+
+ try {
+ _certificate = dcp::Certificate(dcp::file_to_string(dialog->paths()[0]));
+ _thumbprint->SetValue (std_to_wx(_certificate->thumbprint()));
+ } catch (dcp::MiscError& e) {
+ error_dialog(this, wxString::Format(_("Could not load certificate (%s)"), std_to_wx(e.what())));
+ }
+ }
+
+ void set (TrustedDevice t)