+2018-05-16 Carl Hetherington <cth@carlh.net>
+
+ * Add cancel button to DCP verification progress dialogue (#1294).
+
2018-05-15 Carl Hetherington <cth@carlh.net>
* Fix crash on enabling telecine filter.
- * Fix incorrect subtitle positining in a VF when there are more than
+ * Fix incorrect subtitle positioning in a VF when there are more than
two consecutive reels with no subtitles.
* Fix missing burnt-in / previewed subtitles containing ampersands.
}
_film->examine_and_add_content (dcp, true);
- progress (_("Loading DCP"));
- if (!report_errors_from_last_job()) {
+ bool const ok = progress (_("Loading DCP"));
+ if (!ok || !report_errors_from_last_job()) {
return;
}
DCPOMATIC_ASSERT (dcp);
dcp->add_ov (wx_to_std(c->GetPath()));
JobManager::instance()->add(shared_ptr<Job>(new ExamineContentJob (_film, dcp)));
- progress (_("Loading DCP"));
- if (!report_errors_from_last_job()) {
+ bool const ok = progress (_("Loading DCP"));
+ if (!ok || !report_errors_from_last_job()) {
return;
}
setup_from_dcp (dcp);
JobManager* jm = JobManager::instance ();
jm->add (shared_ptr<Job> (new VerifyDCPJob (dcp->directories())));
- progress (_("Verifying DCP"));
+ bool const ok = progress (_("Verifying DCP"));
+ if (!ok) {
+ return;
+ }
DCPOMATIC_ASSERT (!jm->get().empty());
shared_ptr<VerifyDCPJob> last = dynamic_pointer_cast<VerifyDCPJob> (jm->get().back());
private:
- void progress (wxString task)
+ /** @return false if the task was cancelled */
+ bool progress (wxString task)
{
JobManager* jm = JobManager::instance ();
- wxProgressDialog* progress = new wxProgressDialog (_("DCP-o-matic Player"), task);
+ wxProgressDialog* progress = new wxProgressDialog (_("DCP-o-matic Player"), task, 100, 0, wxPD_CAN_ABORT);
+
+ bool ok = true;
while (jm->work_to_do() || signal_manager->ui_idle()) {
dcpomatic_sleep (1);
- progress->Pulse ();
+ if (!progress->Pulse()) {
+ /* user pressed cancel */
+ BOOST_FOREACH (shared_ptr<Job> i, jm->get()) {
+ i->cancel();
+ }
+ ok = false;
+ break;
+ }
}
progress->Destroy ();
+ return ok;
}
bool report_errors_from_last_job ()