X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fkdm_dialog.cc;h=5ed1169b13390a3ac8504f39609dd7ce428dcee1;hb=7e4d7d9e4f146576a63c6ab1be9bca5a79b507d9;hp=b5ebd1e968c79dd0e1d11406244e24d5414e3eb3;hpb=55861a0b4ad4270f80b8d1ae10230cf2ebb25735;p=dcpomatic.git diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index b5ebd1e96..5ed1169b1 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -24,12 +24,15 @@ #include "kdm_timing_panel.h" #include "kdm_output_panel.h" #include "kdm_cpl_panel.h" +#include "confirm_kdm_email_dialog.h" #include "lib/film.h" #include "lib/screen.h" #include "lib/screen_kdm.h" #include "lib/send_kdm_email_job.h" #include "lib/job_manager.h" #include "lib/cinema_kdms.h" +#include "lib/config.h" +#include "lib/cinema.h" #include #include #include @@ -45,6 +48,7 @@ using std::cout; using std::vector; using std::make_pair; using boost::shared_ptr; +using boost::bind; KDMDialog::KDMDialog (wxWindow* parent, shared_ptr film) : wxDialog (parent, wxID_ANY, _("Make KDMs")) @@ -103,7 +107,7 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr film) _screens->ScreensChanged.connect (boost::bind (&KDMDialog::setup_sensitivity, this)); _timing->TimingChanged.connect (boost::bind (&KDMDialog::setup_sensitivity, this)); - _make->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KDMDialog::make_clicked, this)); + _make->Bind (wxEVT_BUTTON, boost::bind (&KDMDialog::make_clicked, this)); setup_sensitivity (); @@ -120,6 +124,15 @@ KDMDialog::setup_sensitivity () _make->Enable (!_screens->screens().empty() && _timing->valid() && _cpl->has_selected()); } +bool +KDMDialog::confirm_overwrite (boost::filesystem::path path) +{ + return confirm_dialog ( + this, + wxString::Format (_("File %s already exists. Do you want to overwrite it?"), std_to_wx(path.string()).data()) + ); +} + void KDMDialog::make_clicked () { @@ -143,20 +156,42 @@ KDMDialog::make_clicked () screen_kdms, _output->directory(), _output->name_format(), - name_values + name_values, + bind (&KDMDialog::confirm_overwrite, this, _1) ); } if (_output->email ()) { - JobManager::instance()->add ( - shared_ptr (new SendKDMEmailJob ( - CinemaKDMs::collect (screen_kdms), - _output->name_format(), - name_values, - film->dcp_name(), - film->log() - )) - ); + + list const cinema_kdms = CinemaKDMs::collect (screen_kdms); + + bool ok = true; + + if (Config::instance()->confirm_kdm_email ()) { + list emails; + BOOST_FOREACH (CinemaKDMs i, cinema_kdms) { + BOOST_FOREACH (string j, i.cinema->emails) { + emails.push_back (j); + } + } + + ConfirmKDMEmailDialog* d = new ConfirmKDMEmailDialog (this, emails); + if (d->ShowModal() == wxID_CANCEL) { + ok = false; + } + } + + if (ok) { + JobManager::instance()->add ( + shared_ptr (new SendKDMEmailJob ( + cinema_kdms, + _output->name_format(), + name_values, + film->dcp_name(), + film->log() + )) + ); + } } } catch (dcp::NotEncryptedError& e) { error_dialog (this, _("CPL's content is not encrypted."));