2021-11-24 19:47:39 +03:00
|
|
|
/*
|
2022-04-21 17:12:09 +03:00
|
|
|
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
2021-11-24 19:47:39 +03:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "BrowserSettingsWidget.h"
|
2022-01-31 23:41:36 +03:00
|
|
|
#include "ContentFilterSettingsWidget.h"
|
2021-11-24 19:47:39 +03:00
|
|
|
#include <LibConfig/Client.h>
|
2022-04-21 17:34:53 +03:00
|
|
|
#include <LibCore/ArgsParser.h>
|
2021-11-24 19:47:39 +03:00
|
|
|
#include <LibCore/System.h>
|
|
|
|
#include <LibGUI/Application.h>
|
|
|
|
#include <LibGUI/Icon.h>
|
|
|
|
#include <LibGUI/SettingsWindow.h>
|
|
|
|
#include <LibMain/Main.h>
|
|
|
|
|
|
|
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
|
|
{
|
2022-01-31 23:41:36 +03:00
|
|
|
TRY(Core::System::pledge("stdio rpath wpath cpath recvfd sendfd unix"));
|
2021-11-24 19:47:39 +03:00
|
|
|
auto app = TRY(GUI::Application::try_create(arguments));
|
2022-02-11 19:33:09 +03:00
|
|
|
Config::pledge_domain("Browser");
|
2021-11-24 19:47:39 +03:00
|
|
|
|
2022-04-21 17:34:53 +03:00
|
|
|
StringView selected_tab;
|
|
|
|
Core::ArgsParser args_parser;
|
|
|
|
args_parser.add_option(selected_tab, "Tab, one of 'browser' or 'content-filtering'", "open-tab", 't', "tab");
|
|
|
|
args_parser.parse(arguments);
|
|
|
|
|
2021-11-24 19:47:39 +03:00
|
|
|
TRY(Core::System::unveil("/res", "r"));
|
2021-11-25 15:26:54 +03:00
|
|
|
TRY(Core::System::unveil("/home", "r"));
|
2022-01-31 23:41:36 +03:00
|
|
|
TRY(Core::System::unveil("/home/anon/.config/BrowserContentFilters.txt", "rwc"));
|
2021-11-24 19:47:39 +03:00
|
|
|
TRY(Core::System::unveil(nullptr, nullptr));
|
|
|
|
|
|
|
|
auto app_icon = GUI::Icon::default_icon("app-browser");
|
|
|
|
|
2021-11-28 10:34:04 +03:00
|
|
|
auto window = TRY(GUI::SettingsWindow::create("Browser Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes));
|
2021-11-24 19:47:39 +03:00
|
|
|
window->set_icon(app_icon.bitmap_for_size(16));
|
2022-04-21 17:12:09 +03:00
|
|
|
(void)TRY(window->add_tab<BrowserSettingsWidget>("Browser", "browser"));
|
|
|
|
(void)TRY(window->add_tab<ContentFilterSettingsWidget>("Content Filtering", "content-filtering"));
|
2022-04-21 17:34:53 +03:00
|
|
|
window->set_active_tab(selected_tab);
|
2021-11-24 19:47:39 +03:00
|
|
|
|
|
|
|
window->show();
|
|
|
|
return app->exec();
|
|
|
|
}
|