More enum class additions.
[dcpomatic.git] / src / tools / dcpomatic_player.cc
index d4e247d62bb701be3ed8fffef1fd248ed425abb1..539b585042bcd3a258b0f890d3666aef4ac48825 100644 (file)
@@ -69,7 +69,7 @@
 #ifdef __WXGTK__
 #include <X11/Xlib.h>
 #endif
-#include <boost/bind.hpp>
+#include <boost/bind/bind.hpp>
 #include <boost/algorithm/string.hpp>
 #include <iostream>
 
@@ -84,11 +84,11 @@ using std::cout;
 using std::list;
 using std::exception;
 using std::vector;
-using boost::shared_ptr;
-using boost::weak_ptr;
+using std::shared_ptr;
+using std::weak_ptr;
 using boost::scoped_array;
 using boost::optional;
-using boost::dynamic_pointer_cast;
+using std::dynamic_pointer_cast;
 using boost::thread;
 using boost::bind;
 #if BOOST_VERSION >= 106100
@@ -278,7 +278,7 @@ public:
                }
 
                bool ok = true;
-               BOOST_FOREACH (shared_ptr<Content> i, _film->content()) {
+               for (auto i: _film->content()) {
                        shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent>(i);
                        if (d && !d->kdm_timing_window_valid()) {
                                ok = false;
@@ -303,7 +303,7 @@ public:
                if (dcp) {
                        DCPExaminer ex (dcp, true);
                        shared_ptr<dcp::CPL> playing_cpl;
-                       BOOST_FOREACH (shared_ptr<dcp::CPL> i, ex.cpls()) {
+                       for (auto i: ex.cpls()) {
                                if (!dcp->cpl() || i->id() == *dcp->cpl()) {
                                        playing_cpl = i;
                                }
@@ -315,7 +315,7 @@ public:
                                        "playback-started %s %s %s",
                                        time.timecode(_film->video_frame_rate()).c_str(),
                                        dcp->directories().front().string().c_str(),
-                                       playing_cpl->annotation_text().c_str()
+                                       playing_cpl->annotation_text().get_value_or("").c_str()
                                        )
                                );
                }
@@ -404,7 +404,7 @@ public:
 
        void film_changed (ChangeType type, Film::Property property)
        {
-               if (type != CHANGE_TYPE_DONE || property != Film::CONTENT) {
+               if (type != ChangeType::DONE || property != Film::CONTENT) {
                        return;
                }
 
@@ -415,15 +415,15 @@ public:
                /* Start off as Flat */
                _film->set_container (Ratio::from_id("185"));
 
-               BOOST_FOREACH (shared_ptr<Content> i, _film->content()) {
-                       shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(i);
+               for (auto i: _film->content()) {
+                       auto dcp = dynamic_pointer_cast<DCPContent>(i);
 
-                       BOOST_FOREACH (shared_ptr<TextContent> j, i->text) {
+                       for (auto j: i->text) {
                                j->set_use (true);
                        }
 
                        if (i->video) {
-                               Ratio const * r = Ratio::nearest_from_ratio(i->video->size().ratio());
+                               auto const r = Ratio::nearest_from_ratio(i->video->size().ratio());
                                if (r->id() == "239") {
                                        /* Any scope content means we use scope */
                                        _film->set_container(r);
@@ -431,7 +431,7 @@ public:
                        }
 
                        /* Any 3D content means we use 3D mode */
-                       if (i->video && i->video->frame_type() != VIDEO_FRAME_TYPE_2D) {
+                       if (i->video && i->video->frame_type() != VideoFrameType::TWO_D) {
                                _film->set_three_d (true);
                        }
                }
@@ -441,21 +441,21 @@ public:
 
                set_menu_sensitivity ();
 
-               wxMenuItemList old = _cpl_menu->GetMenuItems();
-               for (wxMenuItemList::iterator i = old.begin(); i != old.end(); ++i) {
-                       _cpl_menu->Remove (*i);
+               auto old = _cpl_menu->GetMenuItems();
+               for (auto const& i: old) {
+                       _cpl_menu->Remove (i);
                }
 
                if (_film->content().size() == 1) {
                        /* Offer a CPL menu */
-                       shared_ptr<DCPContent> first = dynamic_pointer_cast<DCPContent>(_film->content().front());
+                       auto first = dynamic_pointer_cast<DCPContent>(_film->content().front());
                        if (first) {
                                DCPExaminer ex (first, true);
                                int id = ID_view_cpl;
-                               BOOST_FOREACH (shared_ptr<dcp::CPL> i, ex.cpls()) {
-                                       wxMenuItem* j = _cpl_menu->AppendRadioItem(
+                               for (auto i: ex.cpls()) {
+                                       auto j = _cpl_menu->AppendRadioItem(
                                                id,
-                                               wxString::Format("%s (%s)", std_to_wx(i->annotation_text()).data(), std_to_wx(i->id()).data())
+                                               wxString::Format("%s (%s)", std_to_wx(i->annotation_text().get_value_or("")).data(), std_to_wx(i->id()).data())
                                                );
                                        j->Check(!first->cpl() || i->id() == *first->cpl());
                                        ++id;
@@ -473,11 +473,11 @@ private:
 
        bool report_errors_from_last_job (wxWindow* parent) const
        {
-               JobManager* jm = JobManager::instance ();
+               auto jm = JobManager::instance ();
 
                DCPOMATIC_ASSERT (!jm->get().empty());
 
-               shared_ptr<Job> last = jm->get().back();
+               auto last = jm->get().back();
                if (last->finished_in_error()) {
                        error_dialog(parent, wxString::Format(_("Could not load DCP.\n\n%s."), std_to_wx(last->error_summary()).data()), std_to_wx(last->error_details()));
                        return false;
@@ -532,7 +532,7 @@ private:
                view->AppendRadioItem(ID_view_scale_quarter, _("Decode at quarter resolution"))->Check(c && c.get() == 2);
 
                wxMenu* tools = new wxMenu;
-               _tools_verify = tools->Append (ID_tools_verify, _("Verify DCP"));
+               _tools_verify = tools->Append (ID_tools_verify, _("Verify DCP..."));
                tools->AppendSeparator ();
                tools->Append (ID_tools_check_for_updates, _("Check for updates"));
                tools->Append (ID_tools_timing, _("Timing..."));
@@ -604,7 +604,7 @@ private:
 
                if (r == wxID_OK) {
                        DCPOMATIC_ASSERT (_film);
-                       shared_ptr<DCPContent> dcp = boost::dynamic_pointer_cast<DCPContent>(_film->content().front());
+                       shared_ptr<DCPContent> dcp = std::dynamic_pointer_cast<DCPContent>(_film->content().front());
                        DCPOMATIC_ASSERT (dcp);
                        dcp->add_ov (wx_to_std(c->GetPath()));
                        JobManager::instance()->add(shared_ptr<Job>(new ExamineContentJob (_film, dcp)));
@@ -612,7 +612,7 @@ private:
                        if (!ok || !report_errors_from_last_job(this)) {
                                return;
                        }
-                       BOOST_FOREACH (shared_ptr<TextContent> i, dcp->text) {
+                       for (auto i: dcp->text) {
                                i->set_use (true);
                        }
                        if (dcp->video) {
@@ -633,7 +633,7 @@ private:
 
                if (d->ShowModal() == wxID_OK) {
                        DCPOMATIC_ASSERT (_film);
-                       shared_ptr<DCPContent> dcp = boost::dynamic_pointer_cast<DCPContent>(_film->content().front());
+                       shared_ptr<DCPContent> dcp = std::dynamic_pointer_cast<DCPContent>(_film->content().front());
                        DCPOMATIC_ASSERT (dcp);
                        try {
                                if (dcp) {
@@ -690,7 +690,7 @@ private:
 
        void view_cpl (wxCommandEvent& ev)
        {
-               shared_ptr<DCPContent> dcp = boost::dynamic_pointer_cast<DCPContent>(_film->content().front());
+               shared_ptr<DCPContent> dcp = std::dynamic_pointer_cast<DCPContent>(_film->content().front());
                DCPOMATIC_ASSERT (dcp);
                DCPExaminer ex (dcp, true);
                int id = ev.GetId() - ID_view_cpl;
@@ -785,7 +785,7 @@ private:
 
        void tools_verify ()
        {
-               shared_ptr<DCPContent> dcp = boost::dynamic_pointer_cast<DCPContent>(_film->content().front());
+               shared_ptr<DCPContent> dcp = std::dynamic_pointer_cast<DCPContent>(_film->content().front());
                DCPOMATIC_ASSERT (dcp);
 
                shared_ptr<VerifyDCPJob> job (new VerifyDCPJob(dcp->directories()));
@@ -994,7 +994,7 @@ private:
        shared_ptr<FilmViewer> _viewer;
        Controls* _controls;
        SystemInformationDialog* _system_information_dialog;
-       boost::shared_ptr<Film> _film;
+       std::shared_ptr<Film> _film;
        boost::signals2::scoped_connection _config_changed_connection;
        boost::signals2::scoped_connection _examine_job_connection;
        wxMenuItem* _file_add_ov;