X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Fcontent_view.cc;h=1cdfbc00f8f4fb49d95a9594330404195d34695d;hp=51473cb8652d030e6060bdbb12402583add3b0ea;hb=386e25f3b9d3fa59cbdeed458d9b3e0d21e338b8;hpb=6349c88c4fb9d4ac76ef14b277d455e3a2b006a6 diff --git a/src/wx/content_view.cc b/src/wx/content_view.cc index 51473cb86..1cdfbc00f 100644 --- a/src/wx/content_view.cc +++ b/src/wx/content_view.cc @@ -39,10 +39,10 @@ using boost::shared_ptr; using boost::weak_ptr; using boost::optional; using boost::dynamic_pointer_cast; +using namespace dcpomatic; -ContentView::ContentView (wxWindow* parent, weak_ptr film) +ContentView::ContentView (wxWindow* parent) : wxListCtrl (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER) - , _film (film) { AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 80); /* type */ @@ -66,18 +66,13 @@ ContentView::selected () const void ContentView::update () { - shared_ptr film = _film.lock (); - if (!film) { - return; - } - using namespace boost::filesystem; DeleteAllItems (); _content.clear (); optional dir = Config::instance()->player_content_directory(); - if (!dir) { - return; + if (!dir || !boost::filesystem::is_directory(*dir)) { + dir = home_directory (); } wxProgressDialog progress (_("DCP-o-matic"), _("Reading content directory")); @@ -89,13 +84,13 @@ ContentView::update () try { shared_ptr content; if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) { - content.reset (new DCPContent(film, *i)); + content.reset (new DCPContent(*i)); } else if (i->path().extension() == ".mp4" || i->path().extension() == ".ecinema") { - content = content_factory(film, *i).front(); + content = content_factory(*i).front(); } if (content) { - shared_ptr job(new ExamineContentJob(film, content)); + shared_ptr job(new ExamineContentJob(shared_ptr(), content)); jm->add (job); jobs.push_back (job); } @@ -114,7 +109,7 @@ ContentView::update () } return; } - dcpomatic_sleep (1); + dcpomatic_sleep_seconds (1); } /* Add content from successful jobs and report errors */ @@ -136,7 +131,7 @@ ContentView::add (shared_ptr content) wxListItem it; it.SetId(N); it.SetColumn(0); - DCPTime length = content->length_after_trim (); + 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)); @@ -167,14 +162,3 @@ ContentView::get (string digest) const return shared_ptr(); } - -void -ContentView::set_film (weak_ptr film) -{ - if (_film.lock() == film.lock()) { - return; - } - - _film = film; - update (); -}