diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-05-01 01:31:35 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-05-01 01:31:35 +0200 |
| commit | 8963f0007af1a312017b9627c18b82ec2a577591 (patch) | |
| tree | baeb6f2c17da72248408b8c1d695242b44edda9e /src/wx | |
| parent | 29f84e2b8785585885e0658bdf9938967547460f (diff) | |
C++11 tidying.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/config_dialog.cc | 2 | ||||
| -rw-r--r-- | src/wx/config_dialog.h | 12 | ||||
| -rw-r--r-- | src/wx/content_widget.h | 53 | ||||
| -rw-r--r-- | src/wx/credentials_download_certificate_panel.cc | 2 | ||||
| -rw-r--r-- | src/wx/credentials_download_certificate_panel.h | 25 | ||||
| -rw-r--r-- | src/wx/dkdm_output_panel.cc | 2 | ||||
| -rw-r--r-- | src/wx/dkdm_output_panel.h | 2 | ||||
| -rw-r--r-- | src/wx/dolby_doremi_certificate_panel.cc | 8 | ||||
| -rw-r--r-- | src/wx/download_certificate_panel.cc | 9 | ||||
| -rw-r--r-- | src/wx/editable_list.h | 13 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 22 | ||||
| -rw-r--r-- | src/wx/film_editor.h | 6 | ||||
| -rw-r--r-- | src/wx/full_config_dialog.cc | 311 | ||||
| -rw-r--r-- | src/wx/full_config_dialog.h | 6 | ||||
| -rw-r--r-- | src/wx/job_view_dialog.cc | 17 | ||||
| -rw-r--r-- | src/wx/job_view_dialog.h | 5 | ||||
| -rw-r--r-- | src/wx/kdm_output_panel.cc | 2 | ||||
| -rw-r--r-- | src/wx/kdm_output_panel.h | 2 | ||||
| -rw-r--r-- | src/wx/nag_dialog.cc | 8 | ||||
| -rw-r--r-- | src/wx/nag_dialog.h | 4 | ||||
| -rw-r--r-- | src/wx/player_config_dialog.cc | 2 | ||||
| -rw-r--r-- | src/wx/suspender.cc | 3 | ||||
| -rw-r--r-- | src/wx/suspender.h | 8 | ||||
| -rw-r--r-- | src/wx/wx_util.h | 1 |
24 files changed, 270 insertions, 255 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 576e979e9..a81e8a65c 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -36,7 +36,7 @@ using std::make_shared; using boost::bind; using boost::optional; using std::shared_ptr; -using boost::function; +using std::function; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h index 818ab4def..dd0e92152 100644 --- a/src/wx/config_dialog.h +++ b/src/wx/config_dialog.h @@ -113,9 +113,9 @@ public: wxWindow* parent, wxString title, int border, - boost::function<void (std::shared_ptr<dcp::CertificateChain>)> set, - boost::function<std::shared_ptr<const dcp::CertificateChain> (void)> get, - boost::function<bool (void)> nag_alter + std::function<void (std::shared_ptr<dcp::CertificateChain>)> set, + std::function<std::shared_ptr<const dcp::CertificateChain> (void)> get, + std::function<bool (void)> nag_alter ); void add_button (wxWindow* button); @@ -144,9 +144,9 @@ private: wxStaticText* _private_key_bad; wxSizer* _sizer; wxBoxSizer* _button_sizer; - boost::function<void (std::shared_ptr<dcp::CertificateChain>)> _set; - boost::function<std::shared_ptr<const dcp::CertificateChain> (void)> _get; - boost::function<bool (void)> _nag_alter; + std::function<void (std::shared_ptr<dcp::CertificateChain>)> _set; + std::function<std::shared_ptr<const dcp::CertificateChain> (void)> _get; + std::function<bool (void)> _nag_alter; }; class KeysPage : public Page diff --git a/src/wx/content_widget.h b/src/wx/content_widget.h index 2a2bc9cf7..34755e4b5 100644 --- a/src/wx/content_widget.h +++ b/src/wx/content_widget.h @@ -30,7 +30,6 @@ #include <wx/wx.h> #include <wx/gbsizer.h> #include <wx/spinctrl.h> -#include <boost/function.hpp> #include <vector> /** @class ContentWidget @@ -60,12 +59,12 @@ public: wxWindow* parent, T* wrapped, int property, - boost::function<std::shared_ptr<S> (Content*)> part, - boost::function<U (S*)> model_getter, - boost::function<void (S*, U)> model_setter, - boost::function<void ()> view_changed, - boost::function<U (V)> view_to_model, - boost::function<V (U)> model_to_view + std::function<std::shared_ptr<S> (Content*)> part, + std::function<U (S*)> model_getter, + std::function<void (S*, U)> model_setter, + std::function<void ()> view_changed, + std::function<U (V)> view_to_model, + std::function<V (U)> model_to_view ) : _wrapped (wrapped) , _sizer (0) @@ -217,12 +216,12 @@ private: wxButton* _button; List _content; int _property; - boost::function<std::shared_ptr<S> (Content *)> _part; - boost::function<U (S*)> _model_getter; - boost::function<void (S*, U)> _model_setter; - boost::function<void ()> _view_changed; - boost::function<U (V)> _view_to_model; - boost::function<V (U)> _model_to_view; + std::function<std::shared_ptr<S> (Content *)> _part; + std::function<U (S*)> _model_getter; + std::function<void (S*, U)> _model_setter; + std::function<void ()> _view_changed; + std::function<U (V)> _view_to_model; + std::function<V (U)> _model_to_view; std::list<boost::signals2::connection> _connections; bool _ignore_model_changes; }; @@ -241,10 +240,10 @@ public: wxWindow* parent, wxSpinCtrl* wrapped, int property, - boost::function<std::shared_ptr<S> (Content *)> part, - boost::function<int (S*)> getter, - boost::function<void (S*, int)> setter, - boost::function<void ()> view_changed = boost::function<void ()>() + std::function<std::shared_ptr<S> (Content *)> part, + std::function<int (S*)> getter, + std::function<void (S*, int)> setter, + std::function<void ()> view_changed = std::function<void ()>() ) : ContentWidget<S, wxSpinCtrl, int, int> ( parent, @@ -269,10 +268,10 @@ public: wxWindow* parent, wxSpinCtrlDouble* wrapped, int property, - boost::function<std::shared_ptr<S> (Content *)> part, - boost::function<double (S*)> getter, - boost::function<void (S*, double)> setter, - boost::function<void ()> view_changed = boost::function<void ()>() + std::function<std::shared_ptr<S> (Content *)> part, + std::function<double (S*)> getter, + std::function<void (S*, double)> setter, + std::function<void ()> view_changed = std::function<void ()>() ) : ContentWidget<S, wxSpinCtrlDouble, double, double> ( parent, @@ -297,12 +296,12 @@ public: wxWindow* parent, wxChoice* wrapped, int property, - boost::function<std::shared_ptr<S> (Content *)> part, - boost::function<U (S*)> getter, - boost::function<void (S*, U)> setter, - boost::function<U (int)> view_to_model, - boost::function<int (U)> model_to_view, - boost::function<void ()> view_changed = boost::function<void()>() + std::function<std::shared_ptr<S> (Content *)> part, + std::function<U (S*)> getter, + std::function<void (S*, U)> setter, + std::function<U (int)> view_to_model, + std::function<int (U)> model_to_view, + std::function<void ()> view_changed = std::function<void()>() ) : ContentWidget<S, wxChoice, U, int> ( parent, diff --git a/src/wx/credentials_download_certificate_panel.cc b/src/wx/credentials_download_certificate_panel.cc index 9032b1f81..77c18e3c1 100644 --- a/src/wx/credentials_download_certificate_panel.cc +++ b/src/wx/credentials_download_certificate_panel.cc @@ -24,7 +24,7 @@ #include "wx_util.h" using std::string; -using boost::function; +using std::function; using boost::optional; CredentialsDownloadCertificatePanel::CredentialsDownloadCertificatePanel ( diff --git a/src/wx/credentials_download_certificate_panel.h b/src/wx/credentials_download_certificate_panel.h index 68472462a..b802768e9 100644 --- a/src/wx/credentials_download_certificate_panel.h +++ b/src/wx/credentials_download_certificate_panel.h @@ -22,7 +22,6 @@ #define CREDENTIALS_DOWNLOAD_CERTIFICATE_PANEL_H #include "download_certificate_panel.h" -#include <boost/function.hpp> class PasswordEntry; @@ -31,12 +30,12 @@ class CredentialsDownloadCertificatePanel : public DownloadCertificatePanel public: CredentialsDownloadCertificatePanel ( DownloadCertificateDialog* dialog, - boost::function<boost::optional<std::string> ()> get_username, - boost::function<void (std::string)> set_username, - boost::function<void ()> unset_username, - boost::function<boost::optional<std::string> ()> get_password, - boost::function<void (std::string)> set_password, - boost::function<void ()> unset_password + std::function<boost::optional<std::string> ()> get_username, + std::function<void (std::string)> set_username, + std::function<void ()> unset_username, + std::function<boost::optional<std::string> ()> get_password, + std::function<void (std::string)> set_password, + std::function<void ()> unset_password ); virtual bool ready_to_download () const; @@ -45,12 +44,12 @@ private: void username_changed (); void password_changed (); - boost::function<boost::optional<std::string> (void)> _get_username; - boost::function<void (std::string)> _set_username; - boost::function<void ()> _unset_username; - boost::function<boost::optional<std::string> (void)> _get_password; - boost::function<void (std::string)> _set_password; - boost::function<void ()> _unset_password; + std::function<boost::optional<std::string> (void)> _get_username; + std::function<void (std::string)> _set_username; + std::function<void ()> _unset_username; + std::function<boost::optional<std::string> (void)> _get_password; + std::function<void (std::string)> _set_password; + std::function<void ()> _unset_password; wxTextCtrl* _username; PasswordEntry* _password; diff --git a/src/wx/dkdm_output_panel.cc b/src/wx/dkdm_output_panel.cc index 964662f0e..cf6189efa 100644 --- a/src/wx/dkdm_output_panel.cc +++ b/src/wx/dkdm_output_panel.cc @@ -45,7 +45,7 @@ using std::list; using std::exception; using std::make_pair; using std::shared_ptr; -using boost::function; +using std::function; DKDMOutputPanel::DKDMOutputPanel (wxWindow* parent) diff --git a/src/wx/dkdm_output_panel.h b/src/wx/dkdm_output_panel.h index 57a941818..43e66a172 100644 --- a/src/wx/dkdm_output_panel.h +++ b/src/wx/dkdm_output_panel.h @@ -44,7 +44,7 @@ public: std::pair<std::shared_ptr<Job>, int> make ( std::list<KDMWithMetadataPtr > kdms, std::string name, - boost::function<bool (boost::filesystem::path)> confirm_overwrite + std::function<bool (boost::filesystem::path)> confirm_overwrite ); private: diff --git a/src/wx/dolby_doremi_certificate_panel.cc b/src/wx/dolby_doremi_certificate_panel.cc index 68be51a07..817867cc1 100644 --- a/src/wx/dolby_doremi_certificate_panel.cc +++ b/src/wx/dolby_doremi_certificate_panel.cc @@ -23,19 +23,19 @@ #include "download_certificate_dialog.h" #include "wx_util.h" #include "lib/compose.hpp" -#include "lib/util.h" -#include "lib/signal_manager.h" #include "lib/internet.h" +#include "lib/signal_manager.h" +#include "lib/util.h" #include <dcp/raw_convert.h> #include <curl/curl.h> #include <zip.h> #include <iostream> -using std::string; using std::cout; +using std::function; using std::list; -using boost::function; +using std::string; using boost::optional; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; diff --git a/src/wx/download_certificate_panel.cc b/src/wx/download_certificate_panel.cc index b9680e298..c30b05008 100644 --- a/src/wx/download_certificate_panel.cc +++ b/src/wx/download_certificate_panel.cc @@ -19,19 +19,18 @@ */ -#include "wx_util.h" -#include "download_certificate_panel.h" #include "download_certificate_dialog.h" -#include "lib/signal_manager.h" +#include "download_certificate_panel.h" +#include "wx_util.h" #include "lib/compose.hpp" -#include <dcp/util.h> +#include "lib/signal_manager.h" #include <dcp/certificate_chain.h> #include <dcp/exceptions.h> +#include <dcp/util.h> #include <boost/bind/bind.hpp> using std::string; -using boost::function; using boost::optional; diff --git a/src/wx/editable_list.h b/src/wx/editable_list.h index f90d219f8..3f2ea0ca2 100644 --- a/src/wx/editable_list.h +++ b/src/wx/editable_list.h @@ -25,7 +25,6 @@ #include "dcpomatic_button.h" #include <wx/wx.h> #include <wx/listctrl.h> -#include <boost/function.hpp> #include <vector> class EditableListColumn @@ -60,9 +59,9 @@ public: EditableList ( wxWindow* parent, std::vector<EditableListColumn> columns, - boost::function<std::vector<T> ()> get, - boost::function<void (std::vector<T>)> set, - boost::function<std::string (T, int)> column, + std::function<std::vector<T> ()> get, + std::function<void (std::vector<T>)> set, + std::function<std::string (T, int)> column, bool can_edit = true, bool title = true ) @@ -289,10 +288,10 @@ private: ev.Skip (); } - boost::function <std::vector<T> ()> _get; - boost::function <void (std::vector<T>)> _set; + std::function <std::vector<T> ()> _get; + std::function <void (std::vector<T>)> _set; std::vector<EditableListColumn> _columns; - boost::function<std::string (T, int)> _column; + std::function<std::string (T, int)> _column; wxButton* _add; wxButton* _edit; diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 767676fff..d604f678d 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,10 +18,12 @@ */ + /** @file src/wx/film_editor.cc * @brief FilmEditor class. */ + #include "wx_util.h" #include "film_editor.h" #include "dcp_panel.h" @@ -34,6 +36,7 @@ #include <wx/notebook.h> #include <iostream> + using std::cout; using std::string; using std::list; @@ -44,10 +47,11 @@ using boost::optional; using namespace boost::placeholders; #endif + FilmEditor::FilmEditor (wxWindow* parent, weak_ptr<FilmViewer> viewer) : wxPanel (parent) { - wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); + auto s = new wxBoxSizer (wxVERTICAL); _main_notebook = new wxNotebook (this, wxID_ANY); s->Add (_main_notebook, 1); @@ -58,7 +62,7 @@ FilmEditor::FilmEditor (wxWindow* parent, weak_ptr<FilmViewer> viewer) _main_notebook->AddPage (_dcp_panel->panel (), _("DCP"), false); JobManager::instance()->ActiveJobsChanged.connect ( - bind (&FilmEditor::active_jobs_changed, this, _2) + bind(&FilmEditor::active_jobs_changed, this, _2) ); set_film (shared_ptr<Film> ()); @@ -92,6 +96,7 @@ FilmEditor::film_change (ChangeType type, Film::Property p) } } + void FilmEditor::film_content_change (ChangeType type, int property) { @@ -112,11 +117,12 @@ FilmEditor::film_content_change (ChangeType type, int property) _dcp_panel->film_content_changed (property); } + /** Sets the Film that we are editing */ void FilmEditor::set_film (shared_ptr<Film> film) { - set_general_sensitivity (film != 0); + set_general_sensitivity (film != nullptr); if (_film == film) { return; @@ -132,8 +138,8 @@ FilmEditor::set_film (shared_ptr<Film> film) return; } - _film->Change.connect (bind (&FilmEditor::film_change, this, _1, _2)); - _film->ContentChange.connect (bind (&FilmEditor::film_content_change, this, _1, _3)); + _film->Change.connect (bind(&FilmEditor::film_change, this, _1, _2)); + _film->ContentChange.connect (bind(&FilmEditor::film_content_change, this, _1, _3)); if (_film->directory()) { FileChanged (_film->directory().get()); @@ -142,10 +148,11 @@ FilmEditor::set_film (shared_ptr<Film> film) } if (!_film->content().empty()) { - _content_panel->set_selection (_film->content().front ()); + _content_panel->set_selection (_film->content().front()); } } + void FilmEditor::set_general_sensitivity (bool s) { @@ -153,6 +160,7 @@ FilmEditor::set_general_sensitivity (bool s) _dcp_panel->set_general_sensitivity (s); } + void FilmEditor::active_jobs_changed (optional<string> j) { diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index a5232d2e5..6aff127d8 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,10 +18,12 @@ */ + /** @file src/wx/film_editor.h * @brief FilmEditor class. */ + #include "lib/film.h" #include "lib/warnings.h" DCPOMATIC_DISABLE_WARNINGS @@ -29,12 +31,14 @@ DCPOMATIC_DISABLE_WARNINGS DCPOMATIC_ENABLE_WARNINGS #include <boost/signals2.hpp> + class wxNotebook; class Film; class ContentPanel; class DCPPanel; class FilmViewer; + /** @class FilmEditor * @brief A wx widget to edit a film's metadata, and perform various functions. */ diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index 155472a38..dd8da2760 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,62 +18,66 @@ */ + /** @file src/full_config_dialog.cc * @brief A dialogue to edit all DCP-o-matic configuration. */ -#include "full_config_dialog.h" -#include "wx_util.h" -#include "editable_list.h" -#include "filter_dialog.h" + +#include "check_box.h" +#include "config_dialog.h" +#include "config_move_dialog.h" +#include "dcpomatic_button.h" #include "dir_picker_ctrl.h" +#include "editable_list.h" +#include "email_dialog.h" #include "file_picker_ctrl.h" -#include "server_dialog.h" +#include "filter_dialog.h" +#include "full_config_dialog.h" #include "make_chain_dialog.h" -#include "email_dialog.h" -#include "name_format_editor.h" #include "nag_dialog.h" -#include "config_move_dialog.h" -#include "config_dialog.h" -#include "static_text.h" -#include "check_box.h" -#include "dcpomatic_button.h" +#include "name_format_editor.h" #include "password_entry.h" +#include "server_dialog.h" +#include "static_text.h" +#include "wx_util.h" #include "lib/config.h" -#include "lib/ratio.h" -#include "lib/filter.h" +#include "lib/cross.h" #include "lib/dcp_content_type.h" +#include "lib/exceptions.h" +#include "lib/filter.h" #include "lib/log.h" +#include "lib/ratio.h" #include "lib/util.h" -#include "lib/cross.h" -#include "lib/exceptions.h" -#include <dcp/locale_convert.h> -#include <dcp/exceptions.h> #include <dcp/certificate_chain.h> -#include <wx/stdpaths.h> +#include <dcp/exceptions.h> +#include <dcp/locale_convert.h> +#include <wx/filepicker.h> #include <wx/preferences.h> #include <wx/spinctrl.h> -#include <wx/filepicker.h> +#include <wx/stdpaths.h> #include <RtAudio.h> #include <boost/filesystem.hpp> #include <iostream> -using std::vector; -using std::string; -using std::list; + using std::cout; -using std::pair; +using std::function; +using std::list; using std::make_pair; using std::map; -using boost::bind; +using std::pair; using std::shared_ptr; -using boost::function; +using std::string; +using std::vector; +using boost::bind; using boost::optional; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif using dcp::locale_convert; + class FullGeneralPage : public GeneralPage { public: @@ -84,7 +88,7 @@ public: private: void setup () { - wxGridBagSizer* table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + auto table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border); int r = 0; @@ -124,8 +128,8 @@ private: add_update_controls (table, r); - _config_file->Bind (wxEVT_FILEPICKER_CHANGED, boost::bind (&FullGeneralPage::config_file_changed, this)); - _cinemas_file->Bind (wxEVT_FILEPICKER_CHANGED, boost::bind (&FullGeneralPage::cinemas_file_changed, this)); + _config_file->Bind (wxEVT_FILEPICKER_CHANGED, boost::bind(&FullGeneralPage::config_file_changed, this)); + _cinemas_file->Bind (wxEVT_FILEPICKER_CHANGED, boost::bind(&FullGeneralPage::cinemas_file_changed, this)); _master_encoding_threads->SetRange (1, 128); _master_encoding_threads->Bind (wxEVT_SPINCTRL, boost::bind (&FullGeneralPage::master_encoding_threads_changed, this)); @@ -141,7 +145,7 @@ private: void config_changed () { - Config* config = Config::instance (); + auto config = Config::instance (); checked_set (_master_encoding_threads, config->master_encoding_threads ()); checked_set (_server_encoding_threads, config->server_encoding_threads ()); @@ -157,8 +161,8 @@ private: void export_cinemas_file () { - wxFileDialog* d = new wxFileDialog ( - _panel, _("Select Cinemas File"), wxEmptyString, wxEmptyString, wxT ("XML files (*.xml)|*.xml"), + auto d = new wxFileDialog ( + _panel, _("Select Cinemas File"), wxEmptyString, wxEmptyString, wxT("XML files (*.xml)|*.xml"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); @@ -171,35 +175,35 @@ private: #ifdef DCPOMATIC_HAVE_EBUR128_PATCHED_FFMPEG void analyse_ebur128_changed () { - Config::instance()->set_analyse_ebur128 (_analyse_ebur128->GetValue ()); + Config::instance()->set_analyse_ebur128 (_analyse_ebur128->GetValue()); } #endif void automatic_audio_analysis_changed () { - Config::instance()->set_automatic_audio_analysis (_automatic_audio_analysis->GetValue ()); + Config::instance()->set_automatic_audio_analysis (_automatic_audio_analysis->GetValue()); } void master_encoding_threads_changed () { - Config::instance()->set_master_encoding_threads (_master_encoding_threads->GetValue ()); + Config::instance()->set_master_encoding_threads (_master_encoding_threads->GetValue()); } void server_encoding_threads_changed () { - Config::instance()->set_server_encoding_threads (_server_encoding_threads->GetValue ()); + Config::instance()->set_server_encoding_threads (_server_encoding_threads->GetValue()); } void config_file_changed () { - Config* config = Config::instance(); + auto config = Config::instance(); boost::filesystem::path new_file = wx_to_std(_config_file->GetPath()); if (new_file == config->config_file()) { return; } bool copy_and_link = true; if (boost::filesystem::exists(new_file)) { - ConfigMoveDialog* d = new ConfigMoveDialog (_panel, new_file); + auto d = new ConfigMoveDialog (_panel, new_file); if (d->ShowModal() == wxID_OK) { copy_and_link = false; } @@ -231,6 +235,7 @@ private: wxCheckBox* _automatic_audio_analysis; }; + class DefaultsPage : public Page { public: @@ -253,13 +258,13 @@ public: private: void setup () { - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border); { add_label_to_sizer (table, _panel, _("Default duration of still images"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); - wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + auto s = new wxBoxSizer (wxHORIZONTAL); _still_length = new wxSpinCtrl (_panel); s->Add (_still_length); add_label_to_sizer (s, _panel, _("s"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); @@ -288,7 +293,7 @@ private: { add_label_to_sizer (table, _panel, _("Default JPEG2000 bandwidth"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); - wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + auto s = new wxBoxSizer (wxHORIZONTAL); _j2k_bandwidth = new wxSpinCtrl (_panel); s->Add (_j2k_bandwidth); add_label_to_sizer (s, _panel, _("Mbit/s"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); @@ -297,7 +302,7 @@ private: { add_label_to_sizer (table, _panel, _("Default audio delay"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); - wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + auto s = new wxBoxSizer (wxHORIZONTAL); _audio_delay = new wxSpinCtrl (_panel); s->Add (_audio_delay); add_label_to_sizer (s, _panel, _("ms"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); @@ -351,18 +356,18 @@ private: void config_changed () { - Config* config = Config::instance (); + auto config = Config::instance (); - vector<Ratio const *> containers = Ratio::containers (); + auto containers = Ratio::containers (); for (size_t i = 0; i < containers.size(); ++i) { - if (containers[i] == config->default_container ()) { + if (containers[i] == config->default_container()) { _container->SetSelection (i); } } - vector<DCPContentType const *> const ct = DCPContentType::all (); + auto const ct = DCPContentType::all (); for (size_t i = 0; i < ct.size(); ++i) { - if (ct[i] == config->default_dcp_content_type ()) { + if (ct[i] == config->default_dcp_content_type()) { _dcp_content_type->SetSelection (i); } } @@ -392,7 +397,7 @@ private: int const s = _dcp_audio_channels->GetSelection (); if (s != wxNOT_FOUND) { Config::instance()->set_default_dcp_audio_channels ( - locale_convert<int> (string_client_data (_dcp_audio_channels->GetClientObject (s))) + locale_convert<int>(string_client_data(_dcp_audio_channels->GetClientObject(s))) ); } } @@ -414,13 +419,13 @@ private: void container_changed () { - vector<Ratio const *> ratio = Ratio::containers (); + auto ratio = Ratio::containers (); Config::instance()->set_default_container (ratio[_container->GetSelection()]); } void dcp_content_type_changed () { - vector<DCPContentType const *> ct = DCPContentType::all (); + auto ct = DCPContentType::all (); Config::instance()->set_default_dcp_content_type (ct[_dcp_content_type->GetSelection()]); } @@ -445,6 +450,7 @@ private: wxChoice* _standard; }; + class EncodingServersPage : public Page { public: @@ -482,7 +488,7 @@ private: _panel->GetSizer()->Add (_servers_list, 1, wxEXPAND | wxALL, _border); - _use_any_servers->Bind (wxEVT_CHECKBOX, boost::bind (&EncodingServersPage::use_any_servers_changed, this)); + _use_any_servers->Bind (wxEVT_CHECKBOX, boost::bind(&EncodingServersPage::use_any_servers_changed, this)); } void config_changed () @@ -505,6 +511,7 @@ private: EditableList<string, ServerDialog>* _servers_list; }; + class TMSPage : public Page { public: @@ -567,7 +574,7 @@ private: void config_changed () { - Config* config = Config::instance (); + auto config = Config::instance (); checked_set (_upload, config->upload_after_make_dcp()); checked_set (_tms_protocol, static_cast<int>(config->tms_protocol())); @@ -615,11 +622,6 @@ private: PasswordEntry* _tms_password; }; -static string -column (string s) -{ - return s; -} class EmailPage : public Page { @@ -643,7 +645,7 @@ public: private: void setup () { - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); _panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border); @@ -675,19 +677,19 @@ private: _password = new PasswordEntry (_panel); table->Add (_password->get_panel(), 1, wxEXPAND | wxALL); - _server->Bind (wxEVT_TEXT, boost::bind (&EmailPage::server_changed, this)); - _port->Bind (wxEVT_SPINCTRL, boost::bind (&EmailPage::port_changed, this)); - _protocol->Bind (wxEVT_CHOICE, boost::bind (&EmailPage::protocol_changed, this)); - _user->Bind (wxEVT_TEXT, boost::bind (&EmailPage::user_changed, this)); - _password->Changed.connect (boost::bind (&EmailPage::password_changed, this)); + _server->Bind (wxEVT_TEXT, boost::bind(&EmailPage::server_changed, this)); + _port->Bind (wxEVT_SPINCTRL, boost::bind(&EmailPage::port_changed, this)); + _protocol->Bind (wxEVT_CHOICE, boost::bind(&EmailPage::protocol_changed, this)); + _user->Bind (wxEVT_TEXT, boost::bind(&EmailPage::user_changed, this)); + _password->Changed.connect (boost::bind(&EmailPage::password_changed, this)); } void config_changed () { auto config = Config::instance (); - checked_set (_server, config->mail_server ()); - checked_set (_port, config->mail_port ()); + checked_set (_server, config->mail_server()); + checked_set (_port, config->mail_port()); switch (config->mail_protocol()) { case EmailProtocol::AUTO: checked_set (_protocol, 0); @@ -702,18 +704,18 @@ private: checked_set (_protocol, 3); break; } - checked_set (_user, config->mail_user ()); + checked_set (_user, config->mail_user()); checked_set (_password, config->mail_password()); } void server_changed () { - Config::instance()->set_mail_server (wx_to_std (_server->GetValue ())); + Config::instance()->set_mail_server(wx_to_std(_server->GetValue())); } void port_changed () { - Config::instance()->set_mail_port (_port->GetValue ()); + Config::instance()->set_mail_port(_port->GetValue()); } void protocol_changed () @@ -751,6 +753,7 @@ private: PasswordEntry* _password; }; + class KDMEmailPage : public Page { public: @@ -799,8 +802,9 @@ private: columns, bind (&Config::kdm_cc, Config::instance()), bind (&Config::set_kdm_cc, Config::instance(), _1), - bind (&column, _1) - ); + [] (string s, int) { + return s; + }); table->Add (_cc, 1, wxEXPAND | wxALL); add_label_to_sizer (table, _panel, _("BCC address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); @@ -872,6 +876,7 @@ private: wxButton* _reset_email; }; + class NotificationsPage : public Page { public: @@ -899,7 +904,7 @@ public: private: void setup () { - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); _panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border); @@ -931,8 +936,9 @@ private: columns, bind (&Config::notification_cc, Config::instance()), bind (&Config::set_notification_cc, Config::instance(), _1), - bind (&column, _1) - ); + [] (string s, int) { + return s; + }); table->Add (_cc, 1, wxEXPAND | wxALL); add_label_to_sizer (table, _panel, _("BCC address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); @@ -974,7 +980,7 @@ private: void config_changed () { - Config* config = Config::instance (); + auto config = Config::instance (); checked_set (_enable_message_box, config->notification(Config::MESSAGE_BOX)); checked_set (_enable_email, config->notification(Config::EMAIL)); @@ -989,39 +995,39 @@ private: void notification_subject_changed () { - Config::instance()->set_notification_subject (wx_to_std (_subject->GetValue ())); + Config::instance()->set_notification_subject(wx_to_std(_subject->GetValue())); } void notification_from_changed () { - Config::instance()->set_notification_from (wx_to_std (_from->GetValue ())); + Config::instance()->set_notification_from(wx_to_std(_from->GetValue())); } void notification_to_changed () { - Config::instance()->set_notification_to (wx_to_std (_to->GetValue ())); + Config::instance()->set_notification_to(wx_to_std(_to->GetValue())); } void notification_bcc_changed () { - Config::instance()->set_notification_bcc (wx_to_std (_bcc->GetValue ())); + Config::instance()->set_notification_bcc(wx_to_std(_bcc->GetValue())); } void notification_email_changed () { - if (_email->GetValue().IsEmpty ()) { + if (_email->GetValue().IsEmpty()) { /* Sometimes we get sent an erroneous notification that the email is empty; I don't know why. */ return; } - Config::instance()->set_notification_email (wx_to_std (_email->GetValue ())); + Config::instance()->set_notification_email(wx_to_std(_email->GetValue())); } void reset_email () { - Config::instance()->reset_notification_email (); - checked_set (_email, Config::instance()->notification_email ()); + Config::instance()->reset_notification_email(); + checked_set (_email, Config::instance()->notification_email()); } void type_changed (wxCheckBox* b, Config::Notification n) @@ -1042,6 +1048,7 @@ private: wxButton* _reset_email; }; + class CoverSheetPage : public Page { public: @@ -1082,7 +1089,7 @@ private: void config_changed () { - checked_set (_cover_sheet, Config::instance()->cover_sheet ()); + checked_set (_cover_sheet, Config::instance()->cover_sheet()); } void cover_sheet_changed () @@ -1093,13 +1100,13 @@ private: */ return; } - Config::instance()->set_cover_sheet (wx_to_std (_cover_sheet->GetValue ())); + Config::instance()->set_cover_sheet(wx_to_std(_cover_sheet->GetValue())); } void reset_cover_sheet () { - Config::instance()->reset_cover_sheet (); - checked_set (_cover_sheet, Config::instance()->cover_sheet ()); + Config::instance()->reset_cover_sheet(); + checked_set (_cover_sheet, Config::instance()->cover_sheet()); } wxTextCtrl* _cover_sheet; @@ -1129,7 +1136,7 @@ public: private: void setup () { - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); add_label_to_sizer (table, _panel, _("Issuer"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); @@ -1174,7 +1181,7 @@ private: void config_changed () { - Config* config = Config::instance (); + auto config = Config::instance (); checked_set (_issuer, config->dcp_issuer ()); checked_set (_creator, config->dcp_creator ()); checked_set (_company_name, config->dcp_company_name ()); @@ -1185,27 +1192,27 @@ private: void issuer_changed () { - Config::instance()->set_dcp_issuer (wx_to_std (_issuer->GetValue ())); + Config::instance()->set_dcp_issuer(wx_to_std(_issuer->GetValue())); } void creator_changed () { - Config::instance()->set_dcp_creator (wx_to_std (_creator->GetValue ())); + Config::instance()->set_dcp_creator(wx_to_std(_creator->GetValue())); } void company_name_changed () { - Config::instance()->set_dcp_company_name (wx_to_std(_company_name->GetValue())); + Config::instance()->set_dcp_company_name(wx_to_std(_company_name->GetValue())); } void product_name_changed () { - Config::instance()->set_dcp_product_name (wx_to_std(_product_name->GetValue())); + Config::instance()->set_dcp_product_name(wx_to_std(_product_name->GetValue())); } void product_version_changed () { - Config::instance()->set_dcp_product_version (wx_to_std(_product_version->GetValue())); + Config::instance()->set_dcp_product_version(wx_to_std(_product_version->GetValue())); } void j2k_comment_changed () @@ -1230,21 +1237,6 @@ class AdvancedPage : public Page public: AdvancedPage (wxSize panel_size, int border) : Page (panel_size, border) - , _maximum_j2k_bandwidth (0) - , _allow_any_dcp_frame_rate (0) - , _allow_any_container (0) - , _show_experimental_audio_processors (0) - , _only_servers_encode (0) - , _log_general (0) - , _log_warning (0) - , _log_error (0) - , _log_timing (0) - , _log_debug_threed (0) - , _log_debug_encode (0) - , _log_debug_email (0) - , _log_debug_video_view (0) - , _log_debug_player (0) - , _log_debug_audio_analysis (0) {} wxString GetName () const @@ -1273,7 +1265,7 @@ private: void setup () { - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border); @@ -1290,8 +1282,8 @@ private: _video_display_mode = new wxChoice (_panel, wxID_ANY); table->Add (_video_display_mode); - wxStaticText* restart = add_label_to_sizer (table, _panel, _("(restart DCP-o-matic to change display mode)"), false); - wxFont font = restart->GetFont(); + auto restart = add_label_to_sizer (table, _panel, _("(restart DCP-o-matic to change display mode)"), false); + auto font = restart->GetFont(); font.SetStyle (wxFONTSTYLE_ITALIC); font.SetPointSize (font.GetPointSize() - 1); restart->SetFont (font); @@ -1319,7 +1311,7 @@ private: { add_label_to_sizer (table, _panel, _("Maximum number of frames to store per thread"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); - wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + auto s = new wxBoxSizer (wxHORIZONTAL); _frames_in_memory_multiplier = new wxSpinCtrl (_panel); s->Add (_frames_in_memory_multiplier, 1); table->Add (s, 1); @@ -1357,7 +1349,7 @@ private: { add_top_aligned_label_to_sizer (table, _panel, _("Log")); - wxBoxSizer* t = new wxBoxSizer (wxVERTICAL); + auto t = new wxBoxSizer (wxVERTICAL); _log_general = new CheckBox (_panel, _("General")); t->Add (_log_general, 1, wxEXPAND | wxALL); _log_warning = new CheckBox (_panel, _("Warnings")); @@ -1417,7 +1409,7 @@ private: void config_changed () { - Config* config = Config::instance (); + auto config = Config::instance (); checked_set (_maximum_j2k_bandwidth, config->maximum_j2k_bandwidth() / 1000000); switch (config->video_view_type()) { @@ -1450,51 +1442,51 @@ private: void maximum_j2k_bandwidth_changed () { - Config::instance()->set_maximum_j2k_bandwidth (_maximum_j2k_bandwidth->GetValue() * 1000000); + Config::instance()->set_maximum_j2k_bandwidth(_maximum_j2k_bandwidth->GetValue() * 1000000); } void video_display_mode_changed () { if (_video_display_mode->GetSelection() == 0) { - Config::instance()->set_video_view_type (Config::VIDEO_VIEW_SIMPLE); + Config::instance()->set_video_view_type(Config::VIDEO_VIEW_SIMPLE); } else { - Config::instance()->set_video_view_type (Config::VIDEO_VIEW_OPENGL); + Config::instance()->set_video_view_type(Config::VIDEO_VIEW_OPENGL); } } void frames_in_memory_multiplier_changed () { - Config::instance()->set_frames_in_memory_multiplier (_frames_in_memory_multiplier->GetValue()); + Config::instance()->set_frames_in_memory_multiplier(_frames_in_memory_multiplier->GetValue()); } void allow_any_dcp_frame_rate_changed () { - Config::instance()->set_allow_any_dcp_frame_rate (_allow_any_dcp_frame_rate->GetValue ()); + Config::instance()->set_allow_any_dcp_frame_rate(_allow_any_dcp_frame_rate->GetValue()); } void allow_any_container_changed () { - Config::instance()->set_allow_any_container (_allow_any_container->GetValue ()); + Config::instance()->set_allow_any_container(_allow_any_container->GetValue()); } void show_experimental_audio_processors_changed () { - Config::instance()->set_show_experimental_audio_processors (_show_experimental_audio_processors->GetValue ()); + Config::instance()->set_show_experimental_audio_processors(_show_experimental_audio_processors->GetValue()); } void only_servers_encode_changed () { - Config::instance()->set_only_servers_encode (_only_servers_encode->GetValue ()); + Config::instance()->set_only_servers_encode (_only_servers_encode->GetValue()); } void dcp_metadata_filename_format_changed () { - Config::instance()->set_dcp_metadata_filename_format (_dcp_metadata_filename_format->get ()); + Config::instance()->set_dcp_metadata_filename_format(_dcp_metadata_filename_format->get()); } void dcp_asset_filename_format_changed () { - Config::instance()->set_dcp_asset_filename_format (_dcp_asset_filename_format->get ()); + Config::instance()->set_dcp_asset_filename_format(_dcp_asset_filename_format->get()); } void log_changed () @@ -1536,38 +1528,39 @@ private: #ifdef DCPOMATIC_WINDOWS void win32_console_changed () { - Config::instance()->set_win32_console (_win32_console->GetValue ()); + Config::instance()->set_win32_console(_win32_console->GetValue()); } #endif - wxSpinCtrl* _maximum_j2k_bandwidth; - wxChoice* _video_display_mode; - wxSpinCtrl* _frames_in_memory_multiplier; - wxCheckBox* _allow_any_dcp_frame_rate; - wxCheckBox* _allow_any_container; - wxCheckBox* _show_experimental_audio_processors; - wxCheckBox* _only_servers_encode; - NameFormatEditor* _dcp_metadata_filename_format; - NameFormatEditor* _dcp_asset_filename_format; - wxCheckBox* _log_general; - wxCheckBox* _log_warning; - wxCheckBox* _log_error; - wxCheckBox* _log_timing; - wxCheckBox* _log_debug_threed; - wxCheckBox* _log_debug_encode; - wxCheckBox* _log_debug_email; - wxCheckBox* _log_debug_video_view; - wxCheckBox* _log_debug_player; - wxCheckBox* _log_debug_audio_analysis; + wxSpinCtrl* _maximum_j2k_bandwidth = nullptr; + wxChoice* _video_display_mode = nullptr; + wxSpinCtrl* _frames_in_memory_multiplier = nullptr; + wxCheckBox* _allow_any_dcp_frame_rate = nullptr; + wxCheckBox* _allow_any_container = nullptr; + wxCheckBox* _show_experimental_audio_processors = nullptr; + wxCheckBox* _only_servers_encode = nullptr; + NameFormatEditor* _dcp_metadata_filename_format = nullptr; + NameFormatEditor* _dcp_asset_filename_format = nullptr; + wxCheckBox* _log_general = nullptr; + wxCheckBox* _log_warning = nullptr; + wxCheckBox* _log_error = nullptr; + wxCheckBox* _log_timing = nullptr; + wxCheckBox* _log_debug_threed = nullptr; + wxCheckBox* _log_debug_encode = nullptr; + wxCheckBox* _log_debug_email = nullptr; + wxCheckBox* _log_debug_video_view = nullptr; + wxCheckBox* _log_debug_player = nullptr; + wxCheckBox* _log_debug_audio_analysis = nullptr; #ifdef DCPOMATIC_WINDOWS - wxCheckBox* _win32_console; + wxCheckBox* _win32_console = nullptr; #endif }; + wxPreferencesEditor* create_full_config_dialog () { - wxPreferencesEditor* e = new wxPreferencesEditor (); + auto e = new wxPreferencesEditor (); #ifdef DCPOMATIC_OSX /* Width that we force some of the config panels to be on OSX so that @@ -1581,17 +1574,17 @@ create_full_config_dialog () int const border = 8; #endif - e->AddPage (new FullGeneralPage (ps, border)); - e->AddPage (new SoundPage (ps, border)); - e->AddPage (new DefaultsPage (ps, border)); - e->AddPage (new EncodingServersPage (ps, border)); - e->AddPage (new KeysPage (ps, border)); - e->AddPage (new TMSPage (ps, border)); - e->AddPage (new EmailPage (ps, border)); - e->AddPage (new KDMEmailPage (ps, border)); - e->AddPage (new NotificationsPage (ps, border)); - e->AddPage (new CoverSheetPage (ps, border)); - e->AddPage (new IdentifiersPage (ps, border)); - e->AddPage (new AdvancedPage (ps, border)); + e->AddPage (new FullGeneralPage (ps, border)); + e->AddPage (new SoundPage (ps, border)); + e->AddPage (new DefaultsPage (ps, border)); + e->AddPage (new EncodingServersPage(ps, border)); + e->AddPage (new KeysPage (ps, border)); + e->AddPage (new TMSPage (ps, border)); + e->AddPage (new EmailPage (ps, border)); + e->AddPage (new KDMEmailPage (ps, border)); + e->AddPage (new NotificationsPage (ps, border)); + e->AddPage (new CoverSheetPage (ps, border)); + e->AddPage (new IdentifiersPage (ps, border)); + e->AddPage (new AdvancedPage (ps, border)); return e; } diff --git a/src/wx/full_config_dialog.h b/src/wx/full_config_dialog.h index 5191b1456..ae275b188 100644 --- a/src/wx/full_config_dialog.h +++ b/src/wx/full_config_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,10 +18,14 @@ */ + /** @file src/full_config_dialog.h * @brief A dialogue to edit all DCP-o-matic configuration. */ + class wxPreferencesEditor; + wxPreferencesEditor* create_full_config_dialog (); + diff --git a/src/wx/job_view_dialog.cc b/src/wx/job_view_dialog.cc index 455998c5c..3d900e1d3 100644 --- a/src/wx/job_view_dialog.cc +++ b/src/wx/job_view_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,12 +18,15 @@ */ + #include "job_view_dialog.h" #include "normal_job_view.h" #include "lib/job.h" + using std::shared_ptr; + JobViewDialog::JobViewDialog (wxWindow* parent, wxString title, shared_ptr<Job> job) : TableDialog (parent, title, 4, 0, false) , _job (job) @@ -33,29 +36,31 @@ JobViewDialog::JobViewDialog (wxWindow* parent, wxString title, shared_ptr<Job> layout (); SetMinSize (wxSize (960, -1)); - Bind (wxEVT_TIMER, boost::bind (&JobViewDialog::periodic, this)); - _timer.reset (new wxTimer (this)); + Bind (wxEVT_TIMER, boost::bind(&JobViewDialog::periodic, this)); + _timer.reset (new wxTimer(this)); _timer->Start (1000); /* Start off with OK disabled and it will be enabled when the job is finished */ - wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this)); + auto ok = dynamic_cast<wxButton *>(FindWindowById(wxID_OK, this)); if (ok) { ok->Enable (false); } } + JobViewDialog::~JobViewDialog () { delete _view; } + void JobViewDialog::periodic () { _view->maybe_pulse (); - shared_ptr<Job> job = _job.lock (); - wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this)); + auto job = _job.lock (); + auto ok = dynamic_cast<wxButton *>(FindWindowById(wxID_OK, this)); if (job && ok) { ok->Enable (job->finished ()); } diff --git a/src/wx/job_view_dialog.h b/src/wx/job_view_dialog.h index b72ad298d..66a3ea6c6 100644 --- a/src/wx/job_view_dialog.h +++ b/src/wx/job_view_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -26,6 +26,7 @@ class JobView; class Job; + class JobViewDialog : public TableDialog { public: @@ -35,7 +36,7 @@ public: private: void periodic (); - JobView* _view; + JobView* _view = nullptr; std::weak_ptr<Job> _job; std::shared_ptr<wxTimer> _timer; }; diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc index 8c7f4007b..92aa86bf3 100644 --- a/src/wx/kdm_output_panel.cc +++ b/src/wx/kdm_output_panel.cc @@ -49,7 +49,7 @@ using std::list; using std::exception; using std::make_pair; using std::shared_ptr; -using boost::function; +using std::function; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif diff --git a/src/wx/kdm_output_panel.h b/src/wx/kdm_output_panel.h index cc4453d02..b01913354 100644 --- a/src/wx/kdm_output_panel.h +++ b/src/wx/kdm_output_panel.h @@ -54,7 +54,7 @@ public: std::pair<std::shared_ptr<Job>, int> make ( std::list<KDMWithMetadataPtr > screen_kdms, std::string name, - boost::function<bool (boost::filesystem::path)> confirm_overwrite + std::function<bool (boost::filesystem::path)> confirm_overwrite ); private: diff --git a/src/wx/nag_dialog.cc b/src/wx/nag_dialog.cc index 1fb15f2d0..edaf8f83f 100644 --- a/src/wx/nag_dialog.cc +++ b/src/wx/nag_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2017-2018 Carl Hetherington <cth@carlh.net> + Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,11 +18,13 @@ */ + #include "nag_dialog.h" #include "wx_util.h" #include "static_text.h" #include "check_box.h" + using std::shared_ptr; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; @@ -48,7 +50,7 @@ NagDialog::NagDialog (wxWindow* parent, Config::Nag nag, wxString message, bool if (can_cancel) { flags |= wxCANCEL; } - wxSizer* buttons = CreateSeparatedButtonSizer (flags); + auto buttons = CreateSeparatedButtonSizer (flags); if (buttons) { sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder()); } @@ -61,12 +63,14 @@ NagDialog::NagDialog (wxWindow* parent, Config::Nag nag, wxString message, bool sizer->SetSizeHints (this); } + void NagDialog::shut_up (wxCommandEvent& ev) { Config::instance()->set_nagged (_nag, ev.IsChecked()); } + /** @return true if the user clicked Cancel */ bool NagDialog::maybe_nag (wxWindow* parent, Config::Nag nag, wxString message, bool can_cancel) diff --git a/src/wx/nag_dialog.h b/src/wx/nag_dialog.h index bc5ae6962..11fb907f0 100644 --- a/src/wx/nag_dialog.h +++ b/src/wx/nag_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2017 Carl Hetherington <cth@carlh.net> + Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,12 +18,14 @@ */ + #include "lib/config.h" #include "lib/warnings.h" DCPOMATIC_DISABLE_WARNINGS #include <wx/wx.h> DCPOMATIC_ENABLE_WARNINGS + class NagDialog : public wxDialog { public: diff --git a/src/wx/player_config_dialog.cc b/src/wx/player_config_dialog.cc index 557e6b8e7..802ab6b3b 100644 --- a/src/wx/player_config_dialog.cc +++ b/src/wx/player_config_dialog.cc @@ -63,7 +63,7 @@ using std::make_pair; using std::map; using boost::bind; using std::shared_ptr; -using boost::function; +using std::function; using boost::optional; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; diff --git a/src/wx/suspender.cc b/src/wx/suspender.cc index 88128874c..7680c147b 100644 --- a/src/wx/suspender.cc +++ b/src/wx/suspender.cc @@ -22,9 +22,8 @@ #include "suspender.h" -Suspender::Suspender(boost::function<void (int)> handler) +Suspender::Suspender(std::function<void (int)> handler) : _handler (handler) - , _count (0) { } diff --git a/src/wx/suspender.h b/src/wx/suspender.h index 947d7a367..e01888823 100644 --- a/src/wx/suspender.h +++ b/src/wx/suspender.h @@ -19,14 +19,14 @@ */ -#include <boost/function.hpp> +#include <functional> #include <set> class Suspender { public: - Suspender (boost::function<void (int)> handler); + Suspender (std::function<void (int)> handler); bool check (int property); @@ -47,7 +47,7 @@ private: void increment (); void decrement (); - boost::function<void (int)> _handler; - int _count; + std::function<void (int)> _handler; + int _count = 0; std::set<int> _pending; }; diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index 97ddd5151..1c459595e 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -34,7 +34,6 @@ DCPOMATIC_DISABLE_WARNINGS #include <wx/wx.h> DCPOMATIC_ENABLE_WARNINGS #include <wx/gbsizer.h> -#include <boost/function.hpp> #include <boost/thread.hpp> #include <boost/signals2.hpp> |
