aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/MainWindow.cpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-18 21:19:28 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-18 21:19:47 +0530
commit4c762b2516bc664293c2aec072074f1e34dda8c3 (patch)
treeebe441f7af8c1f4c49f04630538312d55f18f63b /src/widgets/MainWindow.cpp
parent056b0b16947ac19a0c425aa9d2ff8f589378d3bc (diff)
downloadnull-browser-4c762b2516bc664293c2aec072074f1e34dda8c3.tar.gz
null-browser-4c762b2516bc664293c2aec072074f1e34dda8c3.zip
Remove all the ui bits because screw it, lets unix a bit more
Diffstat (limited to '')
-rw-r--r--src/widgets/MainWindow.cpp40
1 files changed, 13 insertions, 27 deletions
diff --git a/src/widgets/MainWindow.cpp b/src/widgets/MainWindow.cpp
index 7d045bc..327a77c 100644
--- a/src/widgets/MainWindow.cpp
+++ b/src/widgets/MainWindow.cpp
@@ -6,7 +6,6 @@
#include <QtWidgets/qapplication.h>
#include "InputMediator.hpp"
-#include "widgets/InputLine.hpp"
#include "widgets/MainWindow.hpp"
#include "widgets/WebViewStack.hpp"
@@ -28,13 +27,16 @@ MainWindow::MainWindow() {
new QWebEngineProfile("null-browser"));
layout->addWidget(webViewStack);
- // Command input
- auto inputLine = new InputLine();
- layout->addWidget(inputLine);
+ // TODO: remoev
+ webViewStack->openUrl(QUrl("https://duckduckgo.com"), OpenType::OpenUrl);
+ webViewStack->openUrl(QUrl("https://ediblemonad.dev"),
+ OpenType::OpenUrlInBgTab);
+ webViewStack->openUrl(QUrl("https://github.com/trending"),
+ OpenType::OpenUrlInBgTab);
- inputMediator =
- new InputMediator(inputLine, webViewStack, LuaRuntime::instance());
+ inputMediator = new InputMediator(webViewStack, LuaRuntime::instance());
+ // TODO: remove
keymapEvaluator.addKeymap("default", "<c-t>a", "Stuff");
keymapEvaluator.addKeymap("default", "<c-t>b", "Other stuff");
}
@@ -42,18 +44,8 @@ MainWindow::MainWindow() {
void MainWindow::keyPressEvent(QKeyEvent *event) {
auto combo = event->keyCombination();
- if (combo.key() == Qt::Key_L &&
+ if (combo.key() == Qt::Key_J &&
combo.keyboardModifiers().testFlag(Qt::ControlModifier)) {
- inputMediator->showURLInput(inputMediator->currentUrl().toString(),
- OpenType::OpenUrl);
- } else if (combo.key() == Qt::Key_Semicolon &&
- combo.keyboardModifiers().testFlag(Qt::ControlModifier)) {
- inputMediator->showCommandInput("");
- } else if (combo.key() == Qt::Key_T &&
- combo.keyboardModifiers().testFlag(Qt::ControlModifier)) {
- inputMediator->showTabsInput();
- } else if (combo.key() == Qt::Key_J &&
- combo.keyboardModifiers().testFlag(Qt::ControlModifier)) {
inputMediator->nextWebView();
} else if (combo.key() == Qt::Key_K &&
combo.keyboardModifiers().testFlag(Qt::ControlModifier)) {
@@ -65,17 +57,11 @@ void MainWindow::keyPressEvent(QKeyEvent *event) {
}
bool MainWindow::eventFilter(QObject *object, QEvent *event) {
- if (event->type() != QEvent::KeyPress && event->type() != QEvent::KeyRelease)
+ if (event->type() != QEvent::KeyPress)
return false;
- if (auto keyEvent = dynamic_cast<QKeyEvent *>(event)) {
- if (keyEvent->type() == QEvent::KeyPress)
- keymapEvaluator.evaluate(keyEvent->modifiers(), (Qt::Key)keyEvent->key());
-
- // qDebug() << "EV SELF: " << (object == this) << " | " << event->type();
- // qDebug() << "Key: " << keyEvent->modifiers() << keyEvent->key();
- return true;
- }
+ auto keyEvent = static_cast<QKeyEvent *>(event);
+ keymapEvaluator.evaluate(keyEvent->modifiers(), (Qt::Key)keyEvent->key());
- return false;
+ return true;
}