#ifndef WEBVIEWWINDOW_H #define WEBVIEWWINDOW_H #include #include #include #include #include #include class WebViewQt; class Rktwebview_qt; class Command; class WebviewWindow : public QMainWindow { Q_OBJECT private: Rktwebview_qt *_container; WebViewQt *_view; QMainWindow *_devtools; WebviewWindow *_parent; QTimer _resize_timer; QTimer _move_timer; int _x; int _y; int _w; int _h; bool _must_close; bool _window_created; int _moved; int _resized; QString _ou_token; QWebEngineProfile *_profile; bool _navigation_event_sent; private slots: void handleCertificate(const QWebEngineCertificateError &certificateError); void navigationRequested(QWebEngineNavigationRequest &req); public slots: void processJsEvents(); void closeView(); protected: void closeEvent(QCloseEvent *evt); public: bool windowCreated(); int moveCount(); int resizeCount(); void setOUToken(const QString &token); bool navigationEventSent(); public: void addView(WebViewQt *v, Rktwebview_qt *c); WebViewQt *view(); public: void runJs(const QString &js); void callJs(const QString &js, Command *c); void openDevTools(); public: explicit WebviewWindow(QWebEngineProfile *profile, WebviewWindow *parent); private slots: void triggerResize(); void triggerMove(); void linkHovered(const QUrl &u); void evtRequested(QWebEngineFrame frame); public: QWebEngineProfile *profile(); signals: // QWidget interface protected: void moveEvent(QMoveEvent *event); void resizeEvent(QResizeEvent *event); void showEvent(QShowEvent *event); void hideEvent(QHideEvent *event); }; #endif // WEBVIEWWINDOW_H