Try to fix 'Copy DCP' button sensitivity.
authorCarl Hetherington <cth@carlh.net>
Fri, 27 Mar 2020 22:20:18 +0000 (23:20 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 28 Mar 2020 18:47:28 +0000 (19:47 +0100)
src/tools/dcpomatic_dist.cc

index 623774ee6ac61b2811bbde8027502be29a1c5d33..8ca87f38631a9abc40f5b62aa83c429ed700ecdc 100644 (file)
@@ -116,6 +116,8 @@ public:
 
                Bind (wxEVT_SIZE, boost::bind (&DOMFrame::sized, this, _1));
 
+               JobManager::instance()->ActiveJobsChanged.connect(boost::bind(&DOMFrame::setup_sensitivity, this));
+
 #ifdef DCPOMATIC_WINDOWS
                /* We must use ::shell here, it seems, to avoid error code 740 (related to privilege escalation) */
                _writer = new boost::process::child (dist_writer_path(), boost::process::shell, boost::process::windows::hide);
@@ -161,6 +163,7 @@ private:
                }
 
                JobManager::instance()->add(shared_ptr<Job>(new CopyToDriveJob(*_dcp_path, _drives[_drive->GetSelection()], _nanomsg)));
+               setup_sensitivity ();
        }
 
        void drive_refresh ()
@@ -193,7 +196,7 @@ private:
 
        void setup_sensitivity ()
        {
-               _copy->Enable (static_cast<bool>(_dcp_path) && _drive->GetSelection() != wxNOT_FOUND);
+               _copy->Enable (static_cast<bool>(_dcp_path) && _drive->GetSelection() != wxNOT_FOUND && !JobManager::instance()->work_to_do());
        }
 
        wxStaticText* _dcp_name;