aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/WebViewStack.hpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-25 20:26:40 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-25 20:26:40 +0530
commit1284f8cf39e8ba44e837d4dac0bace89cb7a0c26 (patch)
tree58ff313869ca62b335a8412289e3bbec1c104f47 /src/widgets/WebViewStack.hpp
parent4cbaaae7c55e71d2d4db591029394812077eb844 (diff)
downloadnull-browser-1284f8cf39e8ba44e837d4dac0bace89cb7a0c26.tar.gz
null-browser-1284f8cf39e8ba44e837d4dac0bace89cb7a0c26.zip
Refactor webview index with id + add web.tabs.close
Diffstat (limited to '')
-rw-r--r--src/widgets/WebViewStack.hpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/widgets/WebViewStack.hpp b/src/widgets/WebViewStack.hpp
index c975d16..3c69888 100644
--- a/src/widgets/WebViewStack.hpp
+++ b/src/widgets/WebViewStack.hpp
@@ -30,23 +30,21 @@ public:
QWebEngineProfile *profile = new QWebEngineProfile,
QWidget *parent = nullptr);
- void open_url(const QUrl &url, OpenType open_type = OpenType::OpenUrl);
-
- std::vector<QUrl> urls();
+ std::vector<QUrl> urls(); // TODO: Remove
QList<Tab> get_webview_list();
- uint32_t current_webview_index();
+ WebView *current_webview();
+ WebViewId current_webview_id();
uint32_t count();
QUrl current_url();
+ WebView *get_webview(WebViewId webview_id);
+ uint32_t current_webview_index();
- void focus_webview(WebViewId index);
- void next();
- void previous();
-
- void close(WebViewId index);
- void close_current();
-
+public slots: // NOLINT(readability-redundant-access-specifiers)
+ void open_url(const QUrl &url, OpenType open_type = OpenType::OpenUrl);
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);
+ void focus_webview(WebViewId webview_id);
private slots:
void on_new_webview_request(const QWebEngineNewWindowRequest &request);
@@ -54,10 +52,12 @@ private slots:
protected:
void set_current_url(const QUrl &url);
WebView *create_new_webview(const QUrl &url, bool focus = false);
+ int32_t get_webview_index(WebViewId webview_id);
private:
const Configuration *configuration;
QWebEngineProfile *profile;
QStackedLayout *layout;
QList<WebView *> webview_list;
+ WebViewId next_id = 1;
};