Try to improve the UI for decryption/signing keys by hiding
[dcpomatic.git] / src / wx / kdm_output_panel.cc
index bbfc1a01d4bf53ff6b7bca07742d9adda1d29661..0b99ee465213d7da6a095aafb328e787626a2839 100644 (file)
@@ -132,10 +132,25 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
        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);
 }
@@ -150,6 +165,18 @@ KDMOutputPanel::setup_sensitivity ()
        _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
@@ -211,8 +238,8 @@ KDMOutputPanel::make (
        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()) {
@@ -248,6 +275,7 @@ KDMOutputPanel::make (
                        job.reset (
                                new SendKDMEmailJob (
                                        cinema_kdms,
+                                       _container_name_format->get(),
                                        _filename_format->get(),
                                        name_values,
                                        name,