diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-07-26 11:59:38 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-07-26 11:59:38 +0530 |
| commit | 2078c60477842d7cf6991148e23979565737a8b5 (patch) | |
| tree | 980e2aea150e85c6b87f2b521fce1006486244d8 /src/widgets/WebViewStack.hpp | |
| parent | 68448538172663279919b29dd09b5faa51e0628a (diff) | |
| download | null-browser-2078c60477842d7cf6991148e23979565737a8b5.tar.gz null-browser-2078c60477842d7cf6991148e23979565737a8b5.zip | |
Refactor heavy + extras.tabline module (incomplete)
Diffstat (limited to 'src/widgets/WebViewStack.hpp')
| -rw-r--r-- | src/widgets/WebViewStack.hpp | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/widgets/WebViewStack.hpp b/src/widgets/WebViewStack.hpp index 3da96aa..2096f25 100644 --- a/src/widgets/WebViewStack.hpp +++ b/src/widgets/WebViewStack.hpp @@ -7,24 +7,12 @@ #include <vector> #include "Configuration.hpp" +#include "WebViewData.hpp" +#include "utils.hpp" +#include "widgets/IWebViewMediator.hpp" #include "widgets/WebView.hpp" -using WebViewId = qsizetype; - -enum OpenType : uint8_t { - OpenUrl, - OpenUrlInView, - OpenUrlInBgView, - OpenUrlInWindow, -}; - -struct WebViewData { - WebViewId id; - QString url; - QString title; -}; - -class WebViewStack : public QWidget { +class WebViewStack : public QWidget, public IWebViewMediator { Q_OBJECT public: @@ -33,6 +21,8 @@ public: WebViewStack(const Configuration *configuration, QWebEngineProfile *profile = new QWebEngineProfile, QWidget *parent = nullptr); + DEFINE_GETTER(get_profile, profile) + QList<WebViewData> get_webview_list(); WebView *current_webview(); WebViewId current_webview_id(); @@ -40,9 +30,7 @@ public: QUrl current_url(); void set_webview_url(const QUrl &url, WebViewId webview_id); - bool has_webview(WebViewId webview_id); - - QWebEngineProfile *get_profile() { return profile; } + bool has_webview(WebViewId webview_id) override; /// @deprecated TODO: Remove std::vector<QUrl> urls(); @@ -62,7 +50,8 @@ protected: void on_download_request(QWebEngineDownloadRequest *download); public slots: - void open_url(const QUrl &url, OpenType open_type = OpenType::OpenUrl, WebViewId webview_id = 0); + void open_url(const QUrl &url, OpenType open_type = OpenType::OpenUrl, + WebViewId webview_id = 0) override; void webview_history_back(WebViewId webview_id, qsizetype history_index); void webview_history_forward(WebViewId webview_id, qsizetype history_index); void close(WebViewId webview_id); @@ -72,7 +61,7 @@ public slots: void scroll(WebViewId webview_id, int deltax, int deltay); void scroll_to_top(WebViewId webview_id); void scroll_to_bottom(WebViewId webview_id); - void set_html(const QString &html, WebViewId webview_id = 0); + void set_html(const QString &html, WebViewId webview_id = 0) override; protected slots: void on_new_webview_request(QWebEngineNewWindowRequest &request); |
