added OpenMW runner
parent
a9df3b53fd
commit
1b4ab6e130
@ -0,0 +1,35 @@
|
||||
|
||||
#include "runner.hpp"
|
||||
|
||||
|
||||
CSMDoc::Runner::Runner()
|
||||
{
|
||||
connect (&mProcess, SIGNAL (finished (int, QProcess::ExitStatus)),
|
||||
this, SLOT (finished (int, QProcess::ExitStatus)));
|
||||
}
|
||||
|
||||
void CSMDoc::Runner::start()
|
||||
{
|
||||
QString path = "openmw";
|
||||
#ifdef Q_OS_WIN
|
||||
path.append(QString(".exe"));
|
||||
#elif defined(Q_OS_MAC)
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
path = dir.absoluteFilePath(name);
|
||||
#else
|
||||
path.prepend(QString("./"));
|
||||
#endif
|
||||
|
||||
mProcess.start (path);
|
||||
emit runStateChanged (true);
|
||||
}
|
||||
|
||||
void CSMDoc::Runner::stop()
|
||||
{
|
||||
mProcess.kill();
|
||||
}
|
||||
|
||||
void CSMDoc::Runner::finished (int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
emit runStateChanged (false);
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
#ifndef CSM_DOC_RUNNER_H
|
||||
#define CSM_DOC_RUNNER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
class Runner : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QProcess mProcess;
|
||||
|
||||
public:
|
||||
|
||||
Runner();
|
||||
|
||||
void start();
|
||||
|
||||
void stop();
|
||||
|
||||
signals:
|
||||
|
||||
void runStateChanged (bool running);
|
||||
|
||||
private slots:
|
||||
|
||||
void finished (int exitCode, QProcess::ExitStatus exitStatus);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue