]> git.sven.stormbind.net Git - sven/vym.git/blob - src/scripting.h
Replace Pierre as the maintainer
[sven/vym.git] / src / scripting.h
1 #ifndef SCRIPTING_H
2 #define SCRIPTING_H
3
4 #include <QColor>
5 #include <QObject>
6 #include <QScriptContext>
7 #include <QScriptValue>
8 #include <QScriptable>
9 #include <QVariant>
10
11 class BranchItem;
12 class VymModelWrapper;
13
14 void logError(QScriptContext *context, QScriptContext::Error error,
15               const QString &text);
16
17 ///////////////////////////////////////////////////////////////////////////
18 class VymScriptContext : public QObject, protected QScriptable {
19     Q_OBJECT
20   public:
21     VymScriptContext();
22     QString setResult(const QString &r);
23     bool setResult(bool r);
24     int setResult(int r);
25     uint setResult(uint r);
26 };
27
28 ///////////////////////////////////////////////////////////////////////////
29 class VymWrapper : public VymScriptContext {
30     Q_OBJECT
31   public:
32     VymWrapper();
33
34   public slots:
35     void clearConsole();
36     bool isConfluenceAgentAvailable();
37     QObject *currentMap();
38     void editHeading();
39     bool loadMap(const QString &filename);
40     int mapCount();
41     void gotoMap(uint n);
42     bool closeMapWithID(uint n);
43     void selectQuickColor(int n);
44     QString currentColor();
45     uint currentMapID();
46     void toggleTreeEditor();
47     QString loadFile(const QString &filename);
48     void saveFile(const QString &filename, const QString &s);
49     QString version();
50 };
51
52 class Selection : public VymScriptContext {
53     Q_OBJECT
54   public:
55     Selection();
56
57   public slots:
58     void test();
59     void setModel(VymModelWrapper *mw);
60
61   private:
62     VymModelWrapper *modelWrapper;
63 };
64
65 #endif