X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Frecipient_dialog.cc;h=b166f265d0f5f1a5543046e1098944515fa4d8ac;hp=94d5e3debc96ffa1c94d5990266185d83d289581;hb=9f125fddff88bf62d36381f9d3f09e5240b033d5;hpb=3e96f929fdf740f414b114c5d9765e22fcc46de6 diff --git a/src/wx/recipient_dialog.cc b/src/wx/recipient_dialog.cc index 94d5e3deb..b166f265d 100644 --- a/src/wx/recipient_dialog.cc +++ b/src/wx/recipient_dialog.cc @@ -18,27 +18,33 @@ */ + +#include "dcpomatic_button.h" +#include "download_certificate_dialog.h" #include "recipient_dialog.h" -#include "wx_util.h" -#include "file_dialog_wrapper.h" #include "static_text.h" -#include "download_certificate_dialog.h" #include "table_dialog.h" -#include "dcpomatic_button.h" +#include "wx_util.h" #include "lib/compose.hpp" #include "lib/util.h" #include #include +#include +LIBDCP_DISABLE_WARNINGS #include #include +LIBDCP_ENABLE_WARNINGS #include -using std::string; + using std::cout; +using std::string; using std::vector; -using std::list; -using boost::optional; using boost::bind; +using boost::optional; +#if BOOST_VERSION >= 106100 +using namespace boost::placeholders; +#endif static string @@ -49,12 +55,12 @@ column (string s) RecipientDialog::RecipientDialog ( - wxWindow* parent, wxString title, string name, string notes, list emails, int utc_offset_hour, int utc_offset_minute, optional recipient + wxWindow* parent, wxString title, string name, string notes, vector emails, int utc_offset_hour, int utc_offset_minute, optional recipient ) : wxDialog (parent, wxID_ANY, title) , _recipient (recipient) { - wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); + auto overall_sizer = new wxBoxSizer (wxVERTICAL); SetSizer (overall_sizer); _sizer = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); @@ -81,23 +87,25 @@ RecipientDialog::RecipientDialog ( copy (emails.begin(), emails.end(), back_inserter (_emails)); vector columns; - columns.push_back (EditableListColumn(wx_to_std(_("Address")))); + columns.push_back (EditableListColumn(_("Address"))); _email_list = new EditableList ( - this, columns, bind(&RecipientDialog::get_emails, this), bind(&RecipientDialog::set_emails, this, _1), bind(&column, _1) + this, columns, bind(&RecipientDialog::get_emails, this), bind(&RecipientDialog::set_emails, this, _1), bind(&column, _1), + EditableListTitle::VISIBLE, + EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE ); _sizer->Add (_email_list, wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND); ++r; wxClientDC dc (this); - wxFont font = _name->GetFont (); + auto font = _name->GetFont (); font.SetFamily (wxFONTFAMILY_TELETYPE); dc.SetFont (font); - wxSize size = dc.GetTextExtent (wxT ("1234567890123456789012345678")); - size.SetHeight (-1); + auto size = dc.GetTextExtent(wxT("1234567890123456789012345678")); + size.SetHeight (-1); add_label_to_sizer (_sizer, this, _("Recipient certificate"), true, wxGBPosition (r, 0)); - wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + auto s = new wxBoxSizer (wxHORIZONTAL); _recipient_thumbprint = new StaticText (this, wxT (""), wxDefaultPosition, size); _recipient_thumbprint->SetFont (font); set_recipient (recipient); @@ -115,7 +123,7 @@ RecipientDialog::RecipientDialog ( overall_sizer->Add (_sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); - wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL); + auto buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL); if (buttons) { overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); } @@ -179,11 +187,10 @@ RecipientDialog::load_recipient (boost::filesystem::path file) void RecipientDialog::get_recipient_from_file () { - wxFileDialog* d = new wxFileDialog (this, _("Select Certificate File")); + auto d = make_wx(this, _("Select Certificate File")); if (d->ShowModal () == wxID_OK) { load_recipient (boost::filesystem::path (wx_to_std (d->GetPath ()))); } - d->Destroy (); setup_sensitivity (); } @@ -192,7 +199,7 @@ RecipientDialog::get_recipient_from_file () void RecipientDialog::setup_sensitivity () { - wxButton* ok = dynamic_cast (FindWindowById (wxID_OK, this)); + auto ok = dynamic_cast (FindWindowById (wxID_OK, this)); if (ok) { ok->Enable (static_cast(_recipient) && !_name->GetValue().IsEmpty()); } @@ -225,12 +232,10 @@ RecipientDialog::set_emails (vector e) } -list +vector RecipientDialog::emails () const { - list e; - copy (_emails.begin(), _emails.end(), back_inserter(e)); - return e; + return _emails; }