diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-03-16 01:51:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-03-16 22:45:19 +0100 |
| commit | 693013b77341e4177c792de091ab9a524e33c477 (patch) | |
| tree | 8960c3488d2c1d2fefaec34b26360477acc73218 | |
| parent | c7044a1b444c2e5e7659bf5d34ed5ac73f5a6271 (diff) | |
Don't show an error when cancelling subtitle analysis.
| -rw-r--r-- | src/wx/text_panel.cc | 18 | ||||
| -rw-r--r-- | src/wx/text_panel.h | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index 2fdcbb51f..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 */ @@ -832,7 +835,7 @@ TextPanel::try_to_load_analysis () } 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,20 +887,19 @@ TextPanel::clear_outline_subtitles () void -TextPanel::analysis_finished () +TextPanel::analysis_finished(Job::Result result) { _loading_analysis = false; auto content = _analysis_content.lock (); - if (!content) { - 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 (); setup_sensitivity (); diff --git a/src/wx/text_panel.h b/src/wx/text_panel.h index 52ef4d1fc..eee5e916c 100644 --- a/src/wx/text_panel.h +++ b/src/wx/text_panel.h @@ -63,7 +63,7 @@ private: void update_dcp_track_selection (); void add_to_grid () override; void try_to_load_analysis (); - void analysis_finished (); + void analysis_finished(Job::Result result); void language_changed (); void language_is_additional_changed (); |
