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

ThemeEditor: Add 'Open file' menu action

This commit is contained in:
Karol Kosek 2021-08-25 22:37:15 +02:00 committed by Andreas Kling
parent f878e4464f
commit 23137f0a8d
3 changed files with 19 additions and 0 deletions

View file

@ -97,6 +97,16 @@ void PreviewWidget::set_preview_palette(const Gfx::Palette& palette)
update();
}
void PreviewWidget::set_theme_from_file(String const& path, int fd)
{
auto file = Core::ConfigFile::open(path, fd);
auto theme = Gfx::load_system_theme(file);
VERIFY(theme.is_valid());
m_preview_palette = Gfx::Palette(Gfx::PaletteImpl::create_with_anonymous_buffer(theme));
set_preview_palette(m_preview_palette);
}
void PreviewWidget::paint_event(GUI::PaintEvent& event)
{
GUI::Frame::paint_event(event);