summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-08-14 23:23:15 +0100
committerCarl Hetherington <cth@carlh.net>2018-08-15 10:57:06 +0100
commitc0d3ccb11d1bc31767a431c72f99e4a84c26b194 (patch)
treea67617ccd7c8091c39be10c960409357620260a3
parent10b6c135f34b9d5168142d0a8c3e06f4d91dae4b (diff)
Move some stuff into DownloadCertificatePanel; add name().
-rw-r--r--src/wx/dolby_doremi_certificate_panel.cc20
-rw-r--r--src/wx/dolby_doremi_certificate_panel.h3
-rw-r--r--src/wx/download_certificate_dialog.cc5
-rw-r--r--src/wx/download_certificate_panel.cc14
-rw-r--r--src/wx/download_certificate_panel.h4
5 files changed, 30 insertions, 16 deletions
diff --git a/src/wx/dolby_doremi_certificate_panel.cc b/src/wx/dolby_doremi_certificate_panel.cc
index 6f59b9147..5a0ce028e 100644
--- a/src/wx/dolby_doremi_certificate_panel.cc
+++ b/src/wx/dolby_doremi_certificate_panel.cc
@@ -50,17 +50,6 @@ DolbyDoremiCertificatePanel::DolbyDoremiCertificatePanel (wxWindow* parent, Down
layout ();
}
-void
-DolbyDoremiCertificatePanel::download (wxStaticText* message)
-{
- message->SetLabel (_("Downloading certificate"));
-
- /* Hack: without this the SetLabel() above has no visible effect */
- wxMilliSleep (200);
-
- signal_manager->when_idle (boost::bind (&DolbyDoremiCertificatePanel::finish_download, this, wx_to_std (_serial->GetValue ()), message));
-}
-
static void
try_dcp2000 (list<string>& urls, list<string>& files, string prefix, string serial)
{
@@ -156,13 +145,14 @@ try_cp850 (list<string>& urls, list<string>& files, string prefix, string serial
}
void
-DolbyDoremiCertificatePanel::finish_download (string serial, wxStaticText* message)
+DolbyDoremiCertificatePanel::do_download (wxStaticText* message)
{
/* Try dcp2000, imb and ims prefixes (see mantis #375) */
string const prefix = "ftp://anonymous@ftp.cinema.dolby.com/Certificates/";
list<string> urls;
list<string> files;
+ string const serial = wx_to_std (_serial->GetValue());
bool starts_with_digit = false;
optional<char> starting_char;
@@ -220,3 +210,9 @@ DolbyDoremiCertificatePanel::ready_to_download () const
{
return !_serial->IsEmpty ();
}
+
+wxString
+DolbyDoremiCertificatePanel::name () const
+{
+ return _("Dolby / Doremi");
+}
diff --git a/src/wx/dolby_doremi_certificate_panel.h b/src/wx/dolby_doremi_certificate_panel.h
index b8df76569..2e1e0f54e 100644
--- a/src/wx/dolby_doremi_certificate_panel.h
+++ b/src/wx/dolby_doremi_certificate_panel.h
@@ -26,7 +26,8 @@ public:
DolbyDoremiCertificatePanel (wxWindow* parent, DownloadCertificateDialog* dialog);
bool ready_to_download () const;
- void download (wxStaticText* message);
+ void do_download (wxStaticText* message);
+ wxString name () const;
private:
void finish_download (std::string serial, wxStaticText* message);
diff --git a/src/wx/download_certificate_dialog.cc b/src/wx/download_certificate_dialog.cc
index e18723a4a..b4d602092 100644
--- a/src/wx/download_certificate_dialog.cc
+++ b/src/wx/download_certificate_dialog.cc
@@ -34,7 +34,10 @@ DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent)
_pages.push_back (new DolbyDoremiCertificatePanel (_notebook, this));
_setup.push_back (false);
- _notebook->AddPage (_pages.back(), _("Dolby / Doremi"), true);
+
+ BOOST_FOREACH (DownloadCertificatePanel* i, _pages) {
+ _notebook->AddPage (i, i->name(), true);
+ }
_download = new wxButton (this, wxID_ANY, _("Download"));
sizer->Add (_download, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP);
diff --git a/src/wx/download_certificate_panel.cc b/src/wx/download_certificate_panel.cc
index 4052e44a6..0c78901eb 100644
--- a/src/wx/download_certificate_panel.cc
+++ b/src/wx/download_certificate_panel.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -20,6 +20,7 @@
#include "wx_util.h"
#include "download_certificate_panel.h"
+#include "lib/signal_manager.h"
#include <dcp/util.h>
#include <dcp/exceptions.h>
#include <boost/bind.hpp>
@@ -62,3 +63,14 @@ DownloadCertificatePanel::certificate () const
{
return _certificate;
}
+
+void
+DownloadCertificatePanel::download (wxStaticText* message)
+{
+ message->SetLabel (_("Downloading certificate"));
+
+ /* Hack: without this the SetLabel() above has no visible effect */
+ wxMilliSleep (200);
+
+ signal_manager->when_idle (boost::bind (&DownloadCertificatePanel::do_download, this, message));
+}
diff --git a/src/wx/download_certificate_panel.h b/src/wx/download_certificate_panel.h
index 6308e49b7..258d5ab25 100644
--- a/src/wx/download_certificate_panel.h
+++ b/src/wx/download_certificate_panel.h
@@ -35,8 +35,10 @@ public:
/* Do any setup that may take a noticeable amount of time */
virtual void setup () {}
virtual bool ready_to_download () const = 0;
- virtual void download (wxStaticText* message) = 0;
+ virtual void do_download (wxStaticText* message) = 0;
+ virtual wxString name () const = 0;
+ void download (wxStaticText* message);
void load (boost::filesystem::path);
boost::optional<dcp::Certificate> certificate () const;