diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-04-09 21:11:32 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-04-16 00:39:05 +0200 |
| commit | b3a03888285d1f97253a6ed7e1438d5a2781fab9 (patch) | |
| tree | 0b97281087b1bd2f2524892e96ebc1f4e9d798b5 /src/wx/verify_dcp_progress_dialog.cc | |
| parent | e909adf6e23ab09b3e2dd38690dc711f6d2f8d34 (diff) | |
Split VerifyDCPProgressDialog into a panel and a dialog.
Diffstat (limited to 'src/wx/verify_dcp_progress_dialog.cc')
| -rw-r--r-- | src/wx/verify_dcp_progress_dialog.cc | 52 |
1 files changed, 8 insertions, 44 deletions
diff --git a/src/wx/verify_dcp_progress_dialog.cc b/src/wx/verify_dcp_progress_dialog.cc index 6c941c98d..5e3a7be62 100644 --- a/src/wx/verify_dcp_progress_dialog.cc +++ b/src/wx/verify_dcp_progress_dialog.cc @@ -20,6 +20,7 @@ #include "verify_dcp_progress_dialog.h" +#include "verify_dcp_progress_panel.h" #include "wx_util.h" #include "lib/cross.h" #include "lib/job.h" @@ -36,36 +37,17 @@ using std::shared_ptr; using boost::optional; -static int const max_file_name_length = 80; - - VerifyDCPProgressDialog::VerifyDCPProgressDialog (wxWindow* parent, wxString title) : wxDialog (parent, wxID_ANY, title) + , _panel(new VerifyDCPProgressPanel(this)) , _cancel (false) { - wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); - - _job_name = new wxStaticText (this, wxID_ANY, wxT("")); - overall_sizer->Add (_job_name, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_SIZER_GAP); - - _file_name = new wxStaticText (this, wxID_ANY, wxT("")); - wxFont file_name_font (*wxNORMAL_FONT); - file_name_font.SetFamily (wxFONTFAMILY_MODERN); - file_name_font.SetPointSize (file_name_font.GetPointSize() - 2); - _file_name->SetFont (file_name_font); - - int w; - int h; - _file_name->GetTextExtent (std_to_wx(string(max_file_name_length, 'X')), &w, &h); - _file_name->SetMinSize (wxSize(w, -1)); + auto overall_sizer = new wxBoxSizer (wxVERTICAL); - overall_sizer->Add (_file_name, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, DCPOMATIC_SIZER_GAP); + overall_sizer->Add(_panel, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); - _progress = new wxGauge (this, wxID_ANY, 100); - overall_sizer->Add (_progress, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); - - wxButton* cancel = new wxButton (this, wxID_ANY, _("Cancel")); - wxSizer* buttons = new wxBoxSizer (wxHORIZONTAL); + 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); @@ -94,26 +76,8 @@ VerifyDCPProgressDialog::run (shared_ptr<Job> job) while (jm->work_to_do()) { wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI | wxEVT_CATEGORY_USER_INPUT); dcpomatic_sleep_seconds (1); - optional<float> const progress = job->progress (); - if (progress) { - _progress->SetValue (*progress * 100); - } else { - _progress->Pulse (); - } - string const sub = job->sub_name (); - size_t colon = sub.find (":"); - if (colon != string::npos) { - _job_name->SetLabel (std_to_wx(sub.substr(0, colon))); - string file_name; - if ((sub.length() - colon - 1) > max_file_name_length) { - file_name = "..." + sub.substr(sub.length() - max_file_name_length + 3); - } else { - file_name = sub.substr(colon + 1); - } - _file_name->SetLabel (std_to_wx(file_name)); - } else { - _job_name->SetLabel (std_to_wx(sub)); - } + + _panel->update(job); if (_cancel) { break; |
