forked from SmartisanTech/Wrench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
luaexecutethread.hpp
52 lines (48 loc) · 1.56 KB
/
luaexecutethread.hpp
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef _LUAEXECUTETHREAD_H_
#define _LUAEXECUTETHREAD_H_
#include <QtCore/QThread>
#include <QtCore/QStringList>
#include <QtCore/QList>
#include <QtCore/QMutex>
#include <QtCore/QWaitCondition>
#include <lua.hpp>
#include <QAbstractSocket>
#include <QTcpSocket>
class LuaExecuteThread : public QThread
{
Q_OBJECT
public:
void logToUI(const char *log);
QString adbQuickInputAm(QString arg);
~LuaExecuteThread();
LuaExecuteThread(QObject* parent = NULL);
void addScript(QStringList script);
void quitLua();
bool isQuit();
void run();
QString selectArgs(const QStringList&);
void on_argSelected(const QString& arg);
void load_mail_heads(const QString& subject, const QString& to, const QString& cc, const QString& bcc, const QString& attachments);
void setVariableLocked(const QString& name, const QString& val);
QString getVariableLocked(const QString& name, const QString& defaultVal = "");
private:
QMutex mVariableMutex;
QHash<QString, QString> mVariableHash;
signals:
void gotSomeLog(const QString& key, const QString& val);
void selectArgsSig(const QStringList&);
void load_mail_heads_sig(const QString& subject, const QString& to, const QString& cc, const QString& bcc, const QString& attachments);
signals:
void requestSyncScreen();
private:
lua_State *L;
QString mSelectedArg;
bool mQuit;
QMutex mMutex;
QList<QStringList> mActions;
QWaitCondition mWait;
QWaitCondition mSelectArgsWait;
QMutex mSelectArgsMutex;
QTcpSocket* t1Sock;
};
#endif /* _LUAEXECUTETHREAD_H_ */