Vidalia  0.3.1
PluginEngine.h
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 you
4 ** did not receive the LICENSE file with this file, you may obtain it from the
5 ** 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 PluginEngine.h
13 ** \brief Engine that handles all plugin related features
14 */
15 
16 #ifndef PLUGINENGINE_H
17 #define PLUGINENGINE_H
18 
19 #include <QtGui>
20 #include <QtScript>
21 
22 #include "VidaliaTabPrototype.h"
23 #include "HelperProcessPrototype.h"
24 #include "TorControlPrototype.h"
25 
26 class PluginWrapper;
27 
28 #define ADD_PROTOTYPE(protoType) \
29  QScriptValue __script##protoType = newQObject(new protoType); \
30  setDefaultPrototype(protoType::metaTypeId(), __script##protoType); \
31 
32 #define MAKE_CREATABLE(protoType) \
33  globalObject().setProperty(protoType::name(), newFunction(protoType::constructor, __script##protoType));
34 
35 class PluginEngine : public QScriptEngine {
36  Q_OBJECT
37 
38  public:
39  PluginEngine(QObject *parent = 0);
40  ~PluginEngine();
41 
42  QList<QAction *> getAllActions();
43 
44  signals:
45  void pluginTab(VidaliaTab *);
46 
47  protected:
48  static QScriptValue importExtension(QScriptContext *context, QScriptEngine *engine);
49 // static bool loadFile(QString fileName, QScriptEngine *engine);
50 // static QScriptValue includeScript(QScriptContext *context, QScriptEngine *engine);
51  static QScriptValue vdebug(QScriptContext *context, QScriptEngine *engine);
52  static QScriptValue findWidget(QScriptContext *context, QScriptEngine *engine);
53  static QScriptValue sleep(QScriptContext *context, QScriptEngine *engine);
54 
55  void loadAllPlugins();
56  void tryLoadPlugin(QDir path);
57 
58  QList<PluginWrapper *> wrappers;
59 };
60 
61 #endif
62 
static QScriptValue sleep(QScriptContext *context, QScriptEngine *engine)
void tryLoadPlugin(QDir path)
static QScriptValue importExtension(QScriptContext *context, QScriptEngine *engine)
static QScriptValue findWidget(QScriptContext *context, QScriptEngine *engine)
QList< QAction * > getAllActions()
void pluginTab(VidaliaTab *)
void loadAllPlugins()
QList< PluginWrapper * > wrappers
Definition: PluginEngine.h:58
PluginEngine(QObject *parent=0)
static QScriptValue vdebug(QScriptContext *context, QScriptEngine *engine)