1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:28:11 +00:00

LibGfx: Use "try_" prefix for static factory functions

Also mark them as [[nodiscard]].
This commit is contained in:
Andreas Kling 2021-07-21 18:02:15 +02:00
parent f0409081f5
commit c7d891765c
131 changed files with 422 additions and 421 deletions

View file

@ -149,7 +149,7 @@ int main(int argc, char** argv)
disassembly_view.set_model(profile->disassembly_model());
};
auto disassembly_action = GUI::Action::create_checkable("Show &Disassembly", { Mod_Ctrl, Key_D }, Gfx::Bitmap::load_from_file("/res/icons/16x16/x86.png"), [&](auto& action) {
auto disassembly_action = GUI::Action::create_checkable("Show &Disassembly", { Mod_Ctrl, Key_D }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/x86.png"), [&](auto& action) {
disassembly_view.set_visible(action.is_checked());
});
@ -235,7 +235,7 @@ static bool prompt_to_stop_profiling(pid_t pid, const String& process_name)
auto window = GUI::Window::construct();
window->set_title(String::formatted("Profiling {}({})", process_name, pid));
window->resize(240, 100);
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"));
window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"));
window->center_on_screen();
auto& widget = window->set_main_widget<GUI::Widget>();
@ -263,7 +263,7 @@ static bool prompt_to_stop_profiling(pid_t pid, const String& process_name)
bool generate_profile(pid_t& pid)
{
if (!pid) {
auto process_chooser = GUI::ProcessChooser::construct("Profiler", "Profile", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"));
auto process_chooser = GUI::ProcessChooser::construct("Profiler", "Profile", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"));
if (process_chooser->exec() == GUI::Dialog::ExecCancel)
return false;
pid = process_chooser->pid();