Vidalia 0.3.1
HelperProcessPrototype.cpp
Go to the documentation of this file.
1/*
2** This file is part of Vidalia, and is subject to the license terms in the
3** LICENSE file, found in the top level directory of this distribution. If
4** you did not receive the LICENSE file with this file, you may obtain it
5** from the Vidalia source package distributed by the Vidalia Project at
6** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7** including this file, may be copied, modified, propagated, or distributed
8** except according to the terms described in the LICENSE file.
9*/
10
11/*
12** \file HelperProcessPrototype.cpp
13** \brief Prototype for the HelperProcess class
14*/
15
17
19 : QObject(parent)
20{}
21
22QScriptValue
23HelperProcessPrototype::constructor(QScriptContext *context, QScriptEngine *engine)
24{
25 return engine->newQObject(new HelperProcess(), QScriptEngine::ScriptOwnership);
26}
27
28int
30{
31 return qMetaTypeId<HelperProcess *>();
32}
33
34QString
36{
37 return QString("HelperProcess");
38}
39
40void
41HelperProcessPrototype::start(const QString &app, const QString &args)
42{
43 HelperProcess *obj = qscriptvalue_cast<HelperProcess *>(thisObject());
44
45 if(obj)
46 obj->start(app, args);
47}
48
49void
50HelperProcessPrototype::start(const QString &app, const QStringList &args)
51{
52 HelperProcess *obj = qscriptvalue_cast<HelperProcess *>(thisObject());
53
54 if(obj)
55 obj->start(app, args);
56}
57
58bool
60{
61 HelperProcess *obj = qscriptvalue_cast<HelperProcess *>(thisObject());
62
63 if(obj)
64 return obj->isDone();
65}
66
67QStringList
69{
70 return HelperProcess::systemEnvironment();
71}
72
73void
75{
76 HelperProcess *obj = qscriptvalue_cast<HelperProcess *>(thisObject());
77
78 if(obj)
79 obj->setEnvironment(env);
80}
81
82HelperProcess::ProcessState
84{
85 HelperProcess *obj = qscriptvalue_cast<HelperProcess *>(thisObject());
86
87 if(obj)
88 return obj->state();
89
90 return HelperProcess::NotRunning;
91}
92
93void
95{
96 HelperProcess *obj = qscriptvalue_cast<HelperProcess *>(thisObject());
97
98 if(obj)
99 obj->toForeground();
100}
bool isDone() const
void start(const QString &app, const QString &args)
Q_INVOKABLE void start(const QString &app, const QString &args)
Q_INVOKABLE void setEnvironment(const QStringList &env)
Q_INVOKABLE QProcess::ProcessState state()
Q_INVOKABLE bool isDone() const
Q_INVOKABLE QStringList systemEnvironment()
static QScriptValue constructor(QScriptContext *context, QScriptEngine *engine)
HelperProcessPrototype(QObject *parent=0)