mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +00:00
LibGUI: Port AbstractThemePreview::set_theme_from_file to Core::Stream
This commit is contained in:
parent
17012b266c
commit
ca7648b1ae
3 changed files with 5 additions and 5 deletions
|
@ -21,8 +21,8 @@ ThemePreviewWidget::ThemePreviewWidget(Gfx::Palette const& palette)
|
||||||
|
|
||||||
ErrorOr<void> ThemePreviewWidget::set_theme(DeprecatedString path)
|
ErrorOr<void> ThemePreviewWidget::set_theme(DeprecatedString path)
|
||||||
{
|
{
|
||||||
auto config_file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly));
|
auto config_file = TRY(Core::Stream::File::open(path, Core::Stream::OpenMode::Read));
|
||||||
TRY(set_theme_from_file(config_file));
|
TRY(set_theme_from_file(path, move(config_file)));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,9 +85,9 @@ void AbstractThemePreview::set_theme(Core::AnonymousBuffer const& theme_buffer)
|
||||||
set_preview_palette(m_preview_palette);
|
set_preview_palette(m_preview_palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<void> AbstractThemePreview::set_theme_from_file(Core::File& file)
|
ErrorOr<void> AbstractThemePreview::set_theme_from_file(StringView path, NonnullOwnPtr<Core::Stream::File> file)
|
||||||
{
|
{
|
||||||
auto config_file = TRY(Core::ConfigFile::open(file.filename(), file.leak_fd()));
|
auto config_file = TRY(Core::ConfigFile::open(path, move(file)));
|
||||||
auto theme = TRY(Gfx::load_system_theme(config_file));
|
auto theme = TRY(Gfx::load_system_theme(config_file));
|
||||||
|
|
||||||
m_preview_palette = Gfx::Palette(Gfx::PaletteImpl::create_with_anonymous_buffer(theme));
|
m_preview_palette = Gfx::Palette(Gfx::PaletteImpl::create_with_anonymous_buffer(theme));
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
|
|
||||||
Gfx::Palette const& preview_palette() const { return m_preview_palette; }
|
Gfx::Palette const& preview_palette() const { return m_preview_palette; }
|
||||||
void set_preview_palette(Gfx::Palette const&);
|
void set_preview_palette(Gfx::Palette const&);
|
||||||
ErrorOr<void> set_theme_from_file(Core::File&);
|
ErrorOr<void> set_theme_from_file(StringView path, NonnullOwnPtr<Core::Stream::File>);
|
||||||
void set_theme(Core::AnonymousBuffer const&);
|
void set_theme(Core::AnonymousBuffer const&);
|
||||||
|
|
||||||
void paint_window(StringView title, Gfx::IntRect const& rect, Gfx::WindowTheme::WindowState, Gfx::Bitmap const& icon, int button_count = 3);
|
void paint_window(StringView title, Gfx::IntRect const& rect, Gfx::WindowTheme::WindowState, Gfx::Bitmap const& icon, int button_count = 3);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue