X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Freport_problem_dialog.cc;h=c79c542ed5861d880010d9bbb54e8d1da0c14538;hb=edfb627f1226814ac804473b54d781ffd6db2700;hp=ae9b1d3ed2f40fc007503aef5a22028c7d03dc98;hpb=047f0c6a7fed251ed05f617d740787dcc83c98f7;p=dcpomatic.git diff --git a/src/wx/report_problem_dialog.cc b/src/wx/report_problem_dialog.cc index ae9b1d3ed..c79c542ed 100644 --- a/src/wx/report_problem_dialog.cc +++ b/src/wx/report_problem_dialog.cc @@ -1,24 +1,27 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-2018 Carl Hetherington - This program is free software; you can redistribute it and/or modify + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + DCP-o-matic is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with DCP-o-matic. If not, see . */ #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" @@ -27,6 +30,9 @@ using std::string; using boost::shared_ptr; +/** @param parent Parent window. + * @param film Film that we are working on, or 0. + */ ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr film) : wxDialog (parent, wxID_ANY, _("Report A Problem")) , _film (film) @@ -49,23 +55,46 @@ ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr fil #ifdef __WXOSX__ flags |= wxALIGN_RIGHT; t += wxT (":"); -#endif - wxStaticText* m = new wxStaticText (this, wxID_ANY, t); +#endif + 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); + /* We can't use Wrap() here as it doesn't work with markup: + * http://trac.wxwidgets.org/ticket/13389 + */ + + wxString in = _("It is important that you enter a valid email address here, otherwise I can't ask you for more details on your problem."); + wxString out; + int const width = 45; + int current = 0; + for (size_t i = 0; i < in.Length(); ++i) { + if (in[i] == ' ' && current >= width) { + out += '\n'; + current = 0; + } else { + out += in[i]; + ++current; + } + } + + wxStaticText* n = new StaticText (this, wxT ("")); + n->SetLabelMarkup (out); + _table->AddSpacer (0); + _table->Add (n, 1, wxEXPAND); + _overall_sizer->Layout (); _overall_sizer->SetSizeHints (this); } @@ -78,5 +107,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 (new SendProblemReportJob (_film, wx_to_std (_email->GetValue ()), wx_to_std (_summary->GetValue ())))); }