X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Freport_problem_dialog.cc;h=52c1e70bed2ae63c3124a17fdef366b9b175da38;hb=b9a1ad3df5f9d85fb7439efd93fede72b9b078af;hp=c79c542ed5861d880010d9bbb54e8d1da0c14538;hpb=9c1bb2e5ca7c80c4e26b1b2e41159aa171360a94;p=dcpomatic.git diff --git a/src/wx/report_problem_dialog.cc b/src/wx/report_problem_dialog.cc index c79c542ed..52c1e70be 100644 --- a/src/wx/report_problem_dialog.cc +++ b/src/wx/report_problem_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2018 Carl Hetherington + Copyright (C) 2014-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,17 +18,24 @@ */ + +#include "check_box.h" #include "report_problem_dialog.h" -#include "wx_util.h" #include "static_text.h" -#include "check_box.h" +#include "wx_util.h" #include "lib/config.h" #include "lib/job_manager.h" #include "lib/send_problem_report_job.h" +#include "lib/warnings.h" +DCPOMATIC_DISABLE_WARNINGS #include +DCPOMATIC_ENABLE_WARNINGS + +using std::make_shared; using std::string; -using boost::shared_ptr; +using std::shared_ptr; + /** @param parent Parent window. * @param film Film that we are working on, or 0. @@ -45,21 +52,21 @@ ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr fil _overall_sizer->Add (_table, 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()); } - wxString t = _("My problem is"); + auto t = _("My problem is"); int flags = wxALIGN_TOP | wxLEFT | wxRIGHT; #ifdef __WXOSX__ flags |= wxALIGN_RIGHT; t += wxT (":"); #endif - wxStaticText* m = new StaticText (this, t); + auto m = new StaticText (this, t); _table->Add (m, 1, flags, 6); - _summary = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxSize (320, 240), wxTE_MULTILINE); + _summary = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(320, 240), wxTE_MULTILINE); _table->Add (_summary, 1, wxEXPAND | wxALIGN_TOP); _send_logs = new CheckBox (this, _("Send logs")); @@ -67,7 +74,7 @@ ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr fil _table->Add (_send_logs, 1, wxEXPAND); _table->AddSpacer (0); - add_label_to_sizer (_table, this, _("Your email address"), true); + add_label_to_sizer (_table, this, _("Your email address"), true, 0, wxALIGN_CENTRE_VERTICAL); _email = new wxTextCtrl (this, wxID_ANY, wxT ("")); _email->SetValue (std_to_wx (Config::instance()->kdm_from ())); _table->Add (_email, 1, wxEXPAND); @@ -90,27 +97,31 @@ ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr fil } } - wxStaticText* n = new StaticText (this, wxT ("")); + auto n = new StaticText (this, wxT("")); n->SetLabelMarkup (out); _table->AddSpacer (0); _table->Add (n, 1, wxEXPAND); _overall_sizer->Layout (); _overall_sizer->SetSizeHints (this); + + _summary->SetFocus (); } + void ReportProblemDialog::report () { - if (_email->GetValue().IsEmpty ()) { + if (_email->GetValue().IsEmpty()) { error_dialog (this, _("Please enter an email address so that we can contact you with any queries about the problem.")); return; } if (_email->GetValue() == "carl@dcpomatic.com" || _email->GetValue() == "cth@carlh.net") { - error_dialog (this, wxString::Format (_("Enter your email address for the contact, not %s"), _email->GetValue().data())); + error_dialog (this, wxString::Format(_("Enter your email address for the contact, not %s"), _email->GetValue().data())); return; } - JobManager::instance()->add (shared_ptr (new SendProblemReportJob (_film, wx_to_std (_email->GetValue ()), wx_to_std (_summary->GetValue ())))); + JobManager::instance()->add (make_shared(_film, wx_to_std(_email->GetValue()), wx_to_std(_summary->GetValue()))); } +