From e87693c54ca97ed3a6ed25f9eaae8ab223fc18b1 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Wed, 29 Apr 2020 18:49:07 +0300 Subject: libwebengine Make src/webengine into a static library - Add some tests - Updated manpage - Remove WebProfileManager::id and WebProfileManager::instance - Add consumable semantics checks to WebProfileManager - Add WebProfileManager::walk Add ApplicationMenu class --- src/webengine/webview.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/webengine/webview.h') diff --git a/src/webengine/webview.h b/src/webengine/webview.h index 5748691..a9c6866 100644 --- a/src/webengine/webview.h +++ b/src/webengine/webview.h @@ -11,10 +11,10 @@ #include "webpage.h" #include +#include #include class WebProfile; -class SubWindow; class WebViewContextMenu; class WebView final : public QWebEngineView { @@ -25,8 +25,10 @@ class WebView final : public QWebEngineView explicit WebView(QWidget *parent = nullptr); public: - explicit WebView(WebProfile *profile = nullptr, QWidget *parent = nullptr); - explicit WebView(const Session::WebView &data, QWidget *parent = nullptr); + typedef std::function cb_createWindow_t; + + WebView(WebProfile *profile, cb_createWindow_t cb, QWidget *parent = nullptr); + WebView(const Session::WebView &data, cb_createWindow_t cb, QWidget *parent = nullptr); ~WebView() = default; [[nodiscard]] WebProfile *profile() const @@ -37,7 +39,10 @@ public: [[nodiscard]] Session::WebView serialize() const; - bool isLoaded() const; + bool isLoaded() const + { + return m_loaded; + } public slots: void search(const QString &term); @@ -46,11 +51,14 @@ signals: void newBookmark(const QString &title, const QUrl &url); protected: - WebView *createWindow(QWebEnginePage::WebWindowType type) override; + WebView *createWindow(QWebEnginePage::WebWindowType type) override + { + return cb_createWindow ? cb_createWindow(type) : nullptr; + } void contextMenuEvent(QContextMenuEvent *event) override; private: - SubWindow *m_parentWindow = nullptr; + cb_createWindow_t cb_createWindow; WebProfile *m_profile = nullptr; bool m_loaded = false; -- cgit v1.2.1