|
1 | 1 | #ifndef WEBENGINEPAGE_H
|
2 | 2 | #define WEBENGINEPAGE_H
|
3 | 3 |
|
4 |
| - |
5 | 4 | #include <QFileDialog>
|
6 | 5 | #include <QWebEngineFullScreenRequest>
|
7 | 6 | #include <QWebEngineNotification>
|
8 | 7 | #include <QWebEngineProfile>
|
9 | 8 |
|
10 |
| -#include <QWebEnginePage> |
| 9 | +#include <QAuthenticator> |
11 | 10 | #include <QDesktopServices>
|
12 |
| -#include <QMessageBox> |
13 | 11 | #include <QImageReader>
|
| 12 | +#include <QMessageBox> |
14 | 13 | #include <QWebEngineCertificateError>
|
15 |
| -#include <QAuthenticator> |
| 14 | +#include <QWebEnginePage> |
16 | 15 |
|
17 |
| -#include <QWebEngineRegisterProtocolHandlerRequest> |
18 | 16 | #include <QWebEngineFullScreenRequest>
|
| 17 | +#include <QWebEngineRegisterProtocolHandlerRequest> |
19 | 18 |
|
20 | 19 | #include <QSettings>
|
21 | 20 |
|
22 | 21 | #include "ui_certificateerrordialog.h"
|
23 | 22 | #include "ui_passworddialog.h"
|
24 | 23 |
|
25 |
| -class WebEnginePage : public QWebEnginePage |
26 |
| -{ |
27 |
| - Q_OBJECT |
| 24 | +class WebEnginePage : public QWebEnginePage { |
| 25 | + Q_OBJECT |
28 | 26 | public:
|
29 |
| - WebEnginePage(QWebEngineProfile *profile, QObject *parent = nullptr); |
| 27 | + WebEnginePage(QWebEngineProfile *profile, QObject *parent = nullptr); |
30 | 28 |
|
31 | 29 | private:
|
32 |
| - QSettings settings; |
| 30 | + QSettings settings; |
| 31 | + |
33 | 32 | protected:
|
34 |
| - bool acceptNavigationRequest(const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) override; |
35 |
| - QWebEnginePage* createWindow(QWebEnginePage::WebWindowType type) override; |
36 |
| - bool certificateError(const QWebEngineCertificateError &error) override; |
37 |
| - QStringList chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes); |
| 33 | + bool acceptNavigationRequest(const QUrl &url, |
| 34 | + QWebEnginePage::NavigationType type, |
| 35 | + bool isMainFrame) override; |
| 36 | + QWebEnginePage *createWindow(QWebEnginePage::WebWindowType type) override; |
| 37 | + bool certificateError(const QWebEngineCertificateError &error) override; |
| 38 | + QStringList chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, |
| 39 | + const QStringList &acceptedMimeTypes); |
38 | 40 |
|
39 | 41 | public slots:
|
40 |
| - void handleFeaturePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature feature); |
41 |
| - void handleLoadFinished(bool ok); |
| 42 | + void handleFeaturePermissionRequested(const QUrl &securityOrigin, |
| 43 | + QWebEnginePage::Feature feature); |
| 44 | + void handleLoadFinished(bool ok); |
42 | 45 |
|
| 46 | +protected slots: |
| 47 | + void |
| 48 | + javaScriptConsoleMessage(WebEnginePage::JavaScriptConsoleMessageLevel level, |
| 49 | + const QString &message, int lineId, |
| 50 | + const QString &sourceId); |
43 | 51 | private slots:
|
44 |
| - void handleAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth); |
45 |
| - void handleProxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth, const QString &proxyHost); |
46 |
| - void handleRegisterProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request); |
| 52 | + void handleAuthenticationRequired(const QUrl &requestUrl, |
| 53 | + QAuthenticator *auth); |
| 54 | + void handleProxyAuthenticationRequired(const QUrl &requestUrl, |
| 55 | + QAuthenticator *auth, |
| 56 | + const QString &proxyHost); |
| 57 | + void handleRegisterProtocolHandlerRequested( |
| 58 | + QWebEngineRegisterProtocolHandlerRequest request); |
47 | 59 | #if !defined(QT_NO_SSL) || QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
48 |
| - void handleSelectClientCertificate(QWebEngineClientCertificateSelection clientCertSelection); |
| 60 | + void handleSelectClientCertificate( |
| 61 | + QWebEngineClientCertificateSelection clientCertSelection); |
49 | 62 | #endif
|
50 |
| - void fullScreenRequestedByPage(QWebEngineFullScreenRequest request); |
| 63 | + void fullScreenRequestedByPage(QWebEngineFullScreenRequest request); |
51 | 64 | };
|
52 | 65 |
|
53 | 66 | #endif // WEBENGINEPAGE_H
|
0 commit comments