diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-06-21 01:14:06 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-06-21 01:14:06 +0100 |
| commit | 5a5324ed3a381a86dfe0a6e3932c1d58fdcd596f (patch) | |
| tree | 769dca1358e35017ce5a5b3ab2dfafe2b24d61ed /src/wx | |
| parent | 4e83acad0c2a5c528709a175a80261b8147d3b49 (diff) | |
Use make_shared<>.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/audio_panel.cc | 6 | ||||
| -rw-r--r-- | src/wx/colour_conversion_editor.cc | 20 | ||||
| -rw-r--r-- | src/wx/content_menu.cc | 6 | ||||
| -rw-r--r-- | src/wx/hints_dialog.cc | 4 | ||||
| -rw-r--r-- | src/wx/job_manager_view.cc | 6 | ||||
| -rw-r--r-- | src/wx/report_problem_dialog.cc | 4 | ||||
| -rw-r--r-- | src/wx/screens_panel.cc | 6 | ||||
| -rw-r--r-- | src/wx/timeline.cc | 10 |
8 files changed, 37 insertions, 25 deletions
diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index ab26329a4..8ffe8b7a4 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -33,6 +33,7 @@ #include "lib/audio_content.h" #include <wx/spinctrl.h> #include <boost/foreach.hpp> +#include <boost/make_shared.hpp> #include <iostream> using std::vector; @@ -42,6 +43,7 @@ using std::list; using std::pair; using boost::dynamic_pointer_cast; using boost::shared_ptr; +using boost::make_shared; using boost::optional; AudioPanel::AudioPanel (ContentPanel* p) @@ -312,10 +314,10 @@ AudioPanel::setup_peak () if (sel.size() != 1) { _peak->SetLabel (wxT ("")); } else { - shared_ptr<Playlist> playlist (new Playlist); + shared_ptr<Playlist> playlist = make_shared<Playlist> (); playlist->add (sel.front ()); try { - shared_ptr<AudioAnalysis> analysis (new AudioAnalysis (_parent->film()->audio_analysis_path (playlist))); + shared_ptr<AudioAnalysis> analysis = make_shared<AudioAnalysis> (_parent->film()->audio_analysis_path (playlist)); if (analysis->sample_peak ()) { float const peak_dB = 20 * log10 (analysis->sample_peak().get()) + analysis->gain_correction (playlist); if (peak_dB > -3) { diff --git a/src/wx/colour_conversion_editor.cc b/src/wx/colour_conversion_editor.cc index 01b1ca056..19ebc90d5 100644 --- a/src/wx/colour_conversion_editor.cc +++ b/src/wx/colour_conversion_editor.cc @@ -27,11 +27,13 @@ #include <dcp/modified_gamma_transfer_function.h> #include <wx/spinctrl.h> #include <wx/gbsizer.h> +#include <boost/make_shared.hpp> #include <iostream> using std::string; using std::cout; using boost::shared_ptr; +using boost::make_shared; using boost::dynamic_pointer_cast; ColourConversionEditor::ColourConversionEditor (wxWindow* parent, bool yuv) @@ -308,19 +310,15 @@ ColourConversionEditor::get () const if (_input_gamma_linearised->GetValue ()) { conversion.set_in ( - shared_ptr<dcp::ModifiedGammaTransferFunction> ( - new dcp::ModifiedGammaTransferFunction ( - _input_power->GetValue (), - raw_convert<double> (wx_to_std (_input_threshold->GetValue ())), - raw_convert<double> (wx_to_std (_input_A->GetValue ())), - raw_convert<double> (wx_to_std (_input_B->GetValue ())) - ) + make_shared<dcp::ModifiedGammaTransferFunction> ( + _input_power->GetValue (), + raw_convert<double> (wx_to_std (_input_threshold->GetValue ())), + raw_convert<double> (wx_to_std (_input_A->GetValue ())), + raw_convert<double> (wx_to_std (_input_B->GetValue ())) ) ); } else { - conversion.set_in ( - shared_ptr<dcp::GammaTransferFunction> (new dcp::GammaTransferFunction (_input_gamma->GetValue ())) - ); + conversion.set_in (make_shared<dcp::GammaTransferFunction> (_input_gamma->GetValue ())); } conversion.set_yuv_to_rgb (static_cast<dcp::YUVToRGB> (_yuv_to_rgb->GetSelection ())); @@ -349,7 +347,7 @@ ColourConversionEditor::get () const conversion.unset_adjusted_white (); } - conversion.set_out (shared_ptr<dcp::GammaTransferFunction> (new dcp::GammaTransferFunction (2.6))); + conversion.set_out (make_shared<dcp::GammaTransferFunction> (2.6)); return conversion; } diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc index 3d5b00279..99b942174 100644 --- a/src/wx/content_menu.cc +++ b/src/wx/content_menu.cc @@ -37,12 +37,14 @@ #include <wx/wx.h> #include <wx/dirdlg.h> #include <boost/foreach.hpp> +#include <boost/make_shared.hpp> #include <iostream> using std::cout; using std::vector; using std::exception; using boost::shared_ptr; +using boost::make_shared; using boost::weak_ptr; using boost::dynamic_pointer_cast; @@ -159,7 +161,7 @@ ContentMenu::join () } try { - shared_ptr<FFmpegContent> joined (new FFmpegContent (film, fc)); + shared_ptr<FFmpegContent> joined = boost::make_shared<FFmpegContent> (film, fc); BOOST_FOREACH (shared_ptr<Content> i, _content) { film->remove_content (i); } @@ -264,7 +266,7 @@ ContentMenu::find_missing () return; } - shared_ptr<Job> j (new ExamineContentJob (film, content)); + shared_ptr<Job> j = make_shared<ExamineContentJob> (film, content); _job_connection = j->Finished.connect ( bind ( diff --git a/src/wx/hints_dialog.cc b/src/wx/hints_dialog.cc index 72ab0eef4..2150d4576 100644 --- a/src/wx/hints_dialog.cc +++ b/src/wx/hints_dialog.cc @@ -29,9 +29,11 @@ #include <wx/richtext/richtextctrl.h> #include <boost/algorithm/string.hpp> #include <boost/foreach.hpp> +#include <boost/make_shared.hpp> using std::max; using boost::shared_ptr; +using boost::make_shared; using boost::optional; using boost::dynamic_pointer_cast; @@ -176,7 +178,7 @@ HintsDialog::film_changed () boost::filesystem::path path = film->audio_analysis_path (film->playlist ()); if (boost::filesystem::exists (path)) { - shared_ptr<AudioAnalysis> an (new AudioAnalysis (path)); + shared_ptr<AudioAnalysis> an = make_shared<AudioAnalysis> (path); if (an->sample_peak() || an->true_peak()) { float const peak = max (an->sample_peak().get_value_or(0), an->true_peak().get_value_or(0)); float const peak_dB = 20 * log10 (peak) + an->gain_correction (film->playlist ()); diff --git a/src/wx/job_manager_view.cc b/src/wx/job_manager_view.cc index cd6918b72..cba221784 100644 --- a/src/wx/job_manager_view.cc +++ b/src/wx/job_manager_view.cc @@ -19,7 +19,7 @@ */ /** @file src/job_manager_view.cc - * @brief Class generating a GTK widget to show the progress of jobs. + * @brief Class generating a widget to show the progress of jobs. */ #include "job_manager_view.h" @@ -30,6 +30,7 @@ #include "lib/util.h" #include "lib/exceptions.h" #include "lib/compose.hpp" +#include <boost/make_shared.hpp> #include <iostream> using std::string; @@ -38,6 +39,7 @@ using std::map; using std::min; using std::cout; using boost::shared_ptr; +using boost::make_shared; using boost::weak_ptr; /** Must be called in the GUI thread */ @@ -68,7 +70,7 @@ JobManagerView::job_added (weak_ptr<Job> j) { shared_ptr<Job> job = j.lock (); if (job) { - _job_records.push_back (shared_ptr<JobView> (new JobView (job, this, _panel, _table))); + _job_records.push_back (make_shared<JobView> (job, this, _panel, _table)); } } diff --git a/src/wx/report_problem_dialog.cc b/src/wx/report_problem_dialog.cc index 68411ee91..1a32e8fad 100644 --- a/src/wx/report_problem_dialog.cc +++ b/src/wx/report_problem_dialog.cc @@ -24,9 +24,11 @@ #include "lib/job_manager.h" #include "lib/send_problem_report_job.h" #include <wx/sizer.h> +#include <boost/make_shared.hpp> using std::string; using boost::shared_ptr; +using boost::make_shared; /** @param film Film that we are working on, or 0 */ ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr<Film> film) @@ -103,5 +105,5 @@ ReportProblemDialog::report () return; } - JobManager::instance()->add (shared_ptr<Job> (new SendProblemReportJob (_film, wx_to_std (_email->GetValue ()), wx_to_std (_summary->GetValue ())))); + JobManager::instance()->add (boost::make_shared<SendProblemReportJob> (_film, wx_to_std (_email->GetValue ()), wx_to_std (_summary->GetValue ()))); } diff --git a/src/wx/screens_panel.cc b/src/wx/screens_panel.cc index 0638763fe..df07a08c4 100644 --- a/src/wx/screens_panel.cc +++ b/src/wx/screens_panel.cc @@ -26,6 +26,7 @@ #include "cinema_dialog.h" #include "screen_dialog.h" #include <boost/foreach.hpp> +#include <boost/make_shared.hpp> using std::list; using std::pair; @@ -34,6 +35,7 @@ using std::map; using std::string; using std::make_pair; using boost::shared_ptr; +using boost::make_shared; using boost::optional; ScreensPanel::ScreensPanel (wxWindow* parent) @@ -149,7 +151,7 @@ ScreensPanel::add_cinema_clicked () { CinemaDialog* d = new CinemaDialog (this, _("Add Cinema")); if (d->ShowModal () == wxID_OK) { - shared_ptr<Cinema> c (new Cinema (d->name(), d->emails(), d->notes(), d->utc_offset_hour(), d->utc_offset_minute())); + shared_ptr<Cinema> c = boost::make_shared<Cinema> (d->name(), d->emails(), d->notes(), d->utc_offset_hour(), d->utc_offset_minute()); Config::instance()->add_cinema (c); add_cinema (c); } @@ -208,7 +210,7 @@ ScreensPanel::add_screen_clicked () return; } - shared_ptr<Screen> s (new Screen (d->name(), d->recipient(), d->trusted_devices())); + shared_ptr<Screen> s = boost::make_shared<Screen> (d->name(), d->recipient(), d->trusted_devices()); c->add_screen (s); optional<wxTreeItemId> id = add_screen (c, s); if (id) { diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 6bb216df8..ef8549d42 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -40,6 +40,7 @@ #include <wx/graphics.h> #include <boost/weak_ptr.hpp> #include <boost/foreach.hpp> +#include <boost/make_shared.hpp> #include <list> #include <iostream> @@ -47,6 +48,7 @@ using std::list; using std::cout; using std::max; using boost::shared_ptr; +using boost::make_shared; using boost::weak_ptr; using boost::dynamic_pointer_cast; using boost::bind; @@ -150,19 +152,19 @@ Timeline::recreate_views () BOOST_FOREACH (shared_ptr<Content> i, film->content ()) { if (i->video) { - _views.push_back (shared_ptr<TimelineView> (new TimelineVideoContentView (*this, i))); + _views.push_back (make_shared<TimelineVideoContentView> (*this, i)); } if (i->audio && !i->audio->mapping().mapped_output_channels().empty ()) { - _views.push_back (shared_ptr<TimelineView> (new TimelineAudioContentView (*this, i))); + _views.push_back (make_shared<TimelineAudioContentView> (*this, i)); } if (i->subtitle) { - _views.push_back (shared_ptr<TimelineView> (new TimelineSubtitleContentView (*this, i))); + _views.push_back (make_shared<TimelineSubtitleContentView> (*this, i)); } if (dynamic_pointer_cast<AtmosMXFContent> (i)) { - _views.push_back (shared_ptr<TimelineView> (new TimelineAtmosContentView (*this, i))); + _views.push_back (make_shared<TimelineAtmosContentView> (*this, i)); } } |
