- /** @return false if the task was cancelled */
- bool progress (wxString task)
- {
- JobManager* jm = JobManager::instance ();
-
- 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);
- 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 ()
- {
- JobManager* jm = JobManager::instance ();
-
- DCPOMATIC_ASSERT (!jm->get().empty());
-
- shared_ptr<Job> last = jm->get().back();
- if (last->finished_in_error()) {
- error_dialog(this, std_to_wx(last->error_summary()) + ".\n", std_to_wx(last->error_details()));
- return false;
- }
-
- return true;
- }
-
- void setup_from_dcp (shared_ptr<DCPContent> dcp)
- {
- BOOST_FOREACH (shared_ptr<TextContent> i, dcp->text) {
- i->set_use (true);
- }
-
- if (dcp->video) {
- Ratio const * r = Ratio::nearest_from_ratio(dcp->video->size().ratio());
- if (r) {
- _film->set_container(r);
- }
- }
- }
-