#include "subtitle_appearance_dialog.h"
#include "text_panel.h"
#include "text_view.h"
-#include "wx_ptr.h"
#include "wx_util.h"
#include "lib/analyse_subtitles_job.h"
#include "lib/dcp_content.h"
#include "lib/decoder_factory.h"
#include "lib/ffmpeg_content.h"
#include "lib/ffmpeg_subtitle_stream.h"
+#include "lib/film.h"
#include "lib/job_manager.h"
-#include "lib/scope_guard.h"
#include "lib/string_text_file_content.h"
#include "lib/string_text_file_decoder.h"
#include "lib/subtitle_analysis.h"
#include "lib/text_content.h"
+#include <dcp/filesystem.h>
+#include <dcp/scope_guard.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/spinctrl.h>
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 */
void
-TextPanel::film_changed (Film::Property property)
+TextPanel::film_changed(FilmProperty property)
{
- if (property == Film::Property::CONTENT || property == Film::Property::REEL_TYPE || property == Film::Property::INTEROP) {
+ if (property == FilmProperty::CONTENT || property == FilmProperty::REEL_TYPE || property == FilmProperty::INTEROP) {
setup_sensitivity ();
}
}
}
_loading_analysis = true;
- ScopeGuard sg = [this]() {
+ dcp::ScopeGuard sg = [this]() {
_loading_analysis = false;
setup_sensitivity();
};
auto const path = _parent->film()->subtitle_analysis_path(content);
- if (!boost::filesystem::exists(path)) {
+ if (!dcp::filesystem::exists(path)) {
for (auto i: JobManager::instance()->get()) {
if (dynamic_pointer_cast<AnalyseSubtitlesJob>(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;
}
} 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;
}
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.
- */
+ if (!dcp::filesystem::exists(_parent->film()->subtitle_analysis_path(content))) {
+ /* 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 ();
}