diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-06 16:25:29 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-08 00:35:27 +0100 |
commit | 235f39e449ebffed26114c7166b0b632a3f2232e (patch) | |
tree | 3f61715fe8ba3e801803bde270ca4aeca74fd9f5 /Userland/Applications/SoundPlayer | |
parent | 16f064d9bea97b499843e1a90a545a738d9c35fd (diff) | |
download | serenity-235f39e449ebffed26114c7166b0b632a3f2232e.zip |
LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
Diffstat (limited to 'Userland/Applications/SoundPlayer')
-rw-r--r-- | Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp | 6 | ||||
-rw-r--r-- | Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp | 10 |
2 files changed, 7 insertions, 9 deletions
diff --git a/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp index 04326d0e73..e7a5510ccd 100644 --- a/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp +++ b/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp @@ -20,11 +20,9 @@ void NoVisualizationWidget::paint_event(GUI::PaintEvent& event) Frame::paint_event(event); GUI::Painter painter(*this); - if (m_serenity_bg.is_null()) { - m_serenity_bg = Gfx::Bitmap::try_load_from_file("/res/wallpapers/sunset-retro.png"); - } + if (!m_serenity_bg) + m_serenity_bg = Gfx::Bitmap::try_load_from_file("/res/wallpapers/sunset-retro.png").release_value_but_fixme_should_propagate_errors(); painter.draw_scaled_bitmap(frame_inner_rect(), *m_serenity_bg, m_serenity_bg->rect(), 1.0f); - return; } void NoVisualizationWidget::set_buffer(RefPtr<Audio::Buffer>) diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index 5ac1c80ab2..a66654b364 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -43,11 +43,11 @@ SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window m_player_view->set_layout<GUI::VerticalBoxLayout>(); - m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"); - m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png"); - m_stop_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop.png"); - m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"); - m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"); + m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png").release_value_but_fixme_should_propagate_errors(); + m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png").release_value_but_fixme_should_propagate_errors(); + m_stop_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop.png").release_value_but_fixme_should_propagate_errors(); + m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(); + m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(); m_visualization = m_player_view->add<BarsVisualizationWidget>(); |