1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:17:35 +00:00

ThemeEditor: Make MainWidget responsible for holding the edited Palette

Previously, the PreviewWidget was responsible for this, but we will soon
have multiple preview widgets, so having it here will make more sense.
This commit is contained in:
Sam Atkins 2022-05-10 16:10:15 +01:00 committed by Andreas Kling
parent 48122e29c3
commit f617d72bee
3 changed files with 52 additions and 45 deletions

View file

@ -52,12 +52,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil(nullptr, nullptr));
auto app_icon = GUI::Icon::default_icon("app-theme-editor");
Gfx::Palette startup_preview_palette = file_to_edit ? Gfx::Palette(Gfx::PaletteImpl::create_with_anonymous_buffer(Gfx::load_system_theme(*path))) : app->palette();
auto window = GUI::Window::construct();
auto main_widget = TRY(window->try_set_main_widget<ThemeEditor::MainWidget>(path, startup_preview_palette));
auto main_widget = TRY(window->try_set_main_widget<ThemeEditor::MainWidget>());
if (path.has_value())
main_widget->load_from_file(TRY(Core::File::open(*path, Core::OpenMode::ReadOnly)));
TRY(main_widget->initialize_menubar(window));
main_widget->update_title();