]> git.sven.stormbind.net Git - sven/vym.git/blobdiff - src/scripting.h
New upstream version 2.9.22
[sven/vym.git] / src / scripting.h
diff --git a/src/scripting.h b/src/scripting.h
new file mode 100644 (file)
index 0000000..c724512
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef SCRIPTING_H
+#define SCRIPTING_H
+
+#include <QColor>
+#include <QObject>
+#include <QScriptContext>
+#include <QScriptValue>
+#include <QScriptable>
+#include <QVariant>
+
+class BranchItem;
+class VymModelWrapper;
+
+void logError(QScriptContext *context, QScriptContext::Error error,
+              const QString &text);
+
+///////////////////////////////////////////////////////////////////////////
+class VymScriptContext : public QObject, protected QScriptable {
+    Q_OBJECT
+  public:
+    VymScriptContext();
+    QString setResult(const QString &r);
+    bool setResult(bool r);
+    int setResult(int r);
+    uint setResult(uint r);
+};
+
+///////////////////////////////////////////////////////////////////////////
+class VymWrapper : public VymScriptContext {
+    Q_OBJECT
+  public:
+    VymWrapper();
+
+  public slots:
+    void clearConsole();
+    bool isConfluenceAgentAvailable();
+    QObject *currentMap();
+    void editHeading();
+    bool loadMap(const QString &filename);
+    int mapCount();
+    void gotoMap(uint n);
+    bool closeMapWithID(uint n);
+    void selectQuickColor(int n);
+    QString currentColor();
+    uint currentMapID();
+    void toggleTreeEditor();
+    QString loadFile(const QString &filename);
+    void saveFile(const QString &filename, const QString &s);
+    QString version();
+};
+
+class Selection : public VymScriptContext {
+    Q_OBJECT
+  public:
+    Selection();
+
+  public slots:
+    void test();
+    void setModel(VymModelWrapper *mw);
+
+  private:
+    VymModelWrapper *modelWrapper;
+};
+
+#endif