Fix build with older boost.
[dcpomatic.git] / src / wx / job_view_dialog.cc
index b4dcd271f18af35584705c6932613b3acd8409d3..3d900e1d3e8d84a17abab8266d4b66b9bf7d0369 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #include "job_view_dialog.h"
-#include "job_view.h"
+#include "normal_job_view.h"
+#include "lib/job.h"
+
+
+using std::shared_ptr;
 
-using boost::shared_ptr;
 
 JobViewDialog::JobViewDialog (wxWindow* parent, wxString title, shared_ptr<Job> job)
        : TableDialog (parent, title, 4, 0, false)
+       , _job (job)
 {
-       _view = new JobView (job, this, this, _table);
+       _view = new NormalJobView (job, this, this, _table);
+       _view->setup ();
        layout ();
        SetMinSize (wxSize (960, -1));
 
-       Bind (wxEVT_TIMER, boost::bind (&JobViewDialog::periodic, this));
-       _timer.reset (new wxTimer (this));
+       Bind (wxEVT_TIMER, boost::bind(&JobViewDialog::periodic, this));
+       _timer.reset (new wxTimer(this));
        _timer->Start (1000);
+
+       /* Start off with OK disabled and it will be enabled when the job is finished */
+       auto ok = dynamic_cast<wxButton *>(FindWindowById(wxID_OK, this));
+       if (ok) {
+               ok->Enable (false);
+       }
 }
 
+
 JobViewDialog::~JobViewDialog ()
 {
        delete _view;
 }
 
+
 void
 JobViewDialog::periodic ()
 {
        _view->maybe_pulse ();
+
+       auto job = _job.lock ();
+       auto ok = dynamic_cast<wxButton *>(FindWindowById(wxID_OK, this));
+       if (job && ok) {
+               ok->Enable (job->finished ());
+       }
 }