2 Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "verify_dcp_dialog.h"
23 #include "lib/verify_dcp_job.h"
24 #include <dcp/verify.h>
25 #include <wx/richtext/richtextctrl.h>
26 #include <boost/foreach.hpp>
29 using boost::shared_ptr;
31 VerifyDCPDialog::VerifyDCPDialog (wxWindow* parent, shared_ptr<VerifyDCPJob> job)
32 : wxDialog (parent, wxID_ANY, _("DCP verification"))
34 wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
35 _text = new wxRichTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (400, 300), wxRE_READONLY);
36 sizer->Add (_text, 1, wxEXPAND | wxALL, 6);
38 wxStdDialogButtonSizer* buttons = CreateStdDialogButtonSizer (0);
39 sizer->Add (CreateSeparatedSizer(buttons), wxSizerFlags().Expand().DoubleBorder());
40 buttons->SetAffirmativeButton (new wxButton (this, wxID_OK));
45 sizer->SetSizeHints (this);
47 _text->GetCaret()->Hide ();
49 if (job->finished_ok() && job->notes().empty()) {
50 _text->BeginStandardBullet (N_("standard/circle"), 1, 50);
51 _text->WriteText (_("DCP validates OK."));
52 _text->EndStandardBullet ();
56 /* We might have an error that did not come from dcp::verify; report it if so */
57 if (job->finished_in_error() && job->error_summary() != "") {
58 _text->BeginSymbolBullet (N_("!"), 1, 50);
59 _text->WriteText(std_to_wx(job->error_summary()));
63 BOOST_FOREACH (dcp::VerificationNote i, job->notes()) {
65 case dcp::VerificationNote::VERIFY_NOTE:
66 _text->BeginStandardBullet (N_("standard/circle"), 1, 50);
68 case dcp::VerificationNote::VERIFY_WARNING:
69 _text->BeginStandardBullet (N_("standard/diamond"), 1, 50);
71 case dcp::VerificationNote::VERIFY_ERROR:
72 _text->BeginSymbolBullet (N_("!"), 1, 50);
76 _text->WriteText (std_to_wx (i.note()));
80 case dcp::VerificationNote::VERIFY_NOTE:
81 case dcp::VerificationNote::VERIFY_WARNING:
82 _text->EndStandardBullet ();
84 case dcp::VerificationNote::VERIFY_ERROR:
85 _text->EndSymbolBullet ();