#include "lib/job_manager.h"
#include <wx/wx.h>
#include <boost/process.hpp>
-#ifdef __WXOSX__
+#ifdef DCPOMATIC_WINDOWS
+#include <boost/process/windows.hpp>
+#endif
+#ifdef DCPOMATIC_OSX
#include <ApplicationServices/ApplicationServices.h>
#endif
using std::exception;
using std::cout;
using std::cerr;
+using std::runtime_error;
using boost::shared_ptr;
class DOMFrame : public wxFrame
public:
explicit DOMFrame (wxString const & title)
: wxFrame (0, -1, title)
+ , _nanomsg (true)
, _sizer (new wxBoxSizer(wxVERTICAL))
{
/* Use a panel as the only child of the Frame so that we avoid
_sizer->Add (grid, 1, wxALL | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
overall_panel->SetSizer (_sizer);
Fit ();
- SetSize (512, GetSize().GetHeight() + 32);
+ SetSize (768, GetSize().GetHeight() + 32);
/* XXX: this is a hack, but I expect we'll need logs and I'm not sure if there's
* a better place to put them.
Bind (wxEVT_SIZE, boost::bind (&DOMFrame::sized, this, _1));
- _writer = new boost::process::child ("dcpomatic2_dist_writer", boost::process::std_in < _to_writer, boost::process::std_out > _from_writer);
+ 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);
+#else
+ _writer = new boost::process::child (dist_writer_path());
+#endif
}
private:
return;
}
- JobManager::instance()->add(shared_ptr<Job>(new CopyToDriveJob(*_dcp_path, _drives[_drive->GetSelection()], _to_writer, _from_writer)));
+ JobManager::instance()->add(shared_ptr<Job>(new CopyToDriveJob(*_dcp_path, _drives[_drive->GetSelection()], _nanomsg)));
+ setup_sensitivity ();
}
void drive_refresh ()
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;
boost::optional<boost::filesystem::path> _dcp_path;
std::vector<Drive> _drives;
boost::process::child* _writer;
- boost::process::opstream _to_writer;
- boost::process::ipstream _from_writer;
+ Nanomsg _nanomsg;
wxSizer* _sizer;
};