From 4c762b2516bc664293c2aec072074f1e34dda8c3 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 18 Mar 2025 21:19:28 +0530 Subject: Remove all the ui bits because screw it, lets unix a bit more --- src/widgets/MainWindow.cpp | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) (limited to 'src/widgets/MainWindow.cpp') 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 #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", "a", "Stuff"); keymapEvaluator.addKeymap("default", "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(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(event); + keymapEvaluator.evaluate(keyEvent->modifiers(), (Qt::Key)keyEvent->key()); - return false; + return true; } -- cgit v1.3.1