1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
/*
Contact : jmgr@jmgr.info
*/
#ifndef PROCESSHANDLE_H
#define PROCESSHANDLE_H
#include "actiontools_global.h"
#include "crossplatform.h"
#include "code/codeclass.h"
#include <QObject>
#include <QScriptValue>
#include <QScriptEngine>
namespace Code
{
class ACTIONTOOLSSHARED_EXPORT ProcessHandle : public CodeClass
{
Q_OBJECT
Q_ENUMS(KillMode)
Q_ENUMS(Priority)
public:
enum KillMode
{
Graceful,
Forceful,
GracefulThenForceful
};
enum Priority
{
AboveNormal,
BelowNormal,
High,
Idle,
Normal,
Realtime
};
static QScriptValue constructor(QScriptContext *context, QScriptEngine *engine);
static QScriptValue constructor(int processId, QScriptEngine *engine);
static int parameter(QScriptContext *context, QScriptEngine *engine);
static void registerClass(QScriptEngine *scriptEngine);
ProcessHandle();
ProcessHandle(const ProcessHandle &other);
ProcessHandle(int processId);
ProcessHandle &operator=(ProcessHandle other);
ProcessHandle &operator=(int processId);
void swap(ProcessHandle &other);
void swap(int &processId);
int processId() const;
public slots:
QScriptValue clone() const;
bool equals(const QScriptValue &other) const;
QString toString() const;
int id() const;
bool kill(KillMode killMode = GracefulThenForceful, int timeout = 3000) const;
bool isRunning() const;
QString command() const;
Priority priority() const;
private:
int mProcessId;
};
}
#endif // PROCESSHANDLE_H
|