Restore time zone to Cinema and improve UI to use it (#2473).
authorCarl Hetherington <cth@carlh.net>
Tue, 23 Apr 2024 23:49:09 +0000 (01:49 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 24 Apr 2024 17:12:36 +0000 (19:12 +0200)
17 files changed:
src/lib/cinema.cc
src/lib/cinema.h
src/lib/kdm_cli.cc
src/tools/dcpomatic_kdm.cc
src/wx/cinema_dialog.cc
src/wx/cinema_dialog.h
src/wx/kdm_dialog.cc
src/wx/kdm_dialog.h
src/wx/kdm_timing_panel.cc
src/wx/kdm_timing_panel.h
src/wx/screens_panel.cc
src/wx/screens_panel.h
src/wx/wx_util.cc
src/wx/wx_util.h
test/config_test.cc
test/kdm_cli_test.cc
test/kdm_naming_test.cc

index 6bd06373344232cdfdde749d9a6d771fbe36c165..b1681fc2833af14cda3c5a9251f9cb38ff6a3d73 100644 (file)
@@ -41,6 +41,18 @@ Cinema::Cinema (cxml::ConstNodePtr node)
        for (auto i: node->node_children("Email")) {
                emails.push_back (i->content ());
        }
+
+       int hour = 0;
+
+       if (node->optional_number_child<int>("UTCOffset")) {
+               hour = node->number_child<int>("UTCOffset");
+       } else {
+               hour = node->optional_number_child<int>("UTCOffsetHour").get_value_or(0);
+       }
+
+       int minute = node->optional_number_child<int>("UTCOffsetMinute").get_value_or(0);
+
+       utc_offset= { hour, minute };
 }
 
 /* This is necessary so that we can use shared_from_this in add_screen (which cannot be done from
@@ -65,6 +77,9 @@ Cinema::as_xml (xmlpp::Element* parent) const
 
        cxml::add_text_child(parent, "Notes", notes);
 
+       cxml::add_text_child(parent, "UTCOffsetHour", raw_convert<string>(utc_offset.hour()));
+       cxml::add_text_child(parent, "UTCOffsetMinute", raw_convert<string>(utc_offset.minute()));
+
        for (auto i: _screens) {
                i->as_xml(cxml::add_child(parent, "Screen"));
        }
index 7008659d755f4da6938ad50e6d6fe9976ebd2e4c..05f6fb7fce0d0652a958e8e11df121d70a40d7d4 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 
+#include <dcp/utc_offset.h>
 #include <libcxml/cxml.h>
 #include <memory>
 
@@ -44,10 +45,11 @@ namespace dcpomatic {
 class Cinema : public std::enable_shared_from_this<Cinema>
 {
 public:
-       Cinema(std::string const & name_, std::vector<std::string> const & e, std::string notes_)
+       Cinema(std::string const & name_, std::vector<std::string> const & e, std::string notes_, dcp::UTCOffset utc_offset_)
                : name (name_)
                , emails (e)
                , notes (notes_)
+               , utc_offset(std::move(utc_offset_))
        {}
 
        explicit Cinema (cxml::ConstNodePtr);
@@ -62,6 +64,7 @@ public:
        std::string name;
        std::vector<std::string> emails;
        std::string notes;
+       dcp::UTCOffset utc_offset;
 
        std::vector<std::shared_ptr<dcpomatic::Screen>> screens() const {
                return _screens;
index c442cacdc6ae6b818053822856044f179a2bec8e..21e8c75d31c0e6cdd8b8b1890ab182b3bde7357a 100644 (file)
@@ -567,7 +567,7 @@ try
                           (for lookup) and by creating a Cinema which the next Screen will be added to.
                        */
                        cinema_name = optarg;
-                       cinema = make_shared<Cinema>(optarg, vector<string>(), "");
+                       cinema = make_shared<Cinema>(optarg, vector<string>(), "", dcp::UTCOffset());
                        break;
                case 'S':
                        /* Similarly, this could be the name of a new (temporary) screen or the name of a screen
index 1eda05162780a918de9b2613f4e2f2dd0632d0f3..7838e145d71e81396d6cd577f5e6a5308d8330b0 100644 (file)
@@ -237,7 +237,7 @@ public:
                /* Instantly save any config changes when using a DCP-o-matic GUI */
                Config::instance()->Changed.connect (boost::bind (&Config::write, Config::instance ()));
 
-               _screens->ScreensChanged.connect (boost::bind (&DOMFrame::setup_sensitivity, this));
+               _screens->ScreensChanged.connect(boost::bind(&DOMFrame::screens_changed, this));
                _create->Bind (wxEVT_BUTTON, bind (&DOMFrame::create_kdms, this));
                _dkdm->Bind(wxEVT_TREE_SEL_CHANGED, boost::bind(&DOMFrame::dkdm_selection_changed, this));
                _dkdm->Bind (wxEVT_TREE_BEGIN_DRAG, boost::bind (&DOMFrame::dkdm_begin_drag, this, _1));
@@ -797,6 +797,12 @@ private:
                update_dkdm_view();
        }
 
+       void screens_changed()
+       {
+               _timing->suggest_utc_offset(_screens->best_utc_offset());
+               setup_sensitivity();
+       }
+
        wxPreferencesEditor* _config_dialog;
        ScreensPanel* _screens;
        KDMTimingPanel* _timing;
index 771a59892b491715ef805fb64317550be42c93b8..3b8265e6fa48fbefd19e35f0138f874809f90249 100644 (file)
@@ -20,6 +20,7 @@
 
 
 #include "cinema_dialog.h"
+#include "dcpomatic_choice.h"
 #include "wx_util.h"
 #include "lib/dcpomatic_assert.h"
 #include "lib/util.h"
@@ -36,7 +37,7 @@ using namespace boost::placeholders;
 #endif
 
 
-CinemaDialog::CinemaDialog(wxWindow* parent, wxString title, string name, vector<string> emails, string notes)
+CinemaDialog::CinemaDialog(wxWindow* parent, wxString title, string name, vector<string> emails, string notes, dcp::UTCOffset utc_offset)
        : wxDialog (parent, wxID_ANY, title)
 {
        auto overall_sizer = new wxBoxSizer (wxVERTICAL);
@@ -50,6 +51,11 @@ CinemaDialog::CinemaDialog(wxWindow* parent, wxString title, string name, vector
        sizer->Add (_name, wxGBPosition(r, 1));
        ++r;
 
+       add_label_to_sizer(sizer, this, _("UTC offset (time zone)"), true, wxGBPosition(r, 0));
+       _utc_offset = new Choice(this);
+       sizer->Add(_utc_offset, wxGBPosition(r, 1));
+       ++r;
+
        add_label_to_sizer (sizer, this, _("Notes"), true, wxGBPosition(r, 0));
        _notes = new wxTextCtrl (this, wxID_ANY, std_to_wx(notes), wxDefaultPosition, wxSize(500, -1));
        sizer->Add (_notes, wxGBPosition(r, 1));
@@ -78,6 +84,17 @@ CinemaDialog::CinemaDialog(wxWindow* parent, wxString title, string name, vector
                overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
 
+       /* Default to UTC */
+       size_t sel = get_offsets(_offsets);
+       for (size_t i = 0; i < _offsets.size(); ++i) {
+               _utc_offset->add_entry(_offsets[i].name);
+               if (_offsets[i].offset == utc_offset) {
+                       sel = i;
+               }
+       }
+
+       _utc_offset->set(sel);
+
        overall_sizer->Layout ();
        overall_sizer->SetSizeHints (this);
 
@@ -111,3 +128,15 @@ CinemaDialog::notes () const
 {
        return wx_to_std (_notes->GetValue());
 }
+
+
+dcp::UTCOffset
+CinemaDialog::utc_offset() const
+{
+       auto const sel = _utc_offset->GetSelection();
+       if (sel < 0 || sel > int(_offsets.size())) {
+               return {};
+       }
+
+       return _offsets[sel].offset;
+}
index cd90f6dea9ee1e9bf2569f89af8e8b4eeadc557a..8736577722b1ca826cff41c53cdb0193ae41c81e 100644 (file)
@@ -30,6 +30,9 @@ LIBDCP_ENABLE_WARNINGS
 #include <vector>
 
 
+class Choice;
+
+
 class CinemaDialog : public wxDialog
 {
 public:
@@ -38,12 +41,14 @@ public:
                wxString,
                std::string name = "",
                std::vector<std::string> emails = std::vector<std::string>(),
-               std::string notes = ""
+               std::string notes = "",
+               dcp::UTCOffset = {}
                );
 
        std::string name () const;
        std::string notes () const;
        std::vector<std::string> emails () const;
+       dcp::UTCOffset utc_offset() const;
 
 private:
        void set_emails (std::vector<std::string>);
@@ -52,4 +57,6 @@ private:
        wxTextCtrl* _notes;
        EditableList<std::string, EmailDialog>* _email_list;
        std::vector<std::string> _emails;
+       Choice* _utc_offset;
+       std::vector<Offset> _offsets;
 };
index e9d186264807e84a444126974a693affa60f20fd..e6f4eca5ea5c60f6b7f85e699550c020ef0d1a14 100644 (file)
@@ -126,7 +126,7 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr<const Film> film)
 
        /* Bind */
 
-       _screens->ScreensChanged.connect (boost::bind (&KDMDialog::setup_sensitivity, this));
+       _screens->ScreensChanged.connect(boost::bind(&KDMDialog::screens_changed, this));
        _timing->TimingChanged.connect (boost::bind (&KDMDialog::setup_sensitivity, this));
        _make->Bind (wxEVT_BUTTON, boost::bind (&KDMDialog::make_clicked, this));
        _cpl->Changed.connect(boost::bind(&KDMDialog::cpl_changed, this));
@@ -140,6 +140,14 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr<const Film> film)
 }
 
 
+void
+KDMDialog::screens_changed()
+{
+       _timing->suggest_utc_offset(_screens->best_utc_offset());
+       setup_sensitivity();
+}
+
+
 void
 KDMDialog::cpl_changed()
 {
index c1e9588fe66b6b36d85bb9ac8967295e47333942..ec92db616601550239c32aace0588852b987035e 100644 (file)
@@ -52,6 +52,7 @@ private:
        void make_clicked ();
        bool confirm_overwrite (boost::filesystem::path path);
        void cpl_changed();
+       void screens_changed();
 
        std::weak_ptr<const Film> _film;
        ScreensPanel* _screens;
index 6e362a3b2c5d19ac6e49314601925bb4703faa4b..c892c9d489730eaaf7ead024af6b5e6062a51b02 100644 (file)
@@ -122,14 +122,10 @@ KDMTimingPanel::KDMTimingPanel (wxWindow* parent)
        _warning->SetFont(font);
 
        /* Default to UTC */
-       size_t sel = get_offsets(_offsets);
-       for (size_t i = 0; i < _offsets.size(); ++i) {
-               _utc_offset->add_entry(_offsets[i].name);
-               if (_offsets[i].hour == 0 && _offsets[i].minute == 0) {
-                       sel = i;
-               }
+       auto const sel = get_offsets(_offsets);
+       for (auto const& offset: _offsets) {
+               _utc_offset->add_entry(offset.name);
        }
-
        _utc_offset->set(sel);
 
        /* I said I've been to the year 3000.  Not much has changed but they live underwater.  And your In-in-in-interop DCP
@@ -142,7 +138,7 @@ KDMTimingPanel::KDMTimingPanel (wxWindow* parent)
        _until_date->Bind (wxEVT_DATE_CHANGED, bind (&KDMTimingPanel::changed, this));
        _from_time->Changed.connect (bind (&KDMTimingPanel::changed, this));
        _until_time->Changed.connect (bind (&KDMTimingPanel::changed, this));
-       _utc_offset->bind(&KDMTimingPanel::changed, this);
+       _utc_offset->bind(&KDMTimingPanel::utc_offset_changed, this);
 
        SetSizer (overall_sizer);
 }
@@ -205,10 +201,28 @@ KDMTimingPanel::utc_offset() const
                return {};
        }
 
-       auto const& offset = _offsets[*sel];
-       int const minute_scale = offset.hour < 0 ? -1 : 1;
+       return _offsets[*sel].offset;
+}
+
 
-       return { offset.hour, minute_scale * offset.minute };
+void
+KDMTimingPanel::utc_offset_changed()
+{
+       _utc_offset_changed_once = true;
+       changed();
 }
 
 
+void
+KDMTimingPanel::suggest_utc_offset(dcp::UTCOffset offset)
+{
+       if (!_utc_offset_changed_once) {
+               for (size_t i = 0; i < _offsets.size(); ++i) {
+                       if (_offsets[i].offset == offset) {
+                               _utc_offset->set(i);
+                               break;
+                       }
+               }
+       }
+}
+
index f847992a7088155c3fd9d21e07185c9cb558efee..a6199534a1afed75795aec6cb119c293b26ad447 100644 (file)
@@ -44,10 +44,16 @@ public:
 
        bool valid () const;
 
+       /** Give a UTC offset from a cinema that the user just selected.  If the user
+        *  never changed the UTC offset in the panel, the suggested UTC will be set.
+        */
+       void suggest_utc_offset(dcp::UTCOffset offset);
+
        boost::signals2::signal<void ()> TimingChanged;
 
 private:
        void changed () const;
+       void utc_offset_changed();
        dcp::UTCOffset utc_offset() const;
 
        static dcp::LocalTime local_time(wxDatePickerCtrl *, TimePicker *, dcp::UTCOffset offset);
@@ -57,6 +63,7 @@ private:
        TimePicker* _from_time;
        TimePicker* _until_time;
        Choice* _utc_offset;
+       bool _utc_offset_changed_once = false;
        wxStaticText* _warning;
        std::vector<Offset> _offsets;
 };
index 52545e5f6cd0734a93ae2e7745812ce84449d865..768d250923f7d302973981da9f53a1453d3013d3 100644 (file)
@@ -253,7 +253,7 @@ ScreensPanel::add_cinema_clicked ()
        CinemaDialog dialog(GetParent(), _("Add Cinema"));
 
        if (dialog.ShowModal() == wxID_OK) {
-               auto cinema = make_shared<Cinema>(dialog.name(), dialog.emails(), dialog.notes());
+               auto cinema = make_shared<Cinema>(dialog.name(), dialog.emails(), dialog.notes(), dialog.utc_offset());
 
                auto cinemas = sorted_cinemas();
 
@@ -328,12 +328,13 @@ ScreensPanel::edit_cinema_clicked ()
 void
 ScreensPanel::edit_cinema(shared_ptr<Cinema> cinema)
 {
-       CinemaDialog dialog(GetParent(), _("Edit cinema"), cinema->name, cinema->emails, cinema->notes);
+       CinemaDialog dialog(GetParent(), _("Edit cinema"), cinema->name, cinema->emails, cinema->notes, cinema->utc_offset);
 
        if (dialog.ShowModal() == wxID_OK) {
                cinema->name = dialog.name();
                cinema->emails = dialog.emails();
                cinema->notes = dialog.notes();
+               cinema->utc_offset = dialog.utc_offset();
                notify_cinemas_changed();
                auto item = cinema_to_item(cinema);
                DCPOMATIC_ASSERT(item);
@@ -778,3 +779,24 @@ ScreensPanel::setup_show_only_checked()
        setup_sensitivity();
 }
 
+
+dcp::UTCOffset
+ScreensPanel::best_utc_offset() const
+{
+       auto all_screens = screens();
+       if (all_screens.empty()) {
+               return {};
+       }
+
+       dcp::UTCOffset const first = all_screens[0]->cinema->utc_offset;
+
+       for (auto screen = std::next(all_screens.begin()); screen != all_screens.end(); ++screen) {
+               if ((*screen)->cinema->utc_offset != first) {
+                       /* Not unique */
+                       return dcp::UTCOffset();
+               }
+       }
+
+       return first;
+}
+
index 80a7b38433ba8a32514a3a47a011198859fab975..1e07b62360d2d5645a912220c1e690b134d6cfad 100644 (file)
@@ -51,6 +51,8 @@ public:
        std::vector<std::shared_ptr<dcpomatic::Screen>> screens () const;
        void setup_sensitivity ();
 
+       dcp::UTCOffset best_utc_offset() const;
+
        boost::signals2::signal<void ()> ScreensChanged;
 
 private:
index baf5990aa00ce2b851728880a8a75f30b69d5f94..e85b74cc81468ad23c57e1bba28a1f513bc56d7a 100644 (file)
@@ -690,35 +690,35 @@ display_progress (wxString title, wxString task)
 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));
+       offsets.push_back({_("UTC-11"),  dcp::UTCOffset(-11,   0)});
+       offsets.push_back({_("UTC-10"),  dcp::UTCOffset(-10,   0)});
+       offsets.push_back({_("UTC-9"),   dcp::UTCOffset( -9,   0)});
+       offsets.push_back({_("UTC-8"),   dcp::UTCOffset( -8,   0)});
+       offsets.push_back({_("UTC-7"),   dcp::UTCOffset( -7,   0)});
+       offsets.push_back({_("UTC-6"),   dcp::UTCOffset( -6,   0)});
+       offsets.push_back({_("UTC-5"),   dcp::UTCOffset( -5,   0)});
+       offsets.push_back({_("UTC-4:30"),dcp::UTCOffset( -4, -30)});
+       offsets.push_back({_("UTC-4"),   dcp::UTCOffset( -4,   0)});
+       offsets.push_back({_("UTC-3:30"),dcp::UTCOffset( -3, -30)});
+       offsets.push_back({_("UTC-3"),   dcp::UTCOffset( -3,   0)});
+       offsets.push_back({_("UTC-2"),   dcp::UTCOffset( -2,   0)});
+       offsets.push_back({_("UTC-1"),   dcp::UTCOffset( -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));
+       offsets.push_back({_("UTC")  ,   dcp::UTCOffset(  0,   0)});
+       offsets.push_back({_("UTC+1"),   dcp::UTCOffset(  1,   0)});
+       offsets.push_back({_("UTC+2"),   dcp::UTCOffset(  2,   0)});
+       offsets.push_back({_("UTC+3"),   dcp::UTCOffset(  3,   0)});
+       offsets.push_back({_("UTC+4"),   dcp::UTCOffset(  4,   0)});
+       offsets.push_back({_("UTC+5"),   dcp::UTCOffset(  5,   0)});
+       offsets.push_back({_("UTC+5:30"),dcp::UTCOffset(  5,  30)});
+       offsets.push_back({_("UTC+6"),   dcp::UTCOffset(  6,   0)});
+       offsets.push_back({_("UTC+7"),   dcp::UTCOffset(  7,   0)});
+       offsets.push_back({_("UTC+8"),   dcp::UTCOffset(  8,   0)});
+       offsets.push_back({_("UTC+9"),   dcp::UTCOffset(  9,   0)});
+       offsets.push_back({_("UTC+9:30"),dcp::UTCOffset(  9,  30)});
+       offsets.push_back({_("UTC+10"),  dcp::UTCOffset( 10,   0)});
+       offsets.push_back({_("UTC+11"),  dcp::UTCOffset( 11,   0)});
+       offsets.push_back({_("UTC+12"),  dcp::UTCOffset( 12,   0)});
 
        return utc;
 }
index d8935daa195d1523f70a3f98ae6c3b49d6dd9fa7..89e3fe5a592083580fac087f2a1696c5a1c98b6f 100644 (file)
@@ -31,6 +31,7 @@
 #include "wx_ptr.h"
 #include "lib/config.h"
 #include "lib/dcpomatic_time.h"
+#include <dcp/utc_offset.h>
 #include <dcp/warnings.h>
 LIBDCP_DISABLE_WARNINGS
 #include <wx/gbsizer.h>
@@ -131,17 +132,16 @@ extern double dpi_scale_factor (wxWindow* window);
 extern int search_ctrl_height ();
 extern void report_config_load_failure(wxWindow* parent, Config::LoadFailure what);
 
+
 struct Offset
 {
-       Offset (wxString n, int h, int m)
-               : name (n)
-               , hour (h)
-               , minute (m)
+       Offset(wxString name_, dcp::UTCOffset offset_)
+               : name(name_)
+               , offset(offset_)
        {}
 
        wxString name;
-       int hour;
-       int minute;
+       dcp::UTCOffset offset;
 };
 
 extern int get_offsets (std::vector<Offset>& offsets);
index 00adb7b09fc781e80106f8657aca126c3f55a5a9..d50c3d6f34dfee98b1fce2d57caf039ac92af9b9 100644 (file)
@@ -246,7 +246,7 @@ BOOST_AUTO_TEST_CASE (config_keep_cinemas_if_making_new_config)
 
        Config::instance()->write();
 
-       Config::instance()->add_cinema(make_shared<Cinema>("My Great Cinema", vector<string>(), ""));
+       Config::instance()->add_cinema(make_shared<Cinema>("My Great Cinema", vector<string>(), "", dcp::UTCOffset()));
        Config::instance()->write();
 
        boost::filesystem::copy_file (dir / "cinemas.xml", dir / "backup_for_test.xml");
index 2a508d97c2461a2b6cda713e47a4f3f921122c69..1c590cdf717e910560e20b78f20228415f3d104d 100644 (file)
@@ -154,13 +154,13 @@ setup_test_config()
        auto config = Config::instance();
        auto const cert = dcp::Certificate(dcp::file_to_string("test/data/cert.pem"));
 
-       auto cinema_a = std::make_shared<Cinema>("Dean's Screens", vector<string>(), "");
+       auto cinema_a = std::make_shared<Cinema>("Dean's Screens", vector<string>(), "", dcp::UTCOffset());
        cinema_a->add_screen(std::make_shared<dcpomatic::Screen>("Screen 1", "", cert, boost::none, std::vector<TrustedDevice>()));
        cinema_a->add_screen(std::make_shared<dcpomatic::Screen>("Screen 2", "", cert, boost::none, std::vector<TrustedDevice>()));
        cinema_a->add_screen(std::make_shared<dcpomatic::Screen>("Screen 3", "", cert, boost::none, std::vector<TrustedDevice>()));
        config->add_cinema(cinema_a);
 
-       auto cinema_b = std::make_shared<Cinema>("Floyd's Celluloid", vector<string>(), "");
+       auto cinema_b = std::make_shared<Cinema>("Floyd's Celluloid", vector<string>(), "", dcp::UTCOffset());
        cinema_b->add_screen(std::make_shared<dcpomatic::Screen>("Foo", "", cert, boost::none, std::vector<TrustedDevice>()));
        cinema_b->add_screen(std::make_shared<dcpomatic::Screen>("Bar", "", cert, boost::none, std::vector<TrustedDevice>()));
        config->add_cinema(cinema_b);
index 0f44fe2ea570cef51e83cf8b5258008cc3b210cf..f73e4295e445458968e7e83bf1379bc0401015ae 100644 (file)
@@ -59,14 +59,14 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
 
        auto crypt_cert = c->decryption_chain()->leaf();
 
-       auto cinema_a = make_shared<Cinema>("Cinema A", vector<string>(), "");
+       auto cinema_a = make_shared<Cinema>("Cinema A", vector<string>(), "", dcp::UTCOffset{4, 30});
        cinema_a_screen_1 = std::make_shared<dcpomatic::Screen>("Screen 1", "", crypt_cert, boost::none, vector<TrustedDevice>());
        cinema_a->add_screen (cinema_a_screen_1);
        cinema_a_screen_2 = std::make_shared<dcpomatic::Screen>("Screen 2", "", crypt_cert, boost::none, vector<TrustedDevice>());
        cinema_a->add_screen (cinema_a_screen_2);
        c->add_cinema (cinema_a);
 
-       auto cinema_b = make_shared<Cinema>("Cinema B", vector<string>(), "");
+       auto cinema_b = make_shared<Cinema>("Cinema B", vector<string>(), "", dcp::UTCOffset{-1, 0});
        cinema_b_screen_x = std::make_shared<dcpomatic::Screen>("Screen X", "", crypt_cert, boost::none, vector<TrustedDevice>());
        cinema_b->add_screen (cinema_b_screen_x);
        cinema_b_screen_y = std::make_shared<dcpomatic::Screen>("Screen Y", "", crypt_cert, boost::none, vector<TrustedDevice>());
@@ -89,10 +89,8 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test)
        auto sign_cert = c->signer_chain()->leaf();
 
        dcp::LocalTime from = sign_cert.not_before();
-       from.set_offset({ 4, 30 });
        from.add_months (2);
        dcp::LocalTime until = sign_cert.not_after();
-       until.set_offset({ 4, 30 });
        until.add_months (-2);
 
        std::vector<KDMCertificatePeriod> period_checks;