1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +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

@ -62,7 +62,7 @@ ClockWidget::ClockWidget()
m_prev_date = navigation_container.add<GUI::Button>();
m_prev_date->set_button_style(Gfx::ButtonStyle::Coolbar);
m_prev_date->set_fixed_size(24, 24);
m_prev_date->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"));
m_prev_date->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"));
m_prev_date->on_click = [&](auto) {
unsigned view_month = m_calendar->view_month();
unsigned view_year = m_calendar->view_year();
@ -96,7 +96,7 @@ ClockWidget::ClockWidget()
m_next_date = navigation_container.add<GUI::Button>();
m_next_date->set_button_style(Gfx::ButtonStyle::Coolbar);
m_next_date->set_fixed_size(24, 24);
m_next_date->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"));
m_next_date->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"));
m_next_date->on_click = [&](auto) {
unsigned view_month = m_calendar->view_month();
unsigned view_year = m_calendar->view_year();
@ -146,7 +146,7 @@ ClockWidget::ClockWidget()
m_jump_to_button = settings_container.add<GUI::Button>();
m_jump_to_button->set_button_style(Gfx::ButtonStyle::Coolbar);
m_jump_to_button->set_fixed_size(24, 24);
m_jump_to_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/calendar-date.png"));
m_jump_to_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/calendar-date.png"));
m_jump_to_button->set_tooltip("Jump to today");
m_jump_to_button->on_click = [this](auto) {
jump_to_current_date();
@ -155,7 +155,7 @@ ClockWidget::ClockWidget()
m_calendar_launcher = settings_container.add<GUI::Button>();
m_calendar_launcher->set_button_style(Gfx::ButtonStyle::Coolbar);
m_calendar_launcher->set_fixed_size(24, 24);
m_calendar_launcher->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-calendar.png"));
m_calendar_launcher->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-calendar.png"));
m_calendar_launcher->set_tooltip("Calendar");
m_calendar_launcher->on_click = [](auto) {
pid_t pid;