Browser: Load icons at start of program

Previously, Browser loaded icons from the disk every time an icon
was set. In addition to making more calls to the disk and decoding
more images, this makes error propagation impossible. This change
moves all icon loading to the start of the program.
This commit is contained in:
Dylan Katz 2022-01-10 19:06:11 -08:00 committed by Andreas Kling
commit 3919a1dcc0
Notes: sideshowbarker 2024-07-19 17:10:44 +09:00
10 changed files with 101 additions and 35 deletions

View file

@ -8,6 +8,7 @@
#include "ConsoleWidget.h"
#include <AK/StringBuilder.h>
#include <Applications/Browser/Browser.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/TextBox.h>
@ -60,7 +61,7 @@ ConsoleWidget::ConsoleWidget()
auto& clear_button = bottom_container.add<GUI::Button>();
clear_button.set_fixed_size(22, 22);
clear_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png").release_value_but_fixme_should_propagate_errors());
clear_button.set_icon(g_icon_bag.delete_icon);
clear_button.set_tooltip("Clear the console output");
clear_button.on_click = [this](auto) {
clear_output();