X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fqube_certificate_panel.cc;h=b40a9ecf64e1d2c6b86a93026cc96683600fcd82;hb=5fa6584826d7c356451bcea46928c1721f857ca5;hp=70fe0ae4777a84ba5ceaed4bbd43c3737d876e7e;hpb=06fd921dd4cac01673183a996feb70a00a1df083;p=dcpomatic.git diff --git a/src/wx/qube_certificate_panel.cc b/src/wx/qube_certificate_panel.cc index 70fe0ae47..b40a9ecf6 100644 --- a/src/wx/qube_certificate_panel.cc +++ b/src/wx/qube_certificate_panel.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2019 Carl Hetherington + Copyright (C) 2019-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,23 +18,28 @@ */ -#include "qube_certificate_panel.h" + #include "download_certificate_dialog.h" +#include "qube_certificate_panel.h" #include "wx_util.h" -#include "lib/internet.h" #include "lib/compose.hpp" #include "lib/config.h" -#include +#include "lib/internet.h" +#include + using std::string; using std::list; +using namespace boost::algorithm; using boost::optional; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif + static string const base = "ftp://certificates.qubecinema.com/"; + QubeCertificatePanel::QubeCertificatePanel (DownloadCertificateDialog* dialog, string type) : DownloadCertificatePanel (dialog) , _type (type) @@ -42,18 +47,21 @@ QubeCertificatePanel::QubeCertificatePanel (DownloadCertificateDialog* dialog, s } + void QubeCertificatePanel::do_download () { - list files = ls_url(String::compose("%1SMPTE-%2/", base, _type)); + auto files = ls_url(String::compose("%1SMPTE-%2/", base, _type)); if (files.empty()) { error_dialog (this, _("Could not read certificates from Qube server.")); return; } - string const serial = wx_to_std(_serial->GetValue()); + auto serial = wx_to_std(_serial->GetValue()); + trim(serial); + optional name; - BOOST_FOREACH (string i, files) { + for (auto i: files) { if (boost::algorithm::starts_with(i, String::compose("%1-%2-", _type, serial))) { name = i; break; @@ -66,7 +74,7 @@ QubeCertificatePanel::do_download () return; } - optional error = get_from_url (String::compose("%1SMPTE-%2/%3", base, _type, *name), true, false, boost::bind(&DownloadCertificatePanel::load_certificate, this, _1)); + auto error = get_from_url (String::compose("%1SMPTE-%2/%3", base, _type, *name), true, false, boost::bind(&DownloadCertificatePanel::load_certificate, this, _1, _2)); if (error) { _dialog->message()->SetLabel(wxT("")); @@ -77,6 +85,7 @@ QubeCertificatePanel::do_download () } } + wxString QubeCertificatePanel::name () const {