add_label_to_sizer (table, this, _("KDM type"), true);
_type = new wxChoice (this, wxID_ANY);
_type->Append ("Modified Transitional 1", ((void *) dcp::MODIFIED_TRANSITIONAL_1));
+ _type->Append ("Multiple Modified Transitional 1", ((void *) dcp::MULTIPLE_MODIFIED_TRANSITIONAL_1));
_type->Append ("Modified Transitional 1 (without AuthorizedDeviceInfo)", ((void *) dcp::MODIFIED_TRANSITIONAL_TEST));
if (!interop) {
_type->Append ("DCI Any", ((void *) dcp::DCI_ANY));
table->Add (_email, 1, wxEXPAND);
table->AddSpacer (0);
+ switch (Config::instance()->last_kdm_write_type().get_value_or(Config::KDM_WRITE_FLAT)) {
+ case Config::KDM_WRITE_FLAT:
+ _write_flat->SetValue (true);
+ break;
+ case Config::KDM_WRITE_FOLDER:
+ _write_folder->SetValue (true);
+ break;
+ case Config::KDM_WRITE_ZIP:
+ _write_zip->SetValue (true);
+ break;
+ }
+
_write_to->SetValue (true);
- _write_to->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
- _email->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+ _write_to->Bind (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+ _email->Bind (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+ _write_flat->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
+ _write_folder->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
+ _write_zip->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
SetSizer (table);
}
_write_zip->Enable (write);
}
+void
+KDMOutputPanel::kdm_write_type_changed ()
+{
+ if (_write_flat->GetValue()) {
+ Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_FLAT);
+ } else if (_write_folder->GetValue()) {
+ Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_FOLDER);
+ } else if (_write_zip->GetValue()) {
+ Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_ZIP);
+ }
+}
+
pair<shared_ptr<Job>, int>
KDMOutputPanel::make (
list<ScreenKDM> screen_kdms, string name, KDMTimingPanel* timing, function<bool (boost::filesystem::path)> confirm_overwrite, shared_ptr<Log> log
)
{
+ list<CinemaKDMs> const cinema_kdms = CinemaKDMs::collect (screen_kdms);
+
+ /* Decide whether to proceed */
+
+ bool proceed = true;
+
+ if (_email->GetValue ()) {
+
+ if (Config::instance()->mail_server().empty ()) {
+ proceed = false;
+ error_dialog (this, _("You must set up a mail server in Preferences before you can send emails."));
+ }
+
+ bool cinemas_with_no_email = false;
+ BOOST_FOREACH (CinemaKDMs i, cinema_kdms) {
+ if (i.cinema->emails.empty ()) {
+ cinemas_with_no_email = true;
+ }
+ }
+
+ if (proceed && cinemas_with_no_email && !confirm_dialog (
+ this,
+ _("You have selected some cinemas that have no configured email address. Do you want to continue?")
+ )) {
+ proceed = false;
+ }
+
+ if (proceed && Config::instance()->confirm_kdm_email ()) {
+ list<string> emails;
+ BOOST_FOREACH (CinemaKDMs i, cinema_kdms) {
+ BOOST_FOREACH (string j, i.cinema->emails) {
+ emails.push_back (j);
+ }
+ }
+
+ if (!emails.empty ()) {
+ ConfirmKDMEmailDialog* d = new ConfirmKDMEmailDialog (this, emails);
+ if (d->ShowModal() == wxID_CANCEL) {
+ proceed = false;
+ }
+ }
+ }
+ }
+
+ if (!proceed) {
+ return make_pair (shared_ptr<Job>(), 0);
+ }
+
Config::instance()->set_kdm_filename_format (_filename_format->get ());
int written = 0;
try {
dcp::NameFormat::Map name_values;
name_values['f'] = name;
- name_values['b'] = dcp::LocalTime(timing->from()).date() + " " + dcp::LocalTime(timing->from()).time_of_day();
- name_values['e'] = dcp::LocalTime(timing->until()).date() + " " + dcp::LocalTime(timing->until()).time_of_day();
+ name_values['b'] = dcp::LocalTime(timing->from()).date() + " " + dcp::LocalTime(timing->from()).time_of_day(false, false);
+ name_values['e'] = dcp::LocalTime(timing->until()).date() + " " + dcp::LocalTime(timing->until()).time_of_day(false, false);
if (_write_to->GetValue()) {
if (_write_flat->GetValue()) {
}
if (_email->GetValue ()) {
-
- list<CinemaKDMs> const cinema_kdms = CinemaKDMs::collect (screen_kdms);
-
- bool ok = true;
-
- if (Config::instance()->confirm_kdm_email ()) {
- list<string> 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) {
- job.reset (
- new SendKDMEmailJob (
- cinema_kdms,
- _filename_format->get(),
- name_values,
- name,
- log
- )
- );
- }
+ job.reset (
+ new SendKDMEmailJob (
+ cinema_kdms,
+ _container_name_format->get(),
+ _filename_format->get(),
+ name_values,
+ name,
+ log
+ )
+ );
}
+
} catch (dcp::NotEncryptedError& e) {
error_dialog (this, _("CPL's content is not encrypted."));
} catch (exception& e) {
- error_dialog (this, e.what ());
+ error_dialog (this, std_to_wx(e.what()));
} catch (...) {
error_dialog (this, _("An unknown exception occurred."));
}