From bcecbced7e1af9d99443a7e823f18328c7943f09 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 29 Mar 2025 11:45:18 +0530 Subject: Add window action router for multi-window --- src/widgets/BrowserApp.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/widgets/BrowserApp.cpp') 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 #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(target); -- cgit v1.3.1