2 Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "cinema_dialog.h"
22 #include "lib/dcpomatic_assert.h"
23 #include <boost/foreach.hpp>
28 using std::back_inserter;
39 CinemaDialog::CinemaDialog (wxWindow* parent, string title, string name, list<string> emails, int utc_offset)
40 : wxDialog (parent, wxID_ANY, std_to_wx (title))
42 wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
43 SetSizer (overall_sizer);
45 wxGridBagSizer* sizer = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
48 add_label_to_sizer (sizer, this, _("Name"), true, wxGBPosition (r, 0));
49 _name = new wxTextCtrl (this, wxID_ANY, std_to_wx (name), wxDefaultPosition, wxSize (500, -1));
50 sizer->Add (_name, wxGBPosition (r, 1));
53 add_label_to_sizer (sizer, this, _("UTC offset (time zone)"), true, wxGBPosition (r, 0));
54 _utc_offset = new wxChoice (this, wxID_ANY);
55 sizer->Add (_utc_offset, wxGBPosition (r, 1));
58 add_label_to_sizer (sizer, this, _("Email addresses for KDM delivery"), false, wxGBPosition (r, 0), wxGBSpan (1, 2));
61 copy (emails.begin(), emails.end(), back_inserter (_emails));
63 vector<string> columns;
64 columns.push_back (wx_to_std (_("Address")));
65 _email_list = new EditableList<string, EmailDialog> (
66 this, columns, bind (&CinemaDialog::get_emails, this), bind (&CinemaDialog::set_emails, this, _1), bind (&column, _1)
69 sizer->Add (_email_list, wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND);
72 overall_sizer->Add (sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
74 wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
76 overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
79 for (int i = -11; i <= -1; ++i) {
80 _utc_offset->Append (wxString::Format (_("UTC%d"), i));
82 _utc_offset->Append (_("UTC"));
83 for (int i = 1; i <= 12; ++i) {
84 _utc_offset->Append (wxString::Format (_("UTC+%d"), i));
87 _utc_offset->SetSelection (utc_offset + 11);
89 overall_sizer->Layout ();
90 overall_sizer->SetSizeHints (this);
94 CinemaDialog::name () const
96 return wx_to_std (_name->GetValue());
100 CinemaDialog::set_emails (vector<string> e)
106 CinemaDialog::get_emails () const
112 CinemaDialog::emails () const
115 copy (_emails.begin(), _emails.end(), back_inserter (e));
120 CinemaDialog::utc_offset () const
122 return _utc_offset->GetSelection() - 11;