X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Ftext_panel.cc;h=76dd21489f831b54c1a56a51a58f0d42eeb38ea4;hp=95c422fd0c8dbf96f7db502616f2d4bff3dfe827;hb=693013b77341e4177c792de091ab9a524e33c477;hpb=051dbf3c6b1518326ed6605df724c94d6cbee344 diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index 95c422fd0..76dd21489 100644 --- a/src/wx/text_panel.cc +++ b/src/wx/text_panel.cc @@ -61,6 +61,9 @@ using std::string; using std::vector; using boost::bind; using boost::optional; +#if BOOST_VERSION >= 106100 +using namespace boost::placeholders; +#endif /** @param t Original text type of the content, if known */ @@ -826,13 +829,13 @@ TextPanel::try_to_load_analysis () if (!boost::filesystem::exists(path)) { for (auto i: JobManager::instance()->get()) { - if (dynamic_pointer_cast(i)) { + if (dynamic_pointer_cast(i) && !i->finished()) { i->cancel (); } } JobManager::instance()->analyse_subtitles ( - _parent->film(), content, _analysis_finished_connection, bind(&TextPanel::analysis_finished, this) + _parent->film(), content, _analysis_finished_connection, bind(&TextPanel::analysis_finished, this, _1) ); return; } @@ -842,7 +845,7 @@ TextPanel::try_to_load_analysis () } catch (OldFormatError& e) { /* An old analysis file: recreate it */ JobManager::instance()->analyse_subtitles ( - _parent->film(), content, _analysis_finished_connection, bind(&TextPanel::analysis_finished, this) + _parent->film(), content, _analysis_finished_connection, bind(&TextPanel::analysis_finished, this, _1) ); return; } @@ -884,27 +887,25 @@ TextPanel::clear_outline_subtitles () void -TextPanel::analysis_finished () +TextPanel::analysis_finished(Job::Result result) { + _loading_analysis = false; + auto content = _analysis_content.lock (); - if (!content) { - _loading_analysis = false; - setup_sensitivity (); + if (!content || result == Job::Result::RESULT_CANCELLED) { + clear_outline_subtitles(); + setup_sensitivity(); return; } if (!boost::filesystem::exists(_parent->film()->subtitle_analysis_path(content))) { - /* We analysed and still nothing showed up, so maybe it was cancelled or it failed. - Give up. - */ + /* We analysed and still nothing showed up, so maybe it failed. Give up. */ error_dialog (_parent->window(), _("Could not analyse subtitles.")); clear_outline_subtitles (); - _loading_analysis = false; setup_sensitivity (); return; } - _loading_analysis = false; try_to_load_analysis (); }