mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +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
|
@ -93,7 +93,7 @@ MainWidget::MainWidget()
|
|||
};
|
||||
m_wrap_around_checkbox->set_checked(true);
|
||||
|
||||
m_find_next_action = GUI::Action::create("Find &Next", { Mod_Ctrl, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find-next.png"), [&](auto&) {
|
||||
m_find_next_action = GUI::Action::create("Find &Next", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png"), [&](auto&) {
|
||||
auto needle = m_find_textbox->text();
|
||||
if (needle.is_empty())
|
||||
return;
|
||||
|
@ -112,7 +112,7 @@ MainWidget::MainWidget()
|
|||
}
|
||||
});
|
||||
|
||||
m_find_previous_action = GUI::Action::create("Find Pr&evious", { Mod_Ctrl | Mod_Shift, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find-previous.png"), [&](auto&) {
|
||||
m_find_previous_action = GUI::Action::create("Find Pr&evious", { Mod_Ctrl | Mod_Shift, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-previous.png"), [&](auto&) {
|
||||
auto needle = m_find_textbox->text();
|
||||
if (needle.is_empty())
|
||||
return;
|
||||
|
@ -173,11 +173,11 @@ MainWidget::MainWidget()
|
|||
|
||||
m_find_previous_button = *find_descendant_of_type_named<GUI::Button>("find_previous_button");
|
||||
m_find_previous_button->set_action(*m_find_previous_action);
|
||||
m_find_previous_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/find-previous.png"));
|
||||
m_find_previous_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-previous.png"));
|
||||
|
||||
m_find_next_button = *find_descendant_of_type_named<GUI::Button>("find_next_button");
|
||||
m_find_next_button->set_action(*m_find_next_action);
|
||||
m_find_next_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/find-next.png"));
|
||||
m_find_next_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find-next.png"));
|
||||
|
||||
m_find_textbox->on_return_pressed = [this] {
|
||||
m_find_next_button->click();
|
||||
|
@ -211,7 +211,7 @@ MainWidget::MainWidget()
|
|||
});
|
||||
m_vim_emulation_setting_action->set_checked(false);
|
||||
|
||||
m_find_replace_action = GUI::Action::create("&Find/Replace...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"), [this](auto&) {
|
||||
m_find_replace_action = GUI::Action::create("&Find/Replace...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"), [this](auto&) {
|
||||
m_find_replace_widget->set_visible(true);
|
||||
m_find_widget->set_visible(true);
|
||||
m_replace_widget->set_visible(true);
|
||||
|
@ -244,7 +244,7 @@ MainWidget::MainWidget()
|
|||
m_editor->on_cursor_change = [this] { update_statusbar(); };
|
||||
m_editor->on_selection_change = [this] { update_statusbar(); };
|
||||
|
||||
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [this](GUI::Action const&) {
|
||||
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"), [this](GUI::Action const&) {
|
||||
if (editor().document().is_modified()) {
|
||||
auto save_document_first_result = GUI::MessageBox::show(window(), "Save changes to current document first?", "Warning", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel);
|
||||
if (save_document_first_result == GUI::Dialog::ExecResult::ExecYes)
|
||||
|
@ -457,7 +457,7 @@ void MainWidget::initialize_menubar(GUI::Menubar& menubar)
|
|||
|
||||
view_menu.add_separator();
|
||||
|
||||
view_menu.add_action(GUI::Action::create("Editor &Font...", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-font-editor.png"),
|
||||
view_menu.add_action(GUI::Action::create("Editor &Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"),
|
||||
[&](auto&) {
|
||||
auto picker = GUI::FontPicker::construct(window(), &m_editor->font(), false);
|
||||
if (picker->exec() == GUI::Dialog::ExecOK) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue