aboutsummaryrefslogtreecommitdiff
path: root/include/BrowserManager.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/BrowserManager.hpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/BrowserManager.hpp b/include/BrowserManager.hpp
new file mode 100644
index 0000000..84d6f6a
--- /dev/null
+++ b/include/BrowserManager.hpp
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <QStackedLayout>
+#include <QWebEngineProfile>
+#include <QWebEngineView>
+#include <sys/types.h>
+
+class BrowserManager : public QWidget {
+ Q_OBJECT
+
+public:
+ inline static const QUrl NewtabURL = QUrl("about:blank");
+
+public:
+ BrowserManager(QWebEngineProfile *profile = new QWebEngineProfile);
+
+ QUrl currentUrl();
+ void setCurrentUrl(QUrl url);
+
+ QWebEngineView *createNewWebView(QUrl url = BrowserManager::NewtabURL,
+ bool focus = false);
+
+ std::vector<QUrl> webViewUrls();
+ u_int32_t currentWebViewIndex();
+ u_int32_t webViewCount();
+ void focusWebView(long index);
+ void nextWebView();
+ void previousWebView();
+
+ void closeWebView(long index);
+ void closeCurrentWebView();
+
+ void onNewWebViewRequest(QWebEngineNewWindowRequest &request);
+
+private:
+ QWebEngineProfile *profile;
+ QStackedLayout *layout;
+ QList<QWebEngineView *> webViewList;
+};