From 4cbaaae7c55e71d2d4db591029394812077eb844 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 25 Mar 2025 13:13:02 +0530 Subject: Add web.history for history navigation --- src/widgets/WebViewStack.hpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/widgets/WebViewStack.hpp') diff --git a/src/widgets/WebViewStack.hpp b/src/widgets/WebViewStack.hpp index aa463cc..c975d16 100644 --- a/src/widgets/WebViewStack.hpp +++ b/src/widgets/WebViewStack.hpp @@ -8,6 +8,8 @@ #include "Configuration.hpp" #include "widgets/WebView.hpp" +using WebViewId = qsizetype; + enum OpenType : uint8_t { OpenUrl, OpenUrlInTab, @@ -31,28 +33,31 @@ public: void open_url(const QUrl &url, OpenType open_type = OpenType::OpenUrl); std::vector urls(); - QList get_tab_list(); - uint32_t current_web_view_index(); + QList get_webview_list(); + uint32_t current_webview_index(); uint32_t count(); QUrl current_url(); - void focus_web_view(qsizetype index); + void focus_webview(WebViewId index); void next(); void previous(); - void close(qsizetype index); + void close(WebViewId index); void close_current(); + void webview_history_back(WebViewId webview_id, qsizetype history_index); + void webview_history_forward(WebViewId webview_id, qsizetype history_index); + private slots: - void on_new_web_view_request(const QWebEngineNewWindowRequest &request); + void on_new_webview_request(const QWebEngineNewWindowRequest &request); protected: void set_current_url(const QUrl &url); - WebView *create_new_web_view(const QUrl &url, bool focus = false); + WebView *create_new_webview(const QUrl &url, bool focus = false); private: const Configuration *configuration; QWebEngineProfile *profile; QStackedLayout *layout; - QList web_view_list; + QList webview_list; }; -- cgit v1.3.1