diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-04-12 19:05:24 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-04-12 19:05:24 +0530 |
| commit | c8352009ceb6b9240ef7c1ad5be93f42312b59a2 (patch) | |
| tree | 9f71d00d2a8c5200dde4dd6a3f44354168d9017f /src/WindowActionRouter.cpp | |
| parent | 39b3e8d1e2581a47dff1f09450383df0466dac94 (diff) | |
| download | null-browser-c8352009ceb6b9240ef7c1ad5be93f42312b59a2.tar.gz null-browser-c8352009ceb6b9240ef7c1ad5be93f42312b59a2.zip | |
Switch to using map for configuration
Diffstat (limited to '')
| -rw-r--r-- | src/WindowActionRouter.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/WindowActionRouter.cpp b/src/WindowActionRouter.cpp index 4bac3ad..bba15d1 100644 --- a/src/WindowActionRouter.cpp +++ b/src/WindowActionRouter.cpp @@ -10,11 +10,7 @@ #include "widgets/WebViewStack.hpp" QVariant WindowActionRouter::fetch_config_value(const QString &key) { - if (key == "new_view_url") - return configuration->new_view_url; - if (key == "close_window_when_no_views") - return configuration->close_window_when_no_views; - return ""; + return configuration->get_config(key); } // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -24,15 +20,7 @@ void WindowActionRouter::initialize(Configuration *config) { connect(&runtime, &LuaRuntime::keymap_added, this, &WindowActionRouter::add_keymap); - connect(&runtime, &LuaRuntime::config_updated, this, - [this](const QString &key, const QVariant &value) { - qDebug() << key << value; - if (key == "new_view_url") { - configuration->new_view_url = value.toString(); - } else if (key == "close_window_when_no_views") { - configuration->close_window_when_no_views = value.toBool(); - } - }); + connect(&runtime, &LuaRuntime::config_updated, configuration, &Configuration::set_config); connect(&runtime, &LuaRuntime::history_back_requested, this, [this](WebViewId webview_id, qsizetype history_index) { |
