summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-01-21 23:38:14 +0100
committerCarl Hetherington <cth@carlh.net>2022-03-09 17:04:02 +0100
commitcf65c2709664936940935996499ac87dc47515f0 (patch)
tree4eb00dddbf83e74ee0234d3d8279bff4ed688ba3 /src
parentcda2e5441938ebca1c94afd96f9a3a93e7bf3a08 (diff)
C++11 and general tidying.
Diffstat (limited to 'src')
-rw-r--r--src/lib/internet.cc4
-rw-r--r--src/lib/internet.h5
-rw-r--r--src/wx/christie_certificate_panel.cc2
-rw-r--r--src/wx/download_certificate_dialog.cc29
-rw-r--r--src/wx/screen_dialog.cc4
-rw-r--r--src/wx/screen_dialog.h2
6 files changed, 27 insertions, 19 deletions
diff --git a/src/lib/internet.cc b/src/lib/internet.cc
index ca72399f3..4fb6c7cb3 100644
--- a/src/lib/internet.cc
+++ b/src/lib/internet.cc
@@ -113,7 +113,7 @@ get_from_url (string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp)
/* Maximum time is 20s */
curl_easy_setopt (curl, CURLOPT_TIMEOUT, 20);
- CURLcode const cr = curl_easy_perform (curl);
+ auto const cr = curl_easy_perform (curl);
temp.close ();
curl_easy_cleanup (curl);
@@ -121,7 +121,7 @@ get_from_url (string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp)
return String::compose (_("Download failed (%1 error %2)"), url, (int) cr);
}
- return optional<string>();
+ return {};
}
diff --git a/src/lib/internet.h b/src/lib/internet.h
index 25513e666..f3cd2c6b4 100644
--- a/src/lib/internet.h
+++ b/src/lib/internet.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2022 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,8 +18,9 @@
*/
-#include <boost/optional.hpp>
+
#include <boost/filesystem.hpp>
+#include <boost/optional.hpp>
class ScopedTemporary;
diff --git a/src/wx/christie_certificate_panel.cc b/src/wx/christie_certificate_panel.cc
index ab131e015..4d9b1fcb7 100644
--- a/src/wx/christie_certificate_panel.cc
+++ b/src/wx/christie_certificate_panel.cc
@@ -68,7 +68,7 @@ ChristieCertificatePanel::do_download ()
if (error) {
all_errors = *error;
- string const url = String::compose ("%1IMB-S2/IMB-S2_%2_sha256.pem", prefix, serial);
+ auto const url = String::compose ("%1IMB-S2/IMB-S2_%2_sha256.pem", prefix, serial);
error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate_from_chain, this, _1));
if (error) {
diff --git a/src/wx/download_certificate_dialog.cc b/src/wx/download_certificate_dialog.cc
index 627223c46..4a80dc9c0 100644
--- a/src/wx/download_certificate_dialog.cc
+++ b/src/wx/download_certificate_dialog.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2022 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,22 +18,25 @@
*/
-#include "dolby_doremi_certificate_panel.h"
+
#include "barco_alchemy_certificate_panel.h"
#include "christie_certificate_panel.h"
+#include "dcpomatic_button.h"
+#include "dolby_doremi_certificate_panel.h"
+#include "download_certificate_dialog.h"
#include "gdc_certificate_panel.h"
#include "qube_certificate_panel.h"
-#include "download_certificate_dialog.h"
#include "static_text.h"
#include "wx_util.h"
-#include "dcpomatic_button.h"
+
using boost::optional;
+
DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent)
: wxDialog (parent, wxID_ANY, _("Download certificate"))
{
- wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+ auto sizer = new wxBoxSizer (wxVERTICAL);
_notebook = new wxNotebook (this, wxID_ANY);
sizer->Add (_notebook, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
@@ -43,7 +46,7 @@ DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent)
_message = new StaticText (this, wxT (""));
sizer->Add (_message, 0, wxALL, DCPOMATIC_SIZER_GAP);
- wxFont font = _message->GetFont();
+ auto font = _message->GetFont();
font.SetStyle (wxFONTSTYLE_ITALIC);
font.SetPointSize (font.GetPointSize() - 1);
_message->SetFont (font);
@@ -59,7 +62,7 @@ DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent)
_notebook->AddPage (i, i->name(), true);
}
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
+ auto buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
if (buttons) {
sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
}
@@ -77,36 +80,40 @@ DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent)
setup_sensitivity ();
}
+
DownloadCertificateDialog::~DownloadCertificateDialog ()
{
_notebook->Unbind (wxEVT_NOTEBOOK_PAGE_CHANGED, &DownloadCertificateDialog::page_changed, this);
}
+
void
DownloadCertificateDialog::download ()
{
_pages[_notebook->GetSelection()]->download ();
}
+
dcp::Certificate
DownloadCertificateDialog::certificate () const
{
- optional<dcp::Certificate> c = _pages[_notebook->GetSelection()]->certificate ();
+ auto c = _pages[_notebook->GetSelection()]->certificate ();
DCPOMATIC_ASSERT (c);
- return c.get ();
+ return *c;
}
void
DownloadCertificateDialog::setup_sensitivity ()
{
- DownloadCertificatePanel* p = _pages[_notebook->GetSelection()];
+ auto p = _pages[_notebook->GetSelection()];
_download->Enable (p->ready_to_download ());
- wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
+ auto ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
if (ok) {
ok->Enable (static_cast<bool>(p->certificate ()));
}
}
+
void
DownloadCertificateDialog::page_changed (wxNotebookEvent& ev)
{
diff --git a/src/wx/screen_dialog.cc b/src/wx/screen_dialog.cc
index 8da8f061e..3148d09d9 100644
--- a/src/wx/screen_dialog.cc
+++ b/src/wx/screen_dialog.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2022 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -132,7 +132,7 @@ ScreenDialog::ScreenDialog (
size.SetHeight (-1);
add_label_to_sizer (_sizer, this, _("Recipient certificate"), true, wxGBPosition(r, 0));
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ auto s = new wxBoxSizer (wxHORIZONTAL);
_recipient_thumbprint = new StaticText (this, wxT (""), wxDefaultPosition, size);
_recipient_thumbprint->SetFont (font);
set_recipient (recipient);
diff --git a/src/wx/screen_dialog.h b/src/wx/screen_dialog.h
index 2c2d8b8bf..49e4d092a 100644
--- a/src/wx/screen_dialog.h
+++ b/src/wx/screen_dialog.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2022 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.