summaryrefslogtreecommitdiff
path: root/src/wx/screens_panel.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-04-24 01:49:09 +0200
committerCarl Hetherington <cth@carlh.net>2024-04-24 19:12:36 +0200
commit401da185ca664fc8d819fc842ffc08e14d4f6486 (patch)
tree5c2ea2d1a7b1b537c04e7e9b3d32c8a44080f168 /src/wx/screens_panel.cc
parentdbcd1675732d59f6337f7f60d0a39aaa6a1aa3a6 (diff)
Restore time zone to Cinema and improve UI to use it (#2473).
Diffstat (limited to 'src/wx/screens_panel.cc')
-rw-r--r--src/wx/screens_panel.cc26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/wx/screens_panel.cc b/src/wx/screens_panel.cc
index 52545e5f6..768d25092 100644
--- a/src/wx/screens_panel.cc
+++ b/src/wx/screens_panel.cc
@@ -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;
+}
+