summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-11-15 18:59:04 +0000
committerCarl Hetherington <cth@carlh.net>2015-11-15 18:59:04 +0000
commitf87c2a2b16517a015ac2f52f2cdeb99d6da9d5f6 (patch)
tree4b88829f2800d1a655d756825c3a3545a5a121f5 /src
parent1a14ae26a73489ae8990bfda1a432d229c3bb2d5 (diff)
Display thumbprint rather than whole certificate in screen dialogue.
Diffstat (limited to 'src')
-rw-r--r--src/wx/dolby_certificate_panel.cc1
-rw-r--r--src/wx/doremi_certificate_panel.cc1
-rw-r--r--src/wx/download_certificate_dialog.cc16
-rw-r--r--src/wx/download_certificate_panel.cc6
-rw-r--r--src/wx/download_certificate_panel.h2
-rw-r--r--src/wx/screen_dialog.cc26
-rw-r--r--src/wx/screen_dialog.h2
7 files changed, 33 insertions, 21 deletions
diff --git a/src/wx/dolby_certificate_panel.cc b/src/wx/dolby_certificate_panel.cc
index 8652f43b6..7e6404cfb 100644
--- a/src/wx/dolby_certificate_panel.cc
+++ b/src/wx/dolby_certificate_panel.cc
@@ -201,6 +201,7 @@ DolbyCertificatePanel::finish_download (wxStaticText* message)
message->SetLabel (std_to_wx (error.get ()));
} else {
message->SetLabel (_("Certificate downloaded"));
+ _dialog->setup_sensitivity ();
}
}
diff --git a/src/wx/doremi_certificate_panel.cc b/src/wx/doremi_certificate_panel.cc
index b80a660c1..8b54d1c37 100644
--- a/src/wx/doremi_certificate_panel.cc
+++ b/src/wx/doremi_certificate_panel.cc
@@ -103,6 +103,7 @@ DoremiCertificatePanel::finish_download (string serial, wxStaticText* message)
error_dialog (this, std_to_wx (error.get ()));
} else {
message->SetLabel (_("Certificate downloaded"));
+ _dialog->setup_sensitivity ();
}
}
diff --git a/src/wx/download_certificate_dialog.cc b/src/wx/download_certificate_dialog.cc
index 5a621d26f..743eb4a3d 100644
--- a/src/wx/download_certificate_dialog.cc
+++ b/src/wx/download_certificate_dialog.cc
@@ -22,6 +22,8 @@
#include "download_certificate_dialog.h"
#include "wx_util.h"
+using boost::optional;
+
DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent)
: wxDialog (parent, wxID_ANY, _("Download certificate"))
{
@@ -70,13 +72,21 @@ DownloadCertificateDialog::download ()
dcp::Certificate
DownloadCertificateDialog::certificate () const
{
- return _pages[_notebook->GetSelection()]->certificate ();
+ optional<dcp::Certificate> c = _pages[_notebook->GetSelection()]->certificate ();
+ DCPOMATIC_ASSERT (c);
+ return c.get ();
}
void
DownloadCertificateDialog::setup_sensitivity ()
{
- _download->Enable (_pages[_notebook->GetSelection()]->ready_to_download ());
+ DownloadCertificatePanel* p = _pages[_notebook->GetSelection()];
+ _download->Enable (p->ready_to_download ());
+ wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
+ if (ok) {
+ ok->Enable (p->certificate ());
+ }
+
}
void
@@ -87,4 +97,6 @@ DownloadCertificateDialog::page_changed ()
_pages[n]->setup ();
_setup[n] = true;
}
+
+ setup_sensitivity ();
}
diff --git a/src/wx/download_certificate_panel.cc b/src/wx/download_certificate_panel.cc
index 7b670261b..1379025c6 100644
--- a/src/wx/download_certificate_panel.cc
+++ b/src/wx/download_certificate_panel.cc
@@ -24,6 +24,7 @@
#include <boost/bind.hpp>
using boost::function;
+using boost::optional;
DownloadCertificatePanel::DownloadCertificatePanel (wxWindow* parent, DownloadCertificateDialog* dialog)
: wxPanel (parent, wxID_ANY)
@@ -55,9 +56,8 @@ DownloadCertificatePanel::load (boost::filesystem::path file)
}
}
-dcp::Certificate
+optional<dcp::Certificate>
DownloadCertificatePanel::certificate () const
{
- DCPOMATIC_ASSERT (_certificate);
- return _certificate.get ();
+ return _certificate;
}
diff --git a/src/wx/download_certificate_panel.h b/src/wx/download_certificate_panel.h
index 850236128..6f3c329b5 100644
--- a/src/wx/download_certificate_panel.h
+++ b/src/wx/download_certificate_panel.h
@@ -37,7 +37,7 @@ public:
virtual void download (wxStaticText* message) = 0;
void load (boost::filesystem::path);
- dcp::Certificate certificate () const;
+ boost::optional<dcp::Certificate> certificate () const;
protected:
void layout ();
diff --git a/src/wx/screen_dialog.cc b/src/wx/screen_dialog.cc
index 02bbe96ea..9857c9c17 100644
--- a/src/wx/screen_dialog.cc
+++ b/src/wx/screen_dialog.cc
@@ -40,22 +40,20 @@ ScreenDialog::ScreenDialog (wxWindow* parent, string title, string name, optiona
add (_("Certificate"), true);
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ _certificate_thumbprint = new wxStaticText (this, wxID_ANY, wxT (""));
+ wxFont font = _certificate_thumbprint->GetFont ();
+ font.SetFamily (wxFONTFAMILY_TELETYPE);
+ _certificate_thumbprint->SetFont (font);
+ if (certificate) {
+ _certificate_thumbprint->SetLabel (std_to_wx (certificate->thumbprint ()));
+ }
_load_certificate = new wxButton (this, wxID_ANY, _("Load from file..."));
_download_certificate = new wxButton (this, wxID_ANY, _("Download..."));
- s->Add (_load_certificate, 1, wxEXPAND);
- s->Add (_download_certificate, 1, wxEXPAND);
+ s->Add (_certificate_thumbprint, 1, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
+ s->Add (_load_certificate, 0, wxLEFT | wxRIGHT | wxEXPAND, DCPOMATIC_SIZER_X_GAP);
+ s->Add (_download_certificate, 0, wxLEFT | wxRIGHT | wxEXPAND, DCPOMATIC_SIZER_X_GAP);
add (s);
- add_spacer ();
- _certificate_text = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxSize (320, 256), wxTE_MULTILINE | wxTE_READONLY);
- if (certificate) {
- _certificate_text->SetValue (certificate->certificate ());
- }
- wxFont font = wxSystemSettings::GetFont (wxSYS_ANSI_FIXED_FONT);
- font.SetPointSize (font.GetPointSize() / 2);
- _certificate_text->SetFont (font);
- add (_certificate_text);
-
_load_certificate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ScreenDialog::select_certificate, this));
_download_certificate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ScreenDialog::download_certificate, this));
@@ -80,7 +78,7 @@ ScreenDialog::load_certificate (boost::filesystem::path file)
{
try {
_certificate = dcp::Certificate (dcp::file_to_string (file));
- _certificate_text->SetValue (std_to_wx (_certificate->certificate ()));
+ _certificate_thumbprint->SetLabel (std_to_wx (_certificate->thumbprint ()));
} catch (dcp::MiscError& e) {
error_dialog (this, wxString::Format (_("Could not read certificate file (%s)"), std_to_wx(e.what()).data()));
}
@@ -104,7 +102,7 @@ ScreenDialog::download_certificate ()
DownloadCertificateDialog* d = new DownloadCertificateDialog (this);
if (d->ShowModal() == wxID_OK) {
_certificate = d->certificate ();
- _certificate_text->SetValue (std_to_wx (_certificate->certificate ()));
+ _certificate_thumbprint->SetLabel (std_to_wx (_certificate->thumbprint ()));
}
d->Destroy ();
setup_sensitivity ();
diff --git a/src/wx/screen_dialog.h b/src/wx/screen_dialog.h
index 36686273a..1110bc992 100644
--- a/src/wx/screen_dialog.h
+++ b/src/wx/screen_dialog.h
@@ -40,9 +40,9 @@ private:
void setup_sensitivity ();
wxTextCtrl* _name;
+ wxStaticText* _certificate_thumbprint;
wxButton* _load_certificate;
wxButton* _download_certificate;
- wxTextCtrl* _certificate_text;
boost::optional<dcp::Certificate> _certificate;
};