diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-07-25 16:24:20 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-07-25 16:24:20 +0530 |
| commit | 7e3b6182c4581fcb39ab1d0ef2eb07fe9fa1d8b6 (patch) | |
| tree | 13808a26ad4e1f948d7fe0c042a2bdedb2658ee4 /src/widgets/BrowserApp.cpp | |
| parent | 43f3261635e1667367cfd31a2f746832e94c3957 (diff) | |
| download | null-browser-7e3b6182c4581fcb39ab1d0ef2eb07fe9fa1d8b6.tar.gz null-browser-7e3b6182c4581fcb39ab1d0ef2eb07fe9fa1d8b6.zip | |
Remove window mediator class
Diffstat (limited to 'src/widgets/BrowserApp.cpp')
| -rw-r--r-- | src/widgets/BrowserApp.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/widgets/BrowserApp.cpp b/src/widgets/BrowserApp.cpp index 54fd44a..9326d45 100644 --- a/src/widgets/BrowserApp.cpp +++ b/src/widgets/BrowserApp.cpp @@ -35,19 +35,23 @@ BrowserApp::BrowserApp(Configuration &configuration) : configuration(configurati // Initializes profile for (auto *profile : profiles) { - profile->setDownloadPath(configuration.downloads_dir()); - profile->setHttpUserAgent(configuration.user_agent()); - profile->setNotificationPresenter([](std::unique_ptr<QWebEngineNotification> notification) { - auto *event = new NotificationReceivedEvent(std::move(notification)); - WindowActionRouter::instance().dispatch_event(event); - }); - profile->setPersistentPermissionsPolicy(configuration.permission_persistance_policy()); + setup_profile(profile); } connect(&window_action_router, &WindowActionRouter::new_window_requested, this, [this](const QUrl &url) { create_window({url.toString()}); }); }; +void BrowserApp::setup_profile(QWebEngineProfile *profile) { + profile->setDownloadPath(configuration.downloads_dir()); + profile->setHttpUserAgent(configuration.user_agent()); + profile->setNotificationPresenter([](std::unique_ptr<QWebEngineNotification> notification) { + auto *event = new NotificationReceivedEvent(std::move(notification)); + WindowActionRouter::instance().dispatch_event(event); + }); + profile->setPersistentPermissionsPolicy(configuration.permission_persistance_policy()); +} + BrowserWindow *BrowserApp::create_window(const QStringList &urls) { auto *window = new BrowserWindow((const Configuration &)configuration, &default_profile, urls); window->setWindowTitle("null-browser"); |
