From: Carl Hetherington Date: Wed, 20 Oct 2021 21:12:41 +0000 (+0100) Subject: Assorted tidying up. X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=f1ea52e954cc466d70b5d5ee530a7af5d41b9cc6;p=dcpomatic.git Assorted tidying up. --- diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index 95f2f4039..a06040ef9 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2017 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,37 +18,41 @@ */ + +#include "lib/audio_content.h" +#include "lib/config.h" +#include "lib/cross.h" +#include "lib/dcpomatic_log.h" +#include "lib/encode_server_finder.h" #include "lib/film.h" #include "lib/filter.h" -#include "lib/transcode_job.h" #include "lib/job_manager.h" -#include "lib/util.h" -#include "lib/version.h" -#include "lib/cross.h" -#include "lib/config.h" -#include "lib/log.h" -#include "lib/signal_manager.h" -#include "lib/encode_server_finder.h" #include "lib/json_server.h" +#include "lib/log.h" #include "lib/ratio.h" +#include "lib/signal_manager.h" +#include "lib/transcode_job.h" +#include "lib/util.h" +#include "lib/version.h" #include "lib/video_content.h" -#include "lib/audio_content.h" -#include "lib/dcpomatic_log.h" #include #include #include #include -using std::string; + using std::cerr; using std::cout; -using std::vector; +using std::dynamic_pointer_cast; +using std::list; +using std::make_shared; using std::pair; using std::setw; -using std::list; using std::shared_ptr; +using std::string; +using std::vector; using boost::optional; -using std::dynamic_pointer_cast; + static void help (string n) @@ -72,6 +76,7 @@ help (string n) << " is the film directory.\n"; } + static void print_dump (shared_ptr film) { @@ -120,6 +125,7 @@ print_dump (shared_ptr film) } } + static void list_servers () { @@ -327,7 +333,7 @@ main (int argc, char* argv[]) shared_ptr film; try { - film.reset (new Film (film_dir)); + film = make_shared(film_dir); film->read_metadata (); } catch (std::exception& e) { cerr << argv[0] << ": error reading film `" << film_dir.string() << "' (" << e.what() << ")\n"; diff --git a/src/wx/audio_gain_dialog.cc b/src/wx/audio_gain_dialog.cc index fb9bd2544..a53d7e4d9 100644 --- a/src/wx/audio_gain_dialog.cc +++ b/src/wx/audio_gain_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2020 Carl Hetherington + Copyright (C) 2014-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,11 +18,13 @@ */ + #include "audio_gain_dialog.h" #include "wx_util.h" #include "lib/util.h" -#include #include +#include + AudioGainDialog::AudioGainDialog (wxWindow* parent, int c, int d, float v) : TableDialog (parent, _("Channel gain"), 3, 1, true) @@ -42,6 +44,7 @@ AudioGainDialog::AudioGainDialog (wxWindow* parent, int c, int d, float v) _gain->SetFocus (); } + float AudioGainDialog::value () const { diff --git a/src/wx/audio_gain_dialog.h b/src/wx/audio_gain_dialog.h index 9f9c973cf..2fd0d5cba 100644 --- a/src/wx/audio_gain_dialog.h +++ b/src/wx/audio_gain_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,10 +18,13 @@ */ + #include "table_dialog.h" + class wxSpinCtrlDouble; + class AudioGainDialog : public TableDialog { public: diff --git a/src/wx/download_certificate_dialog.cc b/src/wx/download_certificate_dialog.cc index 627223c46..89102c084 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 + Copyright (C) 2014-2021 Carl Hetherington 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); @@ -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,41 @@ 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 c = _pages[_notebook->GetSelection()]->certificate (); + auto c = _pages[_notebook->GetSelection()]->certificate(); DCPOMATIC_ASSERT (c); return c.get (); } + void DownloadCertificateDialog::setup_sensitivity () { - DownloadCertificatePanel* p = _pages[_notebook->GetSelection()]; + auto p = _pages[_notebook->GetSelection()]; _download->Enable (p->ready_to_download ()); - wxButton* ok = dynamic_cast (FindWindowById (wxID_OK, this)); + auto ok = dynamic_cast(FindWindowById(wxID_OK, this)); if (ok) { - ok->Enable (static_cast(p->certificate ())); + ok->Enable (static_cast(p->certificate())); } } + void DownloadCertificateDialog::page_changed (wxNotebookEvent& ev) { diff --git a/src/wx/download_certificate_dialog.h b/src/wx/download_certificate_dialog.h index ef241a0ca..e74968b69 100644 --- a/src/wx/download_certificate_dialog.h +++ b/src/wx/download_certificate_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2018 Carl Hetherington + Copyright (C) 2014-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,6 +18,7 @@ */ + #include "lib/warnings.h" #include DCPOMATIC_DISABLE_WARNINGS @@ -25,8 +26,10 @@ DCPOMATIC_DISABLE_WARNINGS #include DCPOMATIC_ENABLE_WARNINGS + class DownloadCertificatePanel; + class DownloadCertificateDialog : public wxDialog { public: diff --git a/src/wx/job_view.cc b/src/wx/job_view.cc index 776201424..7f170c321 100644 --- a/src/wx/job_view.cc +++ b/src/wx/job_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2019 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -19,28 +19,28 @@ */ +#include "check_box.h" +#include "dcpomatic_button.h" #include "job_view.h" -#include "wx_util.h" #include "message_dialog.h" #include "static_text.h" -#include "check_box.h" -#include "dcpomatic_button.h" -#include "lib/job.h" -#include "lib/job_manager.h" +#include "wx_util.h" +#include "lib/analyse_audio_job.h" #include "lib/compose.hpp" #include "lib/config.h" +#include "lib/job.h" +#include "lib/job_manager.h" #include "lib/send_notification_email_job.h" #include "lib/transcode_job.h" -#include "lib/analyse_audio_job.h" #include #include -using std::string; +using std::dynamic_pointer_cast; using std::min; using std::shared_ptr; +using std::string; using boost::bind; -using std::dynamic_pointer_cast; JobView::JobView (shared_ptr job, wxWindow* parent, wxWindow* container, wxFlexGridSizer* table) diff --git a/src/wx/job_view.h b/src/wx/job_view.h index 4a602fc62..fdc96d139 100644 --- a/src/wx/job_view.h +++ b/src/wx/job_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2017 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,22 +18,26 @@ */ + #ifndef DCPOMATIC_JOB_VIEW_H #define DCPOMATIC_JOB_VIEW_H + #include + class Job; -class wxScrolledWindow; -class wxWindow; -class wxFlexGridSizer; -class wxCommandEvent; class wxBoxSizer; -class wxGauge; -class wxStaticText; class wxButton; -class wxSizer; class wxCheckBox; +class wxCommandEvent; +class wxFlexGridSizer; +class wxGauge; +class wxScrolledWindow; +class wxSizer; +class wxStaticText; +class wxWindow; + class JobView { @@ -67,7 +71,6 @@ protected: wxBoxSizer* _gauge_message; private: - virtual void finish_setup (wxWindow *, wxSizer *) {} void progress (); @@ -90,4 +93,5 @@ private: boost::signals2::scoped_connection _finished_connection; }; + #endif diff --git a/src/wx/password_entry.cc b/src/wx/password_entry.cc index f44ed9cb0..4dd894718 100644 --- a/src/wx/password_entry.cc +++ b/src/wx/password_entry.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,17 +18,20 @@ */ -#include "password_entry.h" + #include "check_box.h" +#include "password_entry.h" #include "wx_util.h" + using std::string; using boost::bind; + PasswordEntry::PasswordEntry (wxWindow* parent) { _panel = new wxPanel (parent, wxID_ANY); - wxBoxSizer* sizer = new wxBoxSizer (wxHORIZONTAL); + auto sizer = new wxBoxSizer (wxHORIZONTAL); _text = new wxTextCtrl (_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD); sizer->Add (_text, 1, wxRIGHT, DCPOMATIC_SIZER_GAP); _show = new CheckBox (_panel, _("Show")); @@ -39,18 +42,20 @@ PasswordEntry::PasswordEntry (wxWindow* parent) _text->Bind (wxEVT_TEXT, bind(boost::ref(Changed))); } + wxPanel * PasswordEntry::get_panel () const { return _panel; } + void PasswordEntry::show_clicked () { _panel->Freeze (); - wxString const pass = _text->GetValue (); - wxSizer* sizer = _text->GetContainingSizer (); + auto const pass = _text->GetValue (); + auto sizer = _text->GetContainingSizer (); long from, to; _text->GetSelection (&from, &to); sizer->Detach (_text); @@ -63,12 +68,14 @@ PasswordEntry::show_clicked () _panel->Thaw (); } + string PasswordEntry::get () const { return wx_to_std (_text->GetValue()); } + void PasswordEntry::set (string s) { diff --git a/src/wx/password_entry.h b/src/wx/password_entry.h index 5939e5264..d8cbfffed 100644 --- a/src/wx/password_entry.h +++ b/src/wx/password_entry.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2019 Carl Hetherington + Copyright (C) 2019-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,14 +18,17 @@ */ + #include "lib/warnings.h" DCPOMATIC_DISABLE_WARNINGS #include DCPOMATIC_ENABLE_WARNINGS #include + class CheckBox; + class PasswordEntry { public: