mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 04:27:45 +00:00
LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
This commit is contained in:
parent
f0409081f5
commit
c7d891765c
131 changed files with 422 additions and 421 deletions
|
@ -63,7 +63,7 @@ public:
|
|||
continue;
|
||||
Cursor cursor;
|
||||
cursor.path = move(path);
|
||||
cursor.bitmap = Gfx::Bitmap::load_from_file(cursor.path);
|
||||
cursor.bitmap = Gfx::Bitmap::try_load_from_file(cursor.path);
|
||||
auto filename_split = cursor.path.split('/');
|
||||
cursor.name = filename_split[2];
|
||||
m_cursors.append(move(cursor));
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
if (!path.contains("filetype-") && !path.contains("app-"))
|
||||
continue;
|
||||
IconSet icon_set;
|
||||
icon_set.big_icon = Gfx::Bitmap::load_from_file(path);
|
||||
icon_set.big_icon = Gfx::Bitmap::try_load_from_file(path);
|
||||
auto filename_split = path.split('/');
|
||||
icon_set.name = filename_split[3];
|
||||
m_icon_sets.append(move(icon_set));
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
if (!path.contains("filetype-") && !path.contains("app-"))
|
||||
continue;
|
||||
IconSet icon_set;
|
||||
icon_set.little_icon = Gfx::Bitmap::load_from_file(path);
|
||||
icon_set.little_icon = Gfx::Bitmap::try_load_from_file(path);
|
||||
auto filename_split = path.split('/');
|
||||
icon_set.name = filename_split[3];
|
||||
for (size_t i = 0; i < big_icons_found; i++) {
|
||||
|
|
|
@ -71,9 +71,9 @@ GalleryWidget::GalleryWidget()
|
|||
m_label_frame->set_frame_thickness(value);
|
||||
};
|
||||
|
||||
m_button_icons.append(Gfx::Bitmap::load_from_file("/res/icons/16x16/book-open.png"));
|
||||
m_button_icons.append(Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
|
||||
m_button_icons.append(Gfx::Bitmap::load_from_file("/res/icons/16x16/ladybug.png"));
|
||||
m_button_icons.append(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png"));
|
||||
m_button_icons.append(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"));
|
||||
m_button_icons.append(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/ladybug.png"));
|
||||
|
||||
m_icon_button = basics_tab.find_descendant_of_type_named<GUI::Button>("icon_button");
|
||||
m_icon_button->set_icon(*m_button_icons[2]);
|
||||
|
@ -93,7 +93,7 @@ GalleryWidget::GalleryWidget()
|
|||
m_text_editor = basics_tab.find_descendant_of_type_named<GUI::TextEditor>("text_editor");
|
||||
|
||||
m_font_button = basics_tab.find_descendant_of_type_named<GUI::Button>("font_button");
|
||||
m_font_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-font-editor.png"));
|
||||
m_font_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"));
|
||||
|
||||
m_font_button->on_click = [&](auto) {
|
||||
auto picker = GUI::FontPicker::construct(window(), &m_text_editor->font(), false);
|
||||
|
@ -103,7 +103,7 @@ GalleryWidget::GalleryWidget()
|
|||
};
|
||||
|
||||
m_file_button = basics_tab.find_descendant_of_type_named<GUI::Button>("file_button");
|
||||
m_file_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"));
|
||||
m_file_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"));
|
||||
|
||||
m_file_button->on_click = [&](auto) {
|
||||
Optional<String> open_path = GUI::FilePicker::get_open_filepath(window());
|
||||
|
@ -113,7 +113,7 @@ GalleryWidget::GalleryWidget()
|
|||
};
|
||||
|
||||
m_input_button = basics_tab.find_descendant_of_type_named<GUI::Button>("input_button");
|
||||
m_input_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"));
|
||||
m_input_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png"));
|
||||
|
||||
m_input_button->on_click = [&](auto) {
|
||||
String value;
|
||||
|
@ -131,7 +131,7 @@ GalleryWidget::GalleryWidget()
|
|||
};
|
||||
|
||||
m_msgbox_button = basics_tab.find_descendant_of_type_named<GUI::Button>("msgbox_button");
|
||||
m_msgbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-irc-client.png"));
|
||||
m_msgbox_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-irc-client.png"));
|
||||
|
||||
m_msgbox_type = GUI::MessageBox::Type::None;
|
||||
m_msgbox_input_type = GUI::MessageBox::InputType::OK;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue