/*
- Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2019-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
-#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 <boost/algorithm/string/predicate.hpp>
+#include "lib/internet.h"
+#include <boost/algorithm/string.hpp>
+
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)
}
+
void
QubeCertificatePanel::do_download ()
{
- list<string> 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<string> 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;
return;
}
- optional<string> error = get_from_url (String::compose("%1SMPTE-%2/%3", base, _type, *name), true, false, boost::bind(&DownloadCertificatePanel::load, 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(""));
}
}
+
wxString
QubeCertificatePanel::name () const
{