Tidy up HMSF handling in a few places.
[dcpomatic.git] / src / wx / content_view.cc
index d4e18108dd3a97225222f16132bf445cf03d10b3..b3a66a7bee500393c43dd535d302dd8c87a13eeb 100644 (file)
 using std::string;
 using std::cout;
 using std::list;
-using boost::shared_ptr;
-using boost::weak_ptr;
+using std::shared_ptr;
+using std::weak_ptr;
 using boost::optional;
-using boost::dynamic_pointer_cast;
+using std::dynamic_pointer_cast;
 using namespace dcpomatic;
 
 ContentView::ContentView (wxWindow* parent)
@@ -82,6 +82,8 @@ ContentView::update ()
 
        for (directory_iterator i = directory_iterator(*dir); i != directory_iterator(); ++i) {
                try {
+                       progress.Pulse ();
+
                        shared_ptr<Content> content;
                        if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) {
                                content.reset (new DCPContent(*i));
@@ -104,7 +106,7 @@ ContentView::update ()
        while (jm->work_to_do()) {
                if (!progress.Pulse()) {
                        /* user pressed cancel */
-                       BOOST_FOREACH (shared_ptr<Job> i, jm->get()) {
+                       for (auto i: jm->get()) {
                                i->cancel();
                        }
                        return;
@@ -113,7 +115,7 @@ ContentView::update ()
        }
 
        /* Add content from successful jobs and report errors */
-       BOOST_FOREACH (shared_ptr<ExamineContentJob> i, jobs) {
+       for (auto i: jobs) {
                if (i->finished_in_error()) {
                        error_dialog(this, std_to_wx(i->error_summary()) + ".\n", std_to_wx(i->error_details()));
                } else {
@@ -131,13 +133,12 @@ ContentView::add (shared_ptr<Content> content)
        wxListItem it;
        it.SetId(N);
        it.SetColumn(0);
-       DCPTime length = content->approximate_length ();
-       int h, m, s, f;
-       length.split (24, h, m, s, f);
-       it.SetText(wxString::Format("%02d:%02d:%02d", h, m, s));
+       auto length = content->approximate_length ();
+       auto const hmsf = length.split (24);
+       it.SetText(wxString::Format("%02d:%02d:%02d", hmsf.h, hmsf.m, hmsf.s));
        InsertItem(it);
 
-       shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(content);
+       auto dcp = dynamic_pointer_cast<DCPContent>(content);
        if (dcp && dcp->content_kind()) {
                it.SetId(N);
                it.SetColumn(1);
@@ -154,7 +155,7 @@ ContentView::add (shared_ptr<Content> content)
 shared_ptr<Content>
 ContentView::get (string digest) const
 {
-       BOOST_FOREACH (shared_ptr<Content> i, _content) {
+       for (auto i: _content) {
                if (i->digest() == digest) {
                        return i;
                }