-
Notifications
You must be signed in to change notification settings - Fork 11
/
mainwindow.h
63 lines (55 loc) · 1.37 KB
/
mainwindow.h
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
53
54
55
56
57
58
59
60
61
62
63
#ifndef BROWSERWINDOW_H
#define BROWSERWINDOW_H
#include <QMainWindow>
#include <QMenu>
#include <QWebSocketServer>
#include <QWidget>
#include <QtWebKitWidgets/QWebFrame>
#include <QtWebKitWidgets/QWebView>
class JSBridge : public QObject {
Q_OBJECT
public:
QMainWindow *mainWindow;
JSBridge(QMainWindow *mainWindow) : QObject(mainWindow) {
this->mainWindow = mainWindow;
}
};
class OSBridge : public QObject {
Q_OBJECT
public:
QMainWindow *mainWindow;
OSBridge(QMainWindow *mainWindow) : QObject(mainWindow) {
this->mainWindow = mainWindow;
}
public slots:
QString runCmd(QStringList args);
};
class MainWindow : public QMainWindow {
Q_OBJECT
// Define signals and slots
QString optStartupUrl = "./www/index.html";
int optWebSocketServerPort = 0;
int optWidth = 0;
int optHeight = 0;
bool optEnableJSBridge = true;
bool optEnableOSBridge = true;
QString optWebSocketServerKey = "";
QString optProxyHost = "";
int optProxyPort = 0;
public:
JSBridge jsBridge;
OSBridge osBridge;
QWebView *webView;
QWebSocketServer webSocketServer;
explicit MainWindow();
~MainWindow();
void configureWebView();
void loadConfig();
void loadUrl(QString url);
public slots:
void loadStartupUrl();
void onLoadStarted();
void onNewWebSocketConnection();
void onWebSocketTextMessageReceived(QString message);
};
#endif // BROWSERWINDOW_H