mirror of https://github.com/OpenMW/openmw.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
#ifndef PROCESSINVOKER_HPP
|
|
#define PROCESSINVOKER_HPP
|
|
|
|
#include <QProcess>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
|
|
namespace Process
|
|
{
|
|
class ProcessInvoker : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
ProcessInvoker(QObject* parent = nullptr);
|
|
~ProcessInvoker();
|
|
|
|
// void setProcessName(const QString &name);
|
|
// void setProcessArguments(const QStringList &arguments);
|
|
|
|
QProcess* getProcess();
|
|
// QString getProcessName();
|
|
// QStringList getProcessArguments();
|
|
|
|
// inline bool startProcess(bool detached = false) { return startProcess(mName, mArguments, detached); }
|
|
inline bool startProcess(const QString& name, bool detached = false)
|
|
{
|
|
return startProcess(name, QStringList(), detached);
|
|
}
|
|
bool startProcess(const QString& name, const QStringList& arguments, bool detached = false);
|
|
|
|
void killProcess();
|
|
|
|
private:
|
|
QProcess* mProcess;
|
|
|
|
QString mName;
|
|
QStringList mArguments;
|
|
|
|
bool mIgnoreErrors = false;
|
|
|
|
private slots:
|
|
void processError(QProcess::ProcessError error);
|
|
void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
|
};
|
|
}
|
|
|
|
#endif // PROCESSINVOKER_HPP
|