2020-01-18 05:38:21 -03:00
|
|
|
/*
|
2020-02-26 08:02:25 -03:00
|
|
|
* Copyright (c) 2019-2020, Jesse Buhagiar <jooster669@gmail.com>
|
2021-05-18 17:21:56 -03:00
|
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
2022-04-21 11:12:09 -03:00
|
|
|
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
2020-01-18 05:38:21 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2021-05-19 16:19:09 -03:00
|
|
|
#include "BackgroundSettingsWidget.h"
|
2021-06-30 14:28:16 -03:00
|
|
|
#include "DesktopSettingsWidget.h"
|
2022-08-07 21:02:34 -03:00
|
|
|
#include "EffectsSettingsWidget.h"
|
2021-05-21 13:55:30 -03:00
|
|
|
#include "FontSettingsWidget.h"
|
2021-05-19 16:43:54 -03:00
|
|
|
#include "MonitorSettingsWidget.h"
|
2022-03-27 16:32:32 -03:00
|
|
|
#include "ThemesSettingsWidget.h"
|
2021-08-29 11:05:41 -03:00
|
|
|
#include <LibConfig/Client.h>
|
2022-04-21 11:34:53 -03:00
|
|
|
#include <LibCore/ArgsParser.h>
|
2021-11-27 08:49:54 -03:00
|
|
|
#include <LibCore/System.h>
|
2020-02-06 16:33:02 -03:00
|
|
|
#include <LibGUI/Application.h>
|
2020-11-02 16:30:17 -03:00
|
|
|
#include <LibGUI/Icon.h>
|
2021-11-20 12:28:46 -03:00
|
|
|
#include <LibGUI/SettingsWindow.h>
|
2021-11-27 08:49:54 -03:00
|
|
|
#include <LibMain/Main.h>
|
2019-09-03 08:45:02 -03:00
|
|
|
|
2021-11-27 08:49:54 -03:00
|
|
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
2019-09-03 08:45:02 -03:00
|
|
|
{
|
2022-05-09 20:35:13 -03:00
|
|
|
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath unix proc exec"));
|
2020-01-13 08:22:49 -03:00
|
|
|
|
2021-11-27 08:49:54 -03:00
|
|
|
auto app = TRY(GUI::Application::try_create(arguments));
|
2022-02-11 13:33:09 -03:00
|
|
|
Config::pledge_domain("WindowManager");
|
2020-01-13 08:22:49 -03:00
|
|
|
|
2022-04-21 11:34:53 -03:00
|
|
|
StringView selected_tab;
|
|
|
|
|
Core::ArgsParser args_parser;
|
|
|
|
|
args_parser.add_option(selected_tab, "Tab, one of 'background', 'fonts', 'monitor', 'themes', or 'workspaces'", "open-tab", 't', "tab");
|
|
|
|
|
args_parser.parse(arguments);
|
|
|
|
|
|
2022-07-11 14:32:29 -03:00
|
|
|
auto app_icon = GUI::Icon::default_icon("app-display-settings"sv);
|
2020-11-02 16:30:17 -03:00
|
|
|
|
2022-04-03 06:51:54 -03:00
|
|
|
bool background_settings_changed = false;
|
|
|
|
|
|
2021-11-28 04:34:04 -03:00
|
|
|
auto window = TRY(GUI::SettingsWindow::create("Display Settings"));
|
2022-07-11 14:32:29 -03:00
|
|
|
(void)TRY(window->add_tab<DisplaySettings::BackgroundSettingsWidget>("Background"sv, "background"sv, background_settings_changed));
|
|
|
|
|
(void)TRY(window->add_tab<DisplaySettings::ThemesSettingsWidget>("Themes"sv, "themes"sv, background_settings_changed));
|
|
|
|
|
(void)TRY(window->add_tab<DisplaySettings::FontSettingsWidget>("Fonts"sv, "fonts"sv));
|
|
|
|
|
(void)TRY(window->add_tab<DisplaySettings::MonitorSettingsWidget>("Monitor"sv, "monitor"sv));
|
|
|
|
|
(void)TRY(window->add_tab<DisplaySettings::DesktopSettingsWidget>("Workspaces"sv, "workspaces"sv));
|
2022-08-07 21:02:34 -03:00
|
|
|
(void)TRY(window->add_tab<GUI::DisplaySettings::EffectsSettingsWidget>("Effects"sv, "effects"sv));
|
2022-04-21 11:34:53 -03:00
|
|
|
window->set_active_tab(selected_tab);
|
2019-12-28 10:59:56 -03:00
|
|
|
|
2021-05-18 17:21:56 -03:00
|
|
|
window->set_icon(app_icon.bitmap_for_size(16));
|
2019-12-28 10:59:56 -03:00
|
|
|
|
2019-09-03 08:45:02 -03:00
|
|
|
window->show();
|
2020-07-04 09:05:19 -03:00
|
|
|
return app->exec();
|
2019-09-03 08:45:02 -03:00
|
|
|
}
|