diff options
Diffstat (limited to '')
| -rw-r--r-- | src/WindowActionRouter.cpp | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/src/WindowActionRouter.cpp b/src/WindowActionRouter.cpp index 7270855..3e8d99e 100644 --- a/src/WindowActionRouter.cpp +++ b/src/WindowActionRouter.cpp @@ -4,7 +4,6 @@ #include "LuaRuntime.hpp" #include "WindowActionRouter.hpp" -#include "WindowMediator.hpp" #include "keymap/KeymapEvaluator.hpp" #include "widgets/BrowserWindow.hpp" #include "widgets/WebViewStack.hpp" @@ -27,43 +26,42 @@ void WindowActionRouter::initialize(Configuration *config) { connect(configuration, &Configuration::user_agent_updated, this, [this](const QString &user_agent) { for (auto &win_match : window_map) - win_match.second->mediator()->update_user_agent(user_agent); + win_match.second->update_user_agent(user_agent); }); connect(configuration, &Configuration::downloads_dir_updated, this, [this](const QString &downloads_dir) { for (auto &win_match : window_map) - win_match.second->mediator()->update_downloads_dir(downloads_dir); + win_match.second->update_downloads_dir(downloads_dir); }); connect(configuration, &Configuration::permissions_persistance_updated, this, [this](const QString &persistance) { for (auto &win_match : window_map) - win_match.second->mediator()->update_permissions_persistance(persistance); + win_match.second->update_permissions_persistance(persistance); }); // History connect(&runtime, &LuaRuntime::history_back_requested, this, [this](WebViewId webview_id, qsizetype history_index) { WITH_WEBVIEW_WINDOW(webview_id, window, - { window->mediator()->history_back(webview_id, history_index); }); + { window->history_back(webview_id, history_index); }); }); connect(&runtime, &LuaRuntime::history_forward_requested, this, [this](WebViewId webview_id, qsizetype history_index) { - WITH_WEBVIEW_WINDOW(webview_id, window, { - window->mediator()->history_forward(webview_id, history_index); - }); + WITH_WEBVIEW_WINDOW(webview_id, window, + { window->history_forward(webview_id, history_index); }); }); // Webview action connect(&runtime, &LuaRuntime::url_opened, this, [this](const QString &url, OpenType open_type, WebViewId webview_id) { WITH_WEBVIEW_WINDOW(webview_id, window, - { window->mediator()->open_url(url, open_type, webview_id); }); + { window->open_url(url, open_type, webview_id); }); }); connect(&runtime, &LuaRuntime::webview_closed, this, [this](WebViewId webview_id) { - WITH_WEBVIEW_WINDOW(webview_id, window, { window->mediator()->close_webview(webview_id); }); + WITH_WEBVIEW_WINDOW(webview_id, window, { window->close_webview(webview_id); }); }); connect(&runtime, &LuaRuntime::webview_selected, this, [this](WebViewId webview_id) { - WITH_WEBVIEW_WINDOW(webview_id, window, { window->mediator()->select_webview(webview_id); }); + WITH_WEBVIEW_WINDOW(webview_id, window, { window->select_webview(webview_id); }); }); // Search @@ -79,29 +77,27 @@ void WindowActionRouter::initialize(Configuration *config) { // Devtools connect(&runtime, &LuaRuntime::devtools_requested, this, [this](WebViewId webview_id) { - WITH_WEBVIEW_WINDOW(webview_id, window, - { win_match.second->mediator()->open_devtools(webview_id); }) + WITH_WEBVIEW_WINDOW(webview_id, window, { win_match.second->open_devtools(webview_id); }) }); // Scroll connect(&runtime, &LuaRuntime::webview_scroll_requested, this, [this](WebViewId webview_id, int deltax, int deltay) { WITH_WEBVIEW_WINDOW(webview_id, window, - { window->mediator()->scroll(webview_id, deltax, deltay); }); + { window->scroll(webview_id, deltax, deltay); }); }); connect(&runtime, &LuaRuntime::webview_scroll_top_requested, this, [this](WebViewId webview_id) { - WITH_WEBVIEW_WINDOW(webview_id, window, { window->mediator()->scroll_to_top(webview_id); }); + WITH_WEBVIEW_WINDOW(webview_id, window, { window->scroll_to_top(webview_id); }); }); connect(&runtime, &LuaRuntime::webview_scroll_bottom_requested, this, [this](WebViewId webview_id) { - WITH_WEBVIEW_WINDOW(webview_id, window, - { window->mediator()->scroll_to_bottom(webview_id); }); + WITH_WEBVIEW_WINDOW(webview_id, window, { window->scroll_to_bottom(webview_id); }); }); } void WindowActionRouter::find_current_search_text(WebViewId webview_id, bool forward) { WITH_WEBVIEW_WINDOW(webview_id, window, { - win_match.second->mediator()->set_search_text(current_search_text, webview_id, forward); + win_match.second->set_search_text(current_search_text, webview_id, forward); }) } @@ -122,9 +118,8 @@ void WindowActionRouter::add_window(BrowserWindow *window) { window_map.erase(window->get_id()); }); }); - connect(window->mediator(), &WindowMediator::close_window_requested, window, - [window]() { window->close(); }); - connect(window->mediator(), &WindowMediator::new_window_requested, this, + connect(window, &BrowserWindow::close_window_requested, window, [window]() { window->close(); }); + connect(window, &BrowserWindow::new_window_requested, this, &WindowActionRouter::new_window_requested); } @@ -142,7 +137,7 @@ WebViewId WindowActionRouter::fetch_current_view_id(WindowId win_id) { auto *win = pair.second; auto is_current_window = win_id == win->get_id() || (win_id == 0 && win->isActiveWindow()); if (is_current_window) { - return win->mediator()->current_webview_id(); + return win->current_webview_id(); } } return 0; @@ -154,7 +149,7 @@ QList<WebViewData> WindowActionRouter::fetch_webview_data_list(WindowId win_id) auto *win = pair.second; auto is_current_window = win_id == win->get_id() || (win_id == 0 && win->isActiveWindow()); if (is_current_window) { - return win->mediator()->get_webview_list(); + return win->get_webview_list(); } } return {}; |
