+ Bind (wxEVT_CLOSE_WINDOW, boost::bind (&DOMFrame::close, this, _1));
+ Bind (wxEVT_SIZE, boost::bind (&DOMFrame::sized, this, _1));
+ }
+
+ void setup_sensitivity ()
+ {
+ _pause->Enable (!JobManager::instance()->paused());
+ _resume->Enable (JobManager::instance()->paused());
+ }
+
+ void pause ()
+ {
+ JobManager::instance()->pause ();
+ setup_sensitivity ();
+ }
+
+ void resume ()
+ {
+ JobManager::instance()->resume ();
+ setup_sensitivity ();
+ }
+
+ void start_job (boost::filesystem::path path)
+ {
+ try {
+ shared_ptr<Film> film (new Film (path));
+ film->read_metadata ();
+
+ double total_required;
+ double available;
+ bool can_hard_link;
+
+ film->should_be_enough_disk_space (total_required, available, can_hard_link);
+
+ set<shared_ptr<const Film> > films;
+
+ for (auto i: JobManager::instance()->get()) {
+ films.insert (i->film());
+ }
+
+ for (auto i: films) {
+ double progress = 0;
+ for (auto j: JobManager::instance()->get()) {
+ if (i == j->film() && dynamic_pointer_cast<TranscodeJob>(j)) {
+ progress = j->progress().get_value_or(0);
+ }
+ }
+
+ double required;
+ i->should_be_enough_disk_space (required, available, can_hard_link);
+ total_required += (1 - progress) * required;
+ }
+
+ if ((total_required - available) > 1) {
+ if (!confirm_dialog (
+ this,
+ wxString::Format(
+ _("The DCPs for this film and the films already in the queue will take up about %.1f GB. The "
+ "disks that you are using only have %.1f GB available. Do you want to add this film to the queue anyway?"),
+ total_required, available))) {
+ return;
+ }
+ }
+
+ film->make_dcp ();
+ } catch (std::exception& e) {
+ wxString p = std_to_wx (path.string ());
+ wxCharBuffer b = p.ToUTF8 ();
+ error_dialog (this, wxString::Format (_("Could not open film at %s"), p.data()), std_to_wx(e.what()));
+ }