diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-25 13:13:02 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-25 18:20:18 +0530 |
| commit | 4cbaaae7c55e71d2d4db591029394812077eb844 (patch) | |
| tree | 23574a00f4790332e9aafb4fd86fbc046c0ed85a /src/widgets/WebViewStack.hpp | |
| parent | 346c16b4e2ea26f47e0e370a490b7794492a9ebb (diff) | |
| download | null-browser-4cbaaae7c55e71d2d4db591029394812077eb844.tar.gz null-browser-4cbaaae7c55e71d2d4db591029394812077eb844.zip | |
Add web.history for history navigation
Diffstat (limited to '')
| -rw-r--r-- | src/widgets/WebViewStack.hpp | 19 |
1 files changed, 12 insertions, 7 deletions
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<QUrl> urls(); - QList<Tab> get_tab_list(); - uint32_t current_web_view_index(); + QList<Tab> 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<WebView *> web_view_list; + QList<WebView *> webview_list; }; |
