玉兔远程控制 0.1.0-bate1
载入中...
搜索中...
未找到
FrmWebView.h
1// Author: Kang Lin <kl222@126.com>
2
3#pragma once
4
5#include <QIcon>
6#include <QWebEngineView>
7#include <QWebEnginePage>
8#include <QWebEngineSettings>
9#include <QWebEngineCertificateError>
10#include <QWebEngineRegisterProtocolHandlerRequest>
11#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
12#include <QWebEngineFileSystemAccessRequest>
13#endif
14#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
15#include <QWebEngineWebAuthUxRequest>
16#include <QWebEngineDesktopMediaRequest>
17#endif
18#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
19#include <QWebEnginePermission>
20#endif
21#include <QActionGroup>
22
23class CFrmWebBrowser;
24class CFrmWebView : public QWebEngineView
25{
26 Q_OBJECT
27
28public:
29 explicit CFrmWebView(CFrmWebBrowser* parent = nullptr);
31 void setPage(QWebEnginePage *page);
32
33 [[nodiscard]] int progress() const;
34 [[nodiscard]] QIcon favIcon() const;
35
36protected:
37 void contextMenuEvent(QContextMenuEvent *event) override;
38 QWebEngineView *createWindow(QWebEnginePage::WebWindowType type) override;
39 void CreateWebActionTrigger(QWebEnginePage *page, QWebEnginePage::WebAction);
40
41signals:
42 void favIconChanged(const QIcon &icon);
43 void sigDevToolsRequested(QWebEnginePage *source);
44 void sigCloseRequested();
45 void sigLinkHovered(const QString &url);
46 void sigWebActionEnabledChanged(QWebEnginePage::WebAction webAction, bool enabled);
47
48private slots:
49 void slotSelectClientCertificate(QWebEngineClientCertificateSelection clientCertSelection);
50 void slotAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth);
51 void slotProxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth,
52 const QString &proxyHost);
53 void handleRegisterProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request);
54
55#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
56 void slotCertificateError(QWebEngineCertificateError error);
57 void slotPermissionRequested(QWebEnginePermission permission);
58 void handleImageAnimationPolicyChange(QWebEngineSettings::ImageAnimationPolicy policy);
59#endif
60#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
61 void slotFileSystemAccessRequested(QWebEngineFileSystemAccessRequest request);
62#endif
63#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
64 void slotDesktopMediaRequest(const QWebEngineDesktopMediaRequest &request);
65 void slotWebAuthUxRequested(QWebEngineWebAuthUxRequest *request);
66 void onStateChanged(QWebEngineWebAuthUxRequest::WebAuthUxState state);
67#endif
68
69private:
70 CFrmWebBrowser* m_pBrowser;
71 int m_loadProgress = 100;
72 //WebAuthDialog *m_authDialog = nullptr;
73 QActionGroup *m_imageAnimationGroup = nullptr;
74};
void slotFileSystemAccessRequested(QWebEngineFileSystemAccessRequest request)
[registerProtocolHandlerRequested]
void handleRegisterProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request)
[registerProtocolHandlerRequested]