aboutsummaryrefslogtreecommitdiff
path: root/include/widgets/WebViewStack.hpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-11 23:02:44 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-12 00:13:47 +0530
commit35d8464f8975ab35c1e2f1a076302d9f95bfb22c (patch)
tree0b4e26e36fb27dd32c0e174e4ef829f1f77c1daf /include/widgets/WebViewStack.hpp
parent0d5b7cb2a8bea5d91c58dd40f80d60bca384b766 (diff)
downloadnull-browser-35d8464f8975ab35c1e2f1a076302d9f95bfb22c.tar.gz
null-browser-35d8464f8975ab35c1e2f1a076302d9f95bfb22c.zip
Refactor browsermanager to webviewstack
Diffstat (limited to '')
-rw-r--r--include/widgets/WebViewStack.hpp (renamed from include/widgets/BrowserManager.hpp)33
1 files changed, 18 insertions, 15 deletions
diff --git a/include/widgets/BrowserManager.hpp b/include/widgets/WebViewStack.hpp
index 8cf265d..1d10715 100644
--- a/include/widgets/BrowserManager.hpp
+++ b/include/widgets/WebViewStack.hpp
@@ -7,34 +7,37 @@
enum OpenType { OpenUrl, OpenUrlInTab, OpenUrlInBgTab, OpenUrlInWindow };
-class BrowserManager : public QWidget {
+class WebViewStack : public QWidget {
Q_OBJECT
public:
inline static const QUrl NewtabURL = QUrl("about:blank");
public:
- BrowserManager(QWebEngineProfile *profile = new QWebEngineProfile);
+ WebViewStack(QWebEngineProfile *profile = new QWebEngineProfile,
+ QWidget *parent = nullptr);
- QUrl currentUrl();
- void setCurrentUrl(QUrl url);
-
- QWebEngineView *createNewWebView(QUrl url = BrowserManager::NewtabURL,
- bool focus = false);
-
- void openUrl(QUrl url = BrowserManager::NewtabURL,
+ void openUrl(QUrl url = WebViewStack::NewtabURL,
OpenType openType = OpenType::OpenUrl);
- std::vector<QUrl> webViewUrls();
+ std::vector<QUrl> urls();
u_int32_t currentWebViewIndex();
- u_int32_t webViewCount();
+ u_int32_t count();
+ QUrl currentUrl();
+
void focusWebView(long index);
- void nextWebView();
- void previousWebView();
+ void next();
+ void previous();
+
+ void close(long index);
+ void closeCurrent();
- void closeWebView(long index);
- void closeCurrentWebView();
+private:
+ void setCurrentUrl(QUrl url);
+ QWebEngineView *createNewWebView(QUrl url = WebViewStack::NewtabURL,
+ bool focus = false);
+private slots:
void onNewWebViewRequest(QWebEngineNewWindowRequest &request);
private: