diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-04-05 13:10:43 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-04-05 13:14:06 +0530 |
| commit | 1d9cd2bcb69ccbccea67166f9d42ec8ff6892fae (patch) | |
| tree | 622d1bb48d35f05b17ef69db1b5919be89b86aab /src/WindowActionRouter.cpp | |
| parent | 2e051fcc4efcfe6af2d3ef22d6a4ba63c9f1c65d (diff) | |
| download | null-browser-1d9cd2bcb69ccbccea67166f9d42ec8ff6892fae.tar.gz null-browser-1d9cd2bcb69ccbccea67166f9d42ec8ff6892fae.zip | |
Connected url changed event
Diffstat (limited to 'src/WindowActionRouter.cpp')
| -rw-r--r-- | src/WindowActionRouter.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/WindowActionRouter.cpp b/src/WindowActionRouter.cpp index 1cc39cb..e1d0664 100644 --- a/src/WindowActionRouter.cpp +++ b/src/WindowActionRouter.cpp @@ -10,19 +10,20 @@ #include "widgets/BrowserWindow.hpp" #include "widgets/WebViewStack.hpp" -void WindowActionRouter::dispatch_event(BrowserEvent &event) { +void WindowActionRouter::dispatch_event(BrowserEvent *event) { auto &runtime = LuaRuntime::instance(); - runtime.queue_task([this, &event]() { - std::unordered_map<std::string, std::vector<EventHandlerRequest>> event_map; + + runtime.queue_task([this, event]() { + std::unordered_map<QString, std::vector<EventHandlerRequest>> event_map; { const std::lock_guard<std::mutex> lock(events_mutex); event_map = events; } - if (!event_map.contains(event.kind)) + if (!event_map.contains(event->kind)) return; - for (auto &event_handler : event_map.at(event.kind)) { + for (auto &event_handler : event_map.at(event->kind)) { // TODO: Pattern filter event_handler.handler(event); } @@ -39,12 +40,6 @@ void WindowActionRouter::register_event(const EventHandlerRequest &event) { } void WindowActionRouter::initialize() { - UrlChangedEvent url_changed_event("https://googa.com", 2, 1); - WindowActionRouter::instance().dispatch_event(url_changed_event); - - UrlChangedEvent url_changed_event_1("https://duckduckgo.com", 5, 1); - WindowActionRouter::instance().dispatch_event(url_changed_event_1); - auto &runtime = LuaRuntime::instance(); connect(&runtime, &LuaRuntime::keymap_added, this, |
