-
Notifications
You must be signed in to change notification settings - Fork 2
/
WebPuppeteerSys.hpp
42 lines (35 loc) · 1.11 KB
/
WebPuppeteerSys.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
#include <QObject>
#include <QScriptValue>
#include <QNetworkAccessManager>
#include <QEventLoop>
class WebPuppeteer;
class WebPuppeteerTab;
class WebPuppeteerSys: public QObject {
Q_OBJECT;
public:
WebPuppeteerSys(WebPuppeteer *parent);
public slots:
void log(const QString &msg);
void sleep(int msecs);
QScriptValue get(const QString &url);
QScriptValue post(const QString &url, const QString &post, const QString content_type="application/x-www-form-urlencoded");
QScriptValue newTab();
QScriptValue getenv(const QString &var) const;
QString fileGetContents(QString filename);
QString fileGetContentsB64(QString filename);
bool filePutContents(QString filename, QString data);
bool filePutContentsB64(QString filename, QString data);
QScriptValue include(QString filename); // include a file
void alert(QString string);
void alertcb(QString string, QScriptValue cb);
bool confirm(QString string);
QString exec(QString str);
void quit();
void abort();
void alertcb_cb(); // used by alertcb internally
private:
WebPuppeteer *parent;
QNetworkAccessManager net;
QScriptValue tmp_cb;
QEventLoop *tmp_e;
};