diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-29 11:45:18 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-29 11:45:18 +0530 |
| commit | bcecbced7e1af9d99443a7e823f18328c7943f09 (patch) | |
| tree | 612fac477acfa38358e15916bd4a44f386dc9206 /src/widgets/BrowserApp.cpp | |
| parent | f7392096d2d84be7143947d386528bf4f487ee83 (diff) | |
| download | null-browser-bcecbced7e1af9d99443a7e823f18328c7943f09.tar.gz null-browser-bcecbced7e1af9d99443a7e823f18328c7943f09.zip | |
Add window action router for multi-window
Diffstat (limited to '')
| -rw-r--r-- | src/widgets/BrowserApp.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/widgets/BrowserApp.cpp b/src/widgets/BrowserApp.cpp index 0a82de0..3cd06b4 100644 --- a/src/widgets/BrowserApp.cpp +++ b/src/widgets/BrowserApp.cpp @@ -2,8 +2,9 @@ #include <QtCore> #include "LuaRuntime.hpp" +#include "WindowActionRouter.hpp" #include "widgets/BrowserApp.hpp" -#include "widgets/MainWindow.hpp" +#include "widgets/BrowserWindow.hpp" BrowserApp::BrowserApp() { auto *lua = LuaRuntime::instance(); @@ -11,16 +12,13 @@ BrowserApp::BrowserApp() { // Global event filter qApp->installEventFilter(this); - - // NOTE: TMP - lua->load_file("./config.lua"); }; -MainWindow *BrowserApp::create_window() { - auto *win = new MainWindow((const Configuration &)configuration); +BrowserWindow *BrowserApp::create_window() { + auto *win = new BrowserWindow((const Configuration &)configuration); win->setWindowTitle("null-browser"); - windows.insert({last_id, win}); - last_id++; + auto *router = WindowActionRouter::instance(); + router->add_window(win); win->show(); return win; } @@ -29,7 +27,7 @@ bool BrowserApp::eventFilter(QObject *target, QEvent *event) { if (event->type() != QEvent::KeyPress) return false; - for (auto &match : windows) { + for (const auto &match : WindowActionRouter::instance()->windows()) { auto *win = match.second; if (auto *target_widget = dynamic_cast<QWidget *>(target); |
