aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/WebViewStack.cpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-16 15:28:00 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-16 15:29:59 +0530
commit041f8933be28d0fcff1196792f30c5ca3176c155 (patch)
tree5fceaf5844f3312e8db63425c5c25825df594861 /src/widgets/WebViewStack.cpp
parent350d2bd7ccf80b91abdff154344f0ce88080a195 (diff)
downloadnull-browser-041f8933be28d0fcff1196792f30c5ca3176c155.tar.gz
null-browser-041f8933be28d0fcff1196792f30c5ca3176c155.zip
Add configuration class
Diffstat (limited to '')
-rw-r--r--src/widgets/WebViewStack.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/widgets/WebViewStack.cpp b/src/widgets/WebViewStack.cpp
index b825623..d89db6e 100644
--- a/src/widgets/WebViewStack.cpp
+++ b/src/widgets/WebViewStack.cpp
@@ -4,13 +4,14 @@
#include "widgets/WebViewStack.hpp"
-WebViewStack::WebViewStack(QWebEngineProfile *profile, QWidget *parent)
- : QWidget(parent), profile(profile) {
+WebViewStack::WebViewStack(const Configuration *configuration,
+ QWebEngineProfile *profile, QWidget *parent)
+ : QWidget(parent), profile(profile), configuration(configuration) {
layout = new QStackedLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setStackingMode(QStackedLayout::StackOne);
- createNewWebView(WebViewStack::NewtabURL, true);
+ createNewWebView(configuration->newTabUrl, true);
}
void WebViewStack::openUrl(QUrl url, OpenType openType) {
@@ -104,7 +105,7 @@ void WebViewStack::close(long index) {
focusWebView(currentWebViewIndex());
if (webViewList.isEmpty()) {
- createNewWebView(WebViewStack::NewtabURL, true);
+ createNewWebView(configuration->newTabUrl, true);
}
}
@@ -116,6 +117,7 @@ std::vector<QUrl> WebViewStack::urls() {
}
u_int32_t WebViewStack::currentWebViewIndex() { return layout->currentIndex(); }
+
u_int32_t WebViewStack::count() { return webViewList.length(); }
void WebViewStack::focusWebView(long index) {