blob: 443dec53636bad7887afb7e3f4030aa561293cec (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#pragma once
#include <QtCore>
#include <lua.hpp>
#include "AsyncEventLoop.hpp"
#include "widgets/WebViewStack.hpp"
class LuaRuntime : public QObject {
Q_OBJECT
public:
static LuaRuntime *instance() {
static LuaRuntime inst;
return &inst;
}
void evaluate(QString code);
void stopEventLoop();
void startEventLoop();
DELEGATE(eventLoop, queueTask, queueTask)
signals:
void urlOpened(QString url, OpenType openType);
protected:
LuaRuntime();
~LuaRuntime();
static int lua_onUrlOpen(lua_State *state);
static int lua_onUrlTabOpen(lua_State *state);
private:
lua_State *state;
AsyncEventLoop *eventLoop = nullptr;
};
|