#include <dcp/raw_convert.h>
#include <curl/curl.h>
#include <zip.h>
-#include <boost/foreach.hpp>
#include <iostream>
using std::string;
using std::list;
using boost::function;
using boost::optional;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
using dcp::raw_convert;
-DolbyDoremiCertificatePanel::DolbyDoremiCertificatePanel (wxWindow* parent, DownloadCertificateDialog* dialog)
- : DownloadCertificatePanel (parent, dialog)
+DolbyDoremiCertificatePanel::DolbyDoremiCertificatePanel (DownloadCertificateDialog* dialog)
+ : DownloadCertificatePanel (dialog)
{
- add_label_to_sizer (_table, this, _("Serial number"), true);
- _serial = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxSize (300, -1));
- _table->Add (_serial, 1, wxEXPAND);
- _serial->Bind (wxEVT_TEXT, boost::bind (&DownloadCertificateDialog::setup_sensitivity, _dialog));
-
- 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
}
void
-DolbyDoremiCertificatePanel::finish_download (string serial, wxStaticText* message)
+DolbyDoremiCertificatePanel::do_download ()
{
+ string const serial = wx_to_std (_serial->GetValue());
+
/* Try dcp2000, imb and ims prefixes (see mantis #375) */
- string const prefix = "ftp://anonymous@ftp.cinema.dolby.com/Certificates/";
+ string const prefix = "ftp://ftp.cinema.dolby.com/Certificates/";
list<string> urls;
list<string> files;
list<string>::const_iterator i = urls.begin ();
list<string>::const_iterator j = files.begin ();
while (!ok && i != urls.end ()) {
- optional<string> error = get_from_zip_url (*i++, *j++, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+ optional<string> error = get_from_zip_url (*i++, *j++, true, true, boost::bind (&DownloadCertificatePanel::load_certificate, this, _1));
if (error) {
errors.push_back (error.get ());
} else {
}
if (ok) {
- message->SetLabel (_("Certificate downloaded"));
+ _dialog->message()->SetLabel (_("Certificate downloaded"));
_dialog->setup_sensitivity ();
} else {
- message->SetLabel (wxT (""));
+ _dialog->message()->SetLabel (wxT (""));
string s;
- BOOST_FOREACH (string e, errors) {
+ for (auto e: errors) {
s += e + "\n";
}
}
}
-bool
-DolbyDoremiCertificatePanel::ready_to_download () const
+wxString
+DolbyDoremiCertificatePanel::name () const
{
- return !_serial->IsEmpty ();
+ return _("Dolby / Doremi");
}