diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-02-22 01:38:04 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-02-23 01:47:38 +0100 |
| commit | 0690032e5c176bb6a9db41c76a167fa4fbd4cb8d (patch) | |
| tree | a56d36589400210f5c8b20e75bb5cdd71de74985 /src | |
| parent | 9dbd550788840b53cbcd80a3ed127afc785332ca (diff) | |
Make the player verify UI more like the standalone one.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/dcpomatic_player.cc | 13 | ||||
| -rw-r--r-- | src/tools/dcpomatic_verifier.cc | 1 | ||||
| -rw-r--r-- | src/wx/verify_dcp_progress_dialog.cc | 77 | ||||
| -rw-r--r-- | src/wx/verify_dcp_progress_dialog.h | 22 | ||||
| -rw-r--r-- | src/wx/verify_dcp_result_dialog.cc | 47 | ||||
| -rw-r--r-- | src/wx/verify_dcp_result_dialog.h | 37 | ||||
| -rw-r--r-- | src/wx/wscript | 1 |
7 files changed, 70 insertions, 128 deletions
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index e558d666b..dc570653f 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -33,7 +33,6 @@ #include "wx/timer_display.h" #include "wx/update_dialog.h" #include "wx/verify_dcp_progress_dialog.h" -#include "wx/verify_dcp_result_dialog.h" #include "wx/wx_signal_manager.h" #include "wx/wx_util.h" #include "wx/wx_variant.h" @@ -995,15 +994,9 @@ private: auto dcp = std::dynamic_pointer_cast<DCPContent>(_film->content().front()); DCPOMATIC_ASSERT (dcp); - auto job = make_shared<VerifyDCPJob>(dcp->directories(), _kdms); - VerifyDCPProgressDialog progress(this, variant::wx::dcpomatic_player()); - bool const completed = progress.run(job); - progress.Close(); - - if (completed) { - VerifyDCPResultDialog dialog(this, job); - dialog.ShowModal(); - } + auto job = make_shared<VerifyDCPJob>(dcp->directories(), _kdms, dcp::VerificationOptions{}); + VerifyDCPProgressDialog progress(this, _("Verify DCP"), job); + progress.ShowModal(); } void tools_check_for_updates () diff --git a/src/tools/dcpomatic_verifier.cc b/src/tools/dcpomatic_verifier.cc index 984d58a97..c8f9d8c8d 100644 --- a/src/tools/dcpomatic_verifier.cc +++ b/src/tools/dcpomatic_verifier.cc @@ -214,6 +214,7 @@ private: } _progress_panel->clear(); + setup_sensitivity(); } private: diff --git a/src/wx/verify_dcp_progress_dialog.cc b/src/wx/verify_dcp_progress_dialog.cc index cdca99603..1b7bb975d 100644 --- a/src/wx/verify_dcp_progress_dialog.cc +++ b/src/wx/verify_dcp_progress_dialog.cc @@ -19,8 +19,11 @@ */ +#include "check_box.h" +#include "dcpomatic_button.h" #include "verify_dcp_progress_dialog.h" #include "verify_dcp_progress_panel.h" +#include "verify_dcp_result_panel.h" #include "wx_util.h" #include "lib/cross.h" #include "lib/job_manager.h" @@ -32,57 +35,79 @@ LIBDCP_ENABLE_WARNINGS #include <string> -using std::string; using std::shared_ptr; +using std::string; using boost::optional; -VerifyDCPProgressDialog::VerifyDCPProgressDialog (wxWindow* parent, wxString title) +VerifyDCPProgressDialog::VerifyDCPProgressDialog (wxWindow* parent, wxString title, shared_ptr<VerifyDCPJob> job) : wxDialog (parent, wxID_ANY, title) - , _panel(new VerifyDCPProgressPanel(this)) - , _cancel (false) + , _progress_panel(new VerifyDCPProgressPanel(this)) + , _result_panel(new VerifyDCPResultPanel(this)) + , _cancel_pending(false) + , _job(job) { auto overall_sizer = new wxBoxSizer (wxVERTICAL); - overall_sizer->Add(_panel, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); + auto options_sizer = new wxBoxSizer(wxVERTICAL); + _check_picture_details = new CheckBox(this, _("Verify picture asset details")); + _check_picture_details->set(true); + _check_picture_details->SetToolTip( + _("Tick to check details of the picture asset, such as frame sizes and JPEG2000 bitstream validity. " + "These checks are quite time-consuming.") + ); + options_sizer->Add(_check_picture_details, 0, wxBOTTOM, DCPOMATIC_SIZER_GAP); + overall_sizer->Add(options_sizer, 0, wxALL, DCPOMATIC_SIZER_GAP); - auto cancel = new wxButton(this, wxID_ANY, _("Cancel")); auto buttons = new wxBoxSizer(wxHORIZONTAL); - buttons->AddStretchSpacer (); - buttons->Add (cancel, 0); - overall_sizer->Add (buttons, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); + _cancel = new Button(this, _("Cancel")); + buttons->Add(_cancel, 0, wxLEFT, DCPOMATIC_SIZER_GAP); + _verify = new Button(this, _("Verify")); + buttons->Add(_verify, 0, wxLEFT, DCPOMATIC_SIZER_GAP); + overall_sizer->Add(buttons, 0, wxALL | wxALIGN_CENTER, DCPOMATIC_SIZER_GAP); + + overall_sizer->Add(_progress_panel, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); + overall_sizer->Add(_result_panel, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); SetSizerAndFit (overall_sizer); - cancel->Bind (wxEVT_BUTTON, boost::bind(&VerifyDCPProgressDialog::cancel, this)); + _verify->bind(&VerifyDCPProgressDialog::verify_clicked, this); + _cancel->bind(&VerifyDCPProgressDialog::cancel_clicked, this); + + _cancel->Enable(false); } void -VerifyDCPProgressDialog::cancel () +VerifyDCPProgressDialog::cancel_clicked() { - _cancel = true; + _cancel_pending = true; } -bool -VerifyDCPProgressDialog::run(shared_ptr<VerifyDCPJob> job) +void +VerifyDCPProgressDialog::verify_clicked() { - Show (); + _cancel->Enable(true); + _verify->Enable(false); - JobManager* jm = JobManager::instance (); - jm->add (job); + auto jm = JobManager::instance(); + jm->add(_job); - while (jm->work_to_do()) { + while (jm->work_to_do() && !_cancel_pending) { wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI | wxEVT_CATEGORY_USER_INPUT); - dcpomatic_sleep_seconds (1); - - _panel->update(job); - - if (_cancel) { - break; - } + dcpomatic_sleep_milliseconds(250); + _progress_panel->update(_job); } - return !_cancel; + if (_cancel_pending) { + jm->cancel_all_jobs(); + EndModal(0); + } else { + _progress_panel->clear(); + _result_panel->add({ _job }); + _cancel->Enable(false); + _verify->Enable(false); + _check_picture_details->Enable(false); + } } diff --git a/src/wx/verify_dcp_progress_dialog.h b/src/wx/verify_dcp_progress_dialog.h index 5120b309b..c15c9f47a 100644 --- a/src/wx/verify_dcp_progress_dialog.h +++ b/src/wx/verify_dcp_progress_dialog.h @@ -26,21 +26,29 @@ LIBDCP_ENABLE_WARNINGS #include <memory> +class Button; +class CheckBox; class VerifyDCPJob; class VerifyDCPProgressPanel; +class VerifyDCPResultPanel; class VerifyDCPProgressDialog : public wxDialog { public: - VerifyDCPProgressDialog (wxWindow* parent, wxString title); - - bool run(std::shared_ptr<VerifyDCPJob> job); + VerifyDCPProgressDialog(wxWindow* parent, wxString title, std::shared_ptr<VerifyDCPJob> job); private: - void cancel (); - - VerifyDCPProgressPanel* _panel; - bool _cancel; + void verify_clicked(); + void cancel_clicked(); + + CheckBox* _check_picture_details; + VerifyDCPProgressPanel* _progress_panel; + VerifyDCPResultPanel* _result_panel; + Button* _cancel; + Button* _verify; + bool _cancel_pending; + std::shared_ptr<VerifyDCPJob> _job; }; + diff --git a/src/wx/verify_dcp_result_dialog.cc b/src/wx/verify_dcp_result_dialog.cc deleted file mode 100644 index c61ed19ea..000000000 --- a/src/wx/verify_dcp_result_dialog.cc +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net> - - 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. - - 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. - -*/ - - -#include "verify_dcp_result_dialog.h" -#include "verify_dcp_result_panel.h" -#include "wx_util.h" - - -using std::shared_ptr; - - -VerifyDCPResultDialog::VerifyDCPResultDialog(wxWindow* parent, shared_ptr<VerifyDCPJob> job) - : wxDialog (parent, wxID_ANY, _("DCP verification"), wxDefaultPosition, {600, 400}) -{ - auto sizer = new wxBoxSizer (wxVERTICAL); - - auto panel = new VerifyDCPResultPanel(this); - panel->add({ job }); - sizer->Add(panel, 1, wxEXPAND); - - auto buttons = CreateStdDialogButtonSizer(0); - sizer->Add (CreateSeparatedSizer(buttons), wxSizerFlags().Expand().DoubleBorder()); - buttons->SetAffirmativeButton (new wxButton (this, wxID_OK)); - buttons->Realize (); - - SetSizer (sizer); - sizer->Layout (); - sizer->SetSizeHints (this); -} diff --git a/src/wx/verify_dcp_result_dialog.h b/src/wx/verify_dcp_result_dialog.h deleted file mode 100644 index 8953ff8c5..000000000 --- a/src/wx/verify_dcp_result_dialog.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington <cth@carlh.net> - - 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. - - 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. - -*/ - - -#include <dcp/verify.h> -#include <dcp/warnings.h> -LIBDCP_DISABLE_WARNINGS -#include <wx/wx.h> -LIBDCP_ENABLE_WARNINGS -#include <map> - -class wxRichTextCtrl; -class VerifyDCPJob; - - -class VerifyDCPResultDialog : public wxDialog -{ -public: - VerifyDCPResultDialog(wxWindow* parent, std::shared_ptr<VerifyDCPJob> job); -}; diff --git a/src/wx/wscript b/src/wx/wscript index 583fe4bb0..2da80b376 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -178,7 +178,6 @@ sources = """ timing_panel.cc try_unmount_dialog.cc update_dialog.cc - verify_dcp_result_dialog.cc verify_dcp_result_panel.cc verify_dcp_progress_dialog.cc verify_dcp_progress_panel.cc |
