+ void resume ()
+ {
+ JobManager::instance()->resume();
+ setup_sensitivity ();
+ }
+
+ void start_job (boost::filesystem::path path)
+ {
+ try {
+ auto film = make_shared<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;
+ }
+ }
+
+ make_dcp (film, TranscodeJob::ChangedBehaviour::STOP);
+ } catch (std::exception& e) {
+ auto p = std_to_wx (path.string ());
+ auto b = p.ToUTF8 ();
+ error_dialog (this, wxString::Format(_("Could not open film at %s"), p.data()), std_to_wx(e.what()));
+ }