aboutsummaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/widgets/MainWindow.cpp6
-rw-r--r--src/widgets/WebViewStack.cpp10
2 files changed, 9 insertions, 7 deletions
diff --git a/src/widgets/MainWindow.cpp b/src/widgets/MainWindow.cpp
index e2e54da..289e629 100644
--- a/src/widgets/MainWindow.cpp
+++ b/src/widgets/MainWindow.cpp
@@ -21,7 +21,8 @@ MainWindow::MainWindow() {
centralWidget()->setLayout(layout);
// Web engine
- auto webViewStack = new WebViewStack(new QWebEngineProfile("web-browser"));
+ auto webViewStack = new WebViewStack((const Configuration *)&configuration,
+ new QWebEngineProfile("web-browser"));
layout->addWidget(webViewStack);
// Command input
@@ -44,8 +45,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) {
inputMediator->showCommandInput("");
} else if (combo.key() == Qt::Key_T &&
combo.keyboardModifiers().testFlag(Qt::ControlModifier)) {
- inputMediator->openUrl(QUrl("https://lite.duckduckgo.com"),
- OpenType::OpenUrlInTab);
+ inputMediator->showTabsInput();
} else if (combo.key() == Qt::Key_J &&
combo.keyboardModifiers().testFlag(Qt::ControlModifier)) {
inputMediator->nextWebView();
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) {