From 2078c60477842d7cf6991148e23979565737a8b5 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 26 Jul 2025 11:59:38 +0530 Subject: Refactor heavy + extras.tabline module (incomplete) --- src/widgets/BrowserWindow.hpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'src/widgets/BrowserWindow.hpp') diff --git a/src/widgets/BrowserWindow.hpp b/src/widgets/BrowserWindow.hpp index 92eafa7..e434521 100644 --- a/src/widgets/BrowserWindow.hpp +++ b/src/widgets/BrowserWindow.hpp @@ -5,6 +5,7 @@ #include "Configuration.hpp" #include "utils.hpp" #include "widgets/Decorations.hpp" +#include "widgets/IWebViewMediator.hpp" #include "widgets/WebViewStack.hpp" using WindowId = qsizetype; @@ -18,12 +19,10 @@ public: DEFINE_GETTER(get_id, win_id) DEFINE_SETTER(set_id, win_id) - // DELEGATE(webview_stack, has_webview, has_webview) DELEGATE(webview_stack, current_webview_id, current_webview_id) DELEGATE(webview_stack, get_webview_list, get_webview_list) DELEGATE(webview_stack, set_search_text, set_search_text) DELEGATE(webview_stack, open_devtools, open_devtools) - // DELEGATE(webview_stack, open_url, open_url) DELEGATE(webview_stack, webview_history_back, history_back) DELEGATE(webview_stack, webview_history_forward, history_forward) DELEGATE(webview_stack, close, close_webview) @@ -35,23 +34,10 @@ public: DELEGATE(decorations, get_enabled, get_decoration_enabled) DELEGATE(decorations, get_view_id, get_decoration_view_id) - bool has_webview(WebViewId webview_id) { - return webview_stack->has_webview(webview_id) || decorations->has_webview(webview_id); - } - - void open_url(const QUrl &url, OpenType open_type, WebViewId webview_id) { - if (decorations->has_webview(webview_id)) - decorations->open_url(url, webview_id); - else - webview_stack->open_url(url, open_type, webview_id); - } - - void set_html(const QString &html, WebViewId webview_id) { - if (decorations->has_webview(webview_id)) - decorations->set_html(html, webview_id); - else - webview_stack->set_html(html, webview_id); - } + IWebViewMediator *get_webview_mediator(WebViewId webview_id); + bool has_webview(WebViewId webview_id); + void open_url(const QUrl &url, OpenType open_type, WebViewId webview_id); + void set_html(const QString &html, WebViewId webview_id); bool on_window_key_event(QKeyEvent *event); -- cgit v1.3.1