diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-05-07 00:02:26 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-05-07 00:02:26 +0200 |
| commit | 47e29203daec51d313ed8ab8ef759752bce18d45 (patch) | |
| tree | 2b34f05ffe9ad73c49225e82d91a8dede9f3d6de /src/wx | |
| parent | e81c5eb9e8ff875240dde9fdaaab0a46f99af615 (diff) | |
| parent | 581797d640af1572f884ddf4395924894b745b3a (diff) | |
Add a new "Add DKDM" dialogue (#1637).
The basic motivation here is to avoid having to tell people to
"just" create a cinema with a screen in it just to be able to make
a DKDM. Here you can just have a recipient, with emails etc.
and make DKDMs for them. I hope this makes things clearer from the
user POV even if it does muddy the waters a bit with respect to
DKDMs just being KDMs (really).
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/cinema_dialog.cc | 31 | ||||
| -rw-r--r-- | src/wx/cinema_dialog.h | 14 | ||||
| -rw-r--r-- | src/wx/confirm_kdm_email_dialog.cc | 1 | ||||
| -rw-r--r-- | src/wx/kdm_dialog.cc | 17 | ||||
| -rw-r--r-- | src/wx/kdm_output_panel.cc | 34 | ||||
| -rw-r--r-- | src/wx/kdm_output_panel.h | 5 | ||||
| -rw-r--r-- | src/wx/recreate_chain_dialog.cc | 1 | ||||
| -rw-r--r-- | src/wx/wscript | 4 | ||||
| -rw-r--r-- | src/wx/wx_util.cc | 37 | ||||
| -rw-r--r-- | src/wx/wx_util.h | 17 |
10 files changed, 83 insertions, 78 deletions
diff --git a/src/wx/cinema_dialog.cc b/src/wx/cinema_dialog.cc index ff5d1faf6..31e6ebe79 100644 --- a/src/wx/cinema_dialog.cc +++ b/src/wx/cinema_dialog.cc @@ -83,37 +83,8 @@ CinemaDialog::CinemaDialog (wxWindow* parent, wxString title, string name, list< overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); } - _offsets.push_back (Offset (_("UTC-11"), -11, 0)); - _offsets.push_back (Offset (_("UTC-10"), -10, 0)); - _offsets.push_back (Offset (_("UTC-9"), -9, 0)); - _offsets.push_back (Offset (_("UTC-8"), -8, 0)); - _offsets.push_back (Offset (_("UTC-7"), -7, 0)); - _offsets.push_back (Offset (_("UTC-6"), -6, 0)); - _offsets.push_back (Offset (_("UTC-5"), -5, 0)); - _offsets.push_back (Offset (_("UTC-4:30"), -4, 30)); - _offsets.push_back (Offset (_("UTC-4"), -4, 0)); - _offsets.push_back (Offset (_("UTC-3:30"), -3, 30)); - _offsets.push_back (Offset (_("UTC-3"), -3, 0)); - _offsets.push_back (Offset (_("UTC-2"), -2, 0)); - _offsets.push_back (Offset (_("UTC-1"), -1, 0)); - _offsets.push_back (Offset (_("UTC") , 0, 0)); - _offsets.push_back (Offset (_("UTC+1"), 1, 0)); - _offsets.push_back (Offset (_("UTC+2"), 2, 0)); - _offsets.push_back (Offset (_("UTC+3"), 3, 0)); - _offsets.push_back (Offset (_("UTC+4"), 4, 0)); - _offsets.push_back (Offset (_("UTC+5"), 5, 0)); - _offsets.push_back (Offset (_("UTC+5:30"), 5, 30)); - _offsets.push_back (Offset (_("UTC+6"), 6, 0)); - _offsets.push_back (Offset (_("UTC+7"), 7, 0)); - _offsets.push_back (Offset (_("UTC+8"), 8, 0)); - _offsets.push_back (Offset (_("UTC+9"), 9, 0)); - _offsets.push_back (Offset (_("UTC+9:30"), 9, 30)); - _offsets.push_back (Offset (_("UTC+10"), 10, 0)); - _offsets.push_back (Offset (_("UTC+11"), 11, 0)); - _offsets.push_back (Offset (_("UTC+12"), 12, 0)); - /* Default to UTC */ - size_t sel = 13; + size_t sel = get_offsets (_offsets); for (size_t i = 0; i < _offsets.size(); ++i) { _utc_offset->Append (_offsets[i].name); if (_offsets[i].hour == utc_offset_hour && _offsets[i].minute == utc_offset_minute) { diff --git a/src/wx/cinema_dialog.h b/src/wx/cinema_dialog.h index 9cb0a65dc..d16b0ba9c 100644 --- a/src/wx/cinema_dialog.h +++ b/src/wx/cinema_dialog.h @@ -53,19 +53,5 @@ private: EditableList<std::string, EmailDialog>* _email_list; std::vector<std::string> _emails; wxChoice* _utc_offset; - - struct Offset - { - Offset (wxString n, int h, int m) - : name (n) - , hour (h) - , minute (m) - {} - - wxString name; - int hour; - int minute; - }; - std::vector<Offset> _offsets; }; diff --git a/src/wx/confirm_kdm_email_dialog.cc b/src/wx/confirm_kdm_email_dialog.cc index eca34b5cf..df6131fe1 100644 --- a/src/wx/confirm_kdm_email_dialog.cc +++ b/src/wx/confirm_kdm_email_dialog.cc @@ -23,7 +23,6 @@ #include "static_text.h" #include "check_box.h" #include "lib/config.h" -#include "lib/cinema_kdms.h" #include <boost/foreach.hpp> using std::list; diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index 8682fe82f..d3bbf02c9 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -29,9 +29,8 @@ #include "dcpomatic_button.h" #include "lib/film.h" #include "lib/screen.h" -#include "lib/screen_kdm.h" +#include "lib/kdm_with_metadata.h" #include "lib/job_manager.h" -#include "lib/cinema_kdms.h" #include "lib/config.h" #include "lib/cinema.h" #include <libcxml/cxml.h> @@ -150,7 +149,7 @@ KDMDialog::make_clicked () shared_ptr<const Film> film = _film.lock (); DCPOMATIC_ASSERT (film); - list<shared_ptr<ScreenKDM> > screen_kdms; + list<KDMWithMetadataPtr> kdms; try { /* Start off by enabling forensic marking for all */ optional<int> for_audio; @@ -161,11 +160,13 @@ KDMDialog::make_clicked () /* Forensic mark up to this channel; disabled on channels greater than this */ for_audio = _output->forensic_mark_audio_up_to(); } - screen_kdms = film->make_kdms ( - _screens->screens(), _cpl->cpl(), _timing->from(), _timing->until(), _output->formulation(), - !_output->forensic_mark_video(), for_audio - ); + BOOST_FOREACH (shared_ptr<dcpomatic::Screen> i, _screens->screens()) { + KDMWithMetadataPtr p = kdm_for_screen (film, _cpl->cpl(), i, _timing->from(), _timing->until(), _output->formulation(), !_output->forensic_mark_video(), for_audio); + if (p) { + kdms.push_back (p); + } + } } catch (dcp::BadKDMDateError& e) { if (e.starts_too_early()) { error_dialog (this, _("The KDM start period is before (or close to) the start of the signing certificate's validity period. Use a later start time for this KDM.")); @@ -178,7 +179,7 @@ KDMDialog::make_clicked () return; } - pair<shared_ptr<Job>, int> result = _output->make (screen_kdms, film->name(), _timing, bind (&KDMDialog::confirm_overwrite, this, _1)); + pair<shared_ptr<Job>, int> result = _output->make (kdms, film->name(), bind (&KDMDialog::confirm_overwrite, this, _1)); if (result.first) { JobManager::instance()->add (result.first); } diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc index d76a27359..a345d0e96 100644 --- a/src/wx/kdm_output_panel.cc +++ b/src/wx/kdm_output_panel.cc @@ -20,7 +20,6 @@ #include "lib/config.h" #include "lib/cinema.h" -#include "lib/cinema_kdms.h" #include "lib/send_kdm_email_job.h" #include "kdm_output_panel.h" #include "kdm_timing_panel.h" @@ -54,6 +53,7 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop) , _forensic_mark_audio_up_to (12) { wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, 0); + table->AddGrowableCol (1); add_label_to_sizer (table, this, _("KDM type"), true); @@ -183,10 +183,10 @@ KDMOutputPanel::kdm_write_type_changed () pair<shared_ptr<Job>, int> KDMOutputPanel::make ( - list<shared_ptr<ScreenKDM> > screen_kdms, string name, KDMTimingPanel* timing, function<bool (boost::filesystem::path)> confirm_overwrite + list<KDMWithMetadataPtr> kdms, string name, function<bool (boost::filesystem::path)> confirm_overwrite ) { - list<CinemaKDMs> const cinema_kdms = CinemaKDMs::collect (screen_kdms); + list<list<KDMWithMetadataPtr> > const cinema_kdms = collect (kdms); /* Decide whether to proceed */ @@ -200,8 +200,8 @@ KDMOutputPanel::make ( } bool cinemas_with_no_email = false; - BOOST_FOREACH (CinemaKDMs i, cinema_kdms) { - if (i.cinema->emails.empty ()) { + BOOST_FOREACH (list<KDMWithMetadataPtr> i, cinema_kdms) { + if (i.front()->emails().empty()) { cinemas_with_no_email = true; } } @@ -215,8 +215,8 @@ KDMOutputPanel::make ( if (proceed && Config::instance()->confirm_kdm_email ()) { list<string> emails; - BOOST_FOREACH (CinemaKDMs i, cinema_kdms) { - BOOST_FOREACH (string j, i.cinema->emails) { + BOOST_FOREACH (list<KDMWithMetadataPtr> const& i, cinema_kdms) { + BOOST_FOREACH (string j, i.front()->emails()) { emails.push_back (j); } } @@ -240,36 +240,29 @@ KDMOutputPanel::make ( shared_ptr<Job> job; 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(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()) { - written = ScreenKDM::write_files ( - screen_kdms, + written = write_files ( + kdms, directory(), _filename_format->get(), - name_values, confirm_overwrite ); } else if (_write_folder->GetValue()) { - written = CinemaKDMs::write_directories ( - CinemaKDMs::collect (screen_kdms), + written = write_directories ( + collect (kdms), directory(), _container_name_format->get(), _filename_format->get(), - name_values, confirm_overwrite ); } else if (_write_zip->GetValue()) { - written = CinemaKDMs::write_zip_files ( - CinemaKDMs::collect (screen_kdms), + written = write_zip_files ( + collect (kdms), directory(), _container_name_format->get(), _filename_format->get(), - name_values, confirm_overwrite ); } @@ -281,7 +274,6 @@ KDMOutputPanel::make ( cinema_kdms, _container_name_format->get(), _filename_format->get(), - name_values, name ) ); diff --git a/src/wx/kdm_output_panel.h b/src/wx/kdm_output_panel.h index 7b9315071..0281b26d0 100644 --- a/src/wx/kdm_output_panel.h +++ b/src/wx/kdm_output_panel.h @@ -18,7 +18,7 @@ */ -#include "lib/screen_kdm.h" +#include "lib/kdm_with_metadata.h" #include "wx_util.h" #include "name_format_editor.h" #include <dcp/types.h> @@ -52,9 +52,8 @@ public: } std::pair<boost::shared_ptr<Job>, int> make ( - std::list<boost::shared_ptr<ScreenKDM> > screen_kdms, + std::list<KDMWithMetadataPtr > screen_kdms, std::string name, - KDMTimingPanel* timing, boost::function<bool (boost::filesystem::path)> confirm_overwrite ); diff --git a/src/wx/recreate_chain_dialog.cc b/src/wx/recreate_chain_dialog.cc index e477cdc1f..ae6afdd08 100644 --- a/src/wx/recreate_chain_dialog.cc +++ b/src/wx/recreate_chain_dialog.cc @@ -23,7 +23,6 @@ #include "static_text.h" #include "check_box.h" #include "lib/config.h" -#include "lib/cinema_kdms.h" #include <boost/foreach.hpp> using std::list; diff --git a/src/wx/wscript b/src/wx/wscript index f78a8c617..22d9f0db6 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -52,12 +52,14 @@ sources = """ dcp_panel.cc dcpomatic_button.cc disk_warning_dialog.cc + dkdm_output_panel.cc drive_wipe_warning_dialog.cc email_dialog.cc image_sequence_dialog.cc isdcf_metadata_dialog.cc dcp_text_track_dialog.cc dir_picker_ctrl.cc + dkdm_dialog.cc dolby_doremi_certificate_panel.cc download_certificate_dialog.cc download_certificate_panel.cc @@ -110,6 +112,8 @@ sources = """ question_dialog.cc rating_dialog.cc qube_certificate_panel.cc + recipients_panel.cc + recipient_dialog.cc recreate_chain_dialog.cc repeat_dialog.cc report_problem_dialog.cc diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 28f79431a..6eef0d147 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -530,3 +530,40 @@ display_progress (wxString title, wxString task) return ok; } + + +int +get_offsets (vector<Offset>& offsets) +{ + offsets.push_back (Offset(_("UTC-11"), -11, 0)); + offsets.push_back (Offset(_("UTC-10"), -10, 0)); + offsets.push_back (Offset(_("UTC-9"), -9, 0)); + offsets.push_back (Offset(_("UTC-8"), -8, 0)); + offsets.push_back (Offset(_("UTC-7"), -7, 0)); + offsets.push_back (Offset(_("UTC-6"), -6, 0)); + offsets.push_back (Offset(_("UTC-5"), -5, 0)); + offsets.push_back (Offset(_("UTC-4:30"), -4, 30)); + offsets.push_back (Offset(_("UTC-4"), -4, 0)); + offsets.push_back (Offset(_("UTC-3:30"), -3, 30)); + offsets.push_back (Offset(_("UTC-3"), -3, 0)); + offsets.push_back (Offset(_("UTC-2"), -2, 0)); + offsets.push_back (Offset(_("UTC-1"), -1, 0)); + int utc = offsets.size(); + offsets.push_back (Offset(_("UTC") , 0, 0)); + offsets.push_back (Offset(_("UTC+1"), 1, 0)); + offsets.push_back (Offset(_("UTC+2"), 2, 0)); + offsets.push_back (Offset(_("UTC+3"), 3, 0)); + offsets.push_back (Offset(_("UTC+4"), 4, 0)); + offsets.push_back (Offset(_("UTC+5"), 5, 0)); + offsets.push_back (Offset(_("UTC+5:30"), 5, 30)); + offsets.push_back (Offset(_("UTC+6"), 6, 0)); + offsets.push_back (Offset(_("UTC+7"), 7, 0)); + offsets.push_back (Offset(_("UTC+8"), 8, 0)); + offsets.push_back (Offset(_("UTC+9"), 9, 0)); + offsets.push_back (Offset(_("UTC+9:30"), 9, 30)); + offsets.push_back (Offset(_("UTC+10"), 10, 0)); + offsets.push_back (Offset(_("UTC+11"), 11, 0)); + offsets.push_back (Offset(_("UTC+12"), 12, 0)); + + return utc; +} diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index af25ce0f5..8e0befba9 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -88,6 +88,23 @@ extern double calculate_mark_interval (double start); extern bool display_progress (wxString title, wxString task); extern bool report_errors_from_last_job (wxWindow* parent); + +struct Offset +{ + Offset (wxString n, int h, int m) + : name (n) + , hour (h) + , minute (m) + {} + + wxString name; + int hour; + int minute; +}; + +extern int get_offsets (std::vector<Offset>& offsets); + + extern void checked_set (FilePickerCtrl* widget, boost::filesystem::path value); extern void checked_set (wxDirPickerCtrl* widget, boost::filesystem::path value); extern void checked_set (wxSpinCtrl* widget, int value); |
