2 Copyright (C) 2020 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/>.
22 #include "verify_dcp_progress_dialog.h"
23 #include "verify_dcp_progress_panel.h"
25 #include "lib/cross.h"
27 #include "lib/job_manager.h"
28 #include <dcp/warnings.h>
29 LIBDCP_DISABLE_WARNINGS
30 #include <wx/evtloop.h>
31 LIBDCP_ENABLE_WARNINGS
36 using std::shared_ptr;
37 using boost::optional;
40 VerifyDCPProgressDialog::VerifyDCPProgressDialog (wxWindow* parent, wxString title)
41 : wxDialog (parent, wxID_ANY, title)
42 , _panel(new VerifyDCPProgressPanel(this))
45 auto overall_sizer = new wxBoxSizer (wxVERTICAL);
47 overall_sizer->Add(_panel, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP);
49 auto cancel = new wxButton(this, wxID_ANY, _("Cancel"));
50 auto buttons = new wxBoxSizer(wxHORIZONTAL);
51 buttons->AddStretchSpacer ();
52 buttons->Add (cancel, 0);
53 overall_sizer->Add (buttons, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP);
55 SetSizerAndFit (overall_sizer);
57 cancel->Bind (wxEVT_BUTTON, boost::bind(&VerifyDCPProgressDialog::cancel, this));
62 VerifyDCPProgressDialog::cancel ()
69 VerifyDCPProgressDialog::run (shared_ptr<Job> job)
73 JobManager* jm = JobManager::instance ();
76 while (jm->work_to_do()) {
77 wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI | wxEVT_CATEGORY_USER_INPUT);
78 dcpomatic_sleep_seconds (1);