Commit 2c4144b3 authored by John Tourtellott's avatar John Tourtellott
Browse files

Add code to launch the executable using QProcess

parent 89e2ccf3
......@@ -109,9 +109,13 @@ void pqCubitToolBar::onLaunch()
cubitStringProp->SetElement(0, cubitPath.c_str());
proxy->UpdateVTKObjects();
//QMessageBox::information(mainWidget, "CUBIT PATH FOUND", path);
// Run the process
// return this->runCubit(cubit_path);
QMessageBox::information(mainWidget, "CUBIT PATH FOUND", path);
bool success = this->runCubit(path);
if (!success)
{
QMessageBox::warning(mainWidget, "CUBIT LAUNCH FAILED", "The system was unable to launch CUBIT.");
}
}
void pqCubitToolBar::askUserForPath(const QString& headline, const QString& details, QString& result) const
......@@ -168,3 +172,18 @@ bool pqCubitToolBar::checkPath(const QString& path, QString& reason) const
return true;
}
bool pqCubitToolBar::runCubit(const QString& path) const
{
QProcess process;
process.setProgram(path);
// process.setArguments();
// process.setWorkingDirectory();
qint64 pid;
bool success = process.startDetached(&pid);
if (success)
{
qInfo() << "Started process" << pid;
}
return success;
}
......@@ -12,11 +12,9 @@
#include "smtk/PublicPointerDefs.h"
#include <QString>
#include <QToolBar>
// class pqServer;
// class QAction;
// class vtkSMSMTKResourceManagerProxy;
class pqCubitToolBar : public QToolBar
{
......@@ -30,6 +28,8 @@ public:
protected:
void askUserForPath(const QString& headline, const QString& details, QString& result) const;
bool checkPath(const QString& path, QString& reason) const;
bool runCubit(const QString& path) const;
protected slots:
void onLaunch();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment