diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-18 20:52:36 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-18 20:52:36 +0530 |
| commit | 056b0b16947ac19a0c425aa9d2ff8f589378d3bc (patch) | |
| tree | d062dc2de09711c1f7e980fc8475c19a97ff7d99 /include/widgets | |
| parent | dd6590a0fda614fa2fb0ca9e4ad11b086393372e (diff) | |
| download | null-browser-056b0b16947ac19a0c425aa9d2ff8f589378d3bc.tar.gz null-browser-056b0b16947ac19a0c425aa9d2ff8f589378d3bc.zip | |
Add keymap evaluation with strict event filter
Diffstat (limited to '')
| -rw-r--r-- | include/widgets/InputLine.hpp | 2 | ||||
| -rw-r--r-- | include/widgets/MainWindow.hpp | 6 | ||||
| -rw-r--r-- | include/widgets/WebView.hpp | 13 | ||||
| -rw-r--r-- | include/widgets/WebViewStack.hpp | 9 |
4 files changed, 20 insertions, 10 deletions
diff --git a/include/widgets/InputLine.hpp b/include/widgets/InputLine.hpp index d5f65be..a382ff8 100644 --- a/include/widgets/InputLine.hpp +++ b/include/widgets/InputLine.hpp @@ -24,8 +24,6 @@ public: DELEGATE(input, text, getInputText) DELEGATE(promptPrefix, text, prompt) - // bool eventFilter(QObject *obj, QEvent *event) override; - signals: void submitted(QString text); void cancelled(); diff --git a/include/widgets/MainWindow.hpp b/include/widgets/MainWindow.hpp index 559a119..3e3a6d6 100644 --- a/include/widgets/MainWindow.hpp +++ b/include/widgets/MainWindow.hpp @@ -1,12 +1,10 @@ #pragma once #include <QMainWindow> -#include <QObject> -#include <QStackedLayout> -#include <QWebEngineView> #include "Configuration.hpp" #include "InputMediator.hpp" +#include "keymap/KeymapEvaluator.hpp" class MainWindow : public QMainWindow { public: @@ -14,8 +12,10 @@ public: private: void keyPressEvent(QKeyEvent *event) override; + bool eventFilter(QObject *object, QEvent *event) override; private: InputMediator *inputMediator; Configuration configuration; + KeymapEvaluator keymapEvaluator; }; diff --git a/include/widgets/WebView.hpp b/include/widgets/WebView.hpp new file mode 100644 index 0000000..8a95139 --- /dev/null +++ b/include/widgets/WebView.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include <QKeyEvent> +#include <QWebEngineView> +#include <QWidget> +#include <QtCore> + +class WebView : public QWebEngineView { + Q_OBJECT + +public: + WebView(QWebEngineProfile *profile); +}; diff --git a/include/widgets/WebViewStack.hpp b/include/widgets/WebViewStack.hpp index 34b1658..c315251 100644 --- a/include/widgets/WebViewStack.hpp +++ b/include/widgets/WebViewStack.hpp @@ -2,11 +2,11 @@ #include <QStackedLayout> #include <QWebEngineProfile> -#include <QWebEngineView> #include <sys/types.h> #include "Configuration.hpp" #include "completion/TabsModel.hpp" +#include "widgets/WebView.hpp" enum OpenType { OpenUrl, OpenUrlInTab, OpenUrlInBgTab, OpenUrlInWindow }; @@ -24,6 +24,7 @@ public: void openUrl(QUrl url, OpenType openType = OpenType::OpenUrl); std::vector<QUrl> urls(); + QList<Tab> getTabList(); u_int32_t currentWebViewIndex(); u_int32_t count(); QUrl currentUrl(); @@ -35,11 +36,9 @@ public: void close(long index); void closeCurrent(); - QList<Tab> getTabList(); - private: void setCurrentUrl(QUrl url); - QWebEngineView *createNewWebView(QUrl url, bool focus = false); + WebView *createNewWebView(QUrl url, bool focus = false); private slots: void onNewWebViewRequest(QWebEngineNewWindowRequest &request); @@ -48,5 +47,5 @@ private: const Configuration *configuration; QWebEngineProfile *profile; QStackedLayout *layout; - QList<QWebEngineView *> webViewList; + QList<WebView *> webViewList; }; |
