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 
16 #include "HelperProcessPrototype.h"
17 
19  : QObject(parent)
20 {}
21 
22 QScriptValue
23 HelperProcessPrototype::constructor(QScriptContext *context, QScriptEngine *engine)
24 {
25  return engine->newQObject(new HelperProcess(), QScriptEngine::ScriptOwnership);
26 }
27 
28 int
30 {
31  return qMetaTypeId<HelperProcess *>();
32 }
33 
34 QString
36 {
37  return QString("HelperProcess");
38 }
39 
40 void
41 HelperProcessPrototype::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 
49 void
50 HelperProcessPrototype::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 
58 bool
60 {
61  HelperProcess *obj = qscriptvalue_cast<HelperProcess *>(thisObject());
62 
63  if(obj)
64  return obj->isDone();
65 }
66 
67 QStringList
69 {
70  return HelperProcess::systemEnvironment();
71 }
72 
73 void
75 {
76  HelperProcess *obj = qscriptvalue_cast<HelperProcess *>(thisObject());
77 
78  if(obj)
79  obj->setEnvironment(env);
80 }
81 
82 HelperProcess::ProcessState
84 {
85  HelperProcess *obj = qscriptvalue_cast<HelperProcess *>(thisObject());
86 
87  if(obj)
88  return obj->state();
89 
90  return HelperProcess::NotRunning;
91 }
92 
93 void
95 {
96  HelperProcess *obj = qscriptvalue_cast<HelperProcess *>(thisObject());
97 
98  if(obj)
99  obj->toForeground();
100 }
Q_INVOKABLE QProcess::ProcessState state()
void start(const QString &app, const QString &args)
HelperProcessPrototype(QObject *parent=0)
Q_INVOKABLE QStringList systemEnvironment()
Q_INVOKABLE void setEnvironment(const QStringList &env)
Q_INVOKABLE bool isDone() const
static QScriptValue constructor(QScriptContext *context, QScriptEngine *engine)
bool isDone() const
Q_INVOKABLE void start(const QString &app, const QString &args)