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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
/****************************************************************************
** Meta object code from reading C++ file 'sb.cpp'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.8)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include <memory>
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'sb.cpp' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.15.8. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
#include <unistd.h>
class WebEnginePage: public QWebEnginePage {
Q_OBJECT
public:
WebEnginePage(QWebEngineProfile *profile) : QWebEnginePage(profile) {};
virtual ~WebEnginePage() = default;
protected:
QWebEnginePage *createWindow(WebWindowType type){
WebEnginePage *page = new WebEnginePage(this->profile());
connect(page, &QWebEnginePage::urlChanged, this, &WebEnginePage::onUrlChanged);
return page;
}
private:
void onUrlChanged(const QUrl & url){
if(WebEnginePage *page = qobject_cast<WebEnginePage *>(sender())){
if (fork() == 0) {
std::string surl = url.toString().toStdString();
std::string parent_id_str = std::to_string(parent_id);
const char *exec[5] = { 0 };
exec[0] = "sb";
exec[1] = surl.c_str();
if (parent_id != 0) {
exec[2] = "-e";
exec[3] = parent_id_str.c_str();
}
fprintf(stderr, "spawn url: %s", exec[1]);
execvp((char*)exec[0], (char**)exec);
fprintf(stderr, "failed to open new sb instance\n");
perror(" failed");
exit(-1);
}
page->deleteLater();
}
}
};
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_WebEnginePage_t {
QByteArrayData data[1];
char stringdata0[14];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_WebEnginePage_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_WebEnginePage_t qt_meta_stringdata_WebEnginePage = {
{
QT_MOC_LITERAL(0, 0, 13) // "WebEnginePage"
},
"WebEnginePage"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_WebEnginePage[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
void WebEnginePage::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
(void)_o;
(void)_id;
(void)_c;
(void)_a;
}
QT_INIT_METAOBJECT const QMetaObject WebEnginePage::staticMetaObject = { {
QMetaObject::SuperData::link<QWebEnginePage::staticMetaObject>(),
qt_meta_stringdata_WebEnginePage.data,
qt_meta_data_WebEnginePage,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *WebEnginePage::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *WebEnginePage::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_WebEnginePage.stringdata0))
return static_cast<void*>(this);
return QWebEnginePage::qt_metacast(_clname);
}
int WebEnginePage::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWebEnginePage::qt_metacall(_c, _id, _a);
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
|