std::shared_ptr
[dcpomatic.git] / src / wx / report_problem_dialog.cc
index 68411ee917144f98a5f16879a9a5be360d95c81a..8ec275b4e3b0de9254179c3e95cb61d9f4159eff 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 #include "report_problem_dialog.h"
 #include "wx_util.h"
+#include "static_text.h"
+#include "check_box.h"
 #include "lib/config.h"
 #include "lib/job_manager.h"
 #include "lib/send_problem_report_job.h"
 #include <wx/sizer.h>
 
 using std::string;
-using boost::shared_ptr;
+using std::shared_ptr;
 
-/** @param film Film that we are working on, or 0 */
+/** @param parent Parent window.
+ *  @param film Film that we are working on, or 0.
+ */
 ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr<Film> film)
        : wxDialog (parent, wxID_ANY, _("Report A Problem"))
        , _film (film)
@@ -52,18 +56,18 @@ ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr<Film> fil
        flags |= wxALIGN_RIGHT;
        t += wxT (":");
 #endif
-       wxStaticText* m = new wxStaticText (this, wxID_ANY, t);
+       wxStaticText* m = new StaticText (this, t);
        _table->Add (m, 1, flags, 6);
 
        _summary = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxSize (320, 240), wxTE_MULTILINE);
        _table->Add (_summary, 1, wxEXPAND | wxALIGN_TOP);
 
-       _send_logs = new wxCheckBox (this, wxID_ANY, _("Send logs"));
+       _send_logs = new CheckBox (this, _("Send logs"));
        _send_logs->SetValue (true);
        _table->Add (_send_logs, 1, wxEXPAND);
        _table->AddSpacer (0);
 
-       add_label_to_sizer (_table, this, _("Contact email"), true);
+       add_label_to_sizer (_table, this, _("Your email address"), true);
        _email = new wxTextCtrl (this, wxID_ANY, wxT (""));
        _email->SetValue (std_to_wx (Config::instance()->kdm_from ()));
        _table->Add (_email, 1, wxEXPAND);
@@ -86,13 +90,15 @@ ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr<Film> fil
                }
        }
 
-       wxStaticText* n = new wxStaticText (this, wxID_ANY, wxT (""));
+       wxStaticText* 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
@@ -103,5 +109,10 @@ ReportProblemDialog::report ()
                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()));
+               return;
+       }
+
        JobManager::instance()->add (shared_ptr<Job> (new SendProblemReportJob (_film, wx_to_std (_email->GetValue ()), wx_to_std (_summary->GetValue ()))));
 }