1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:27:35 +00:00

AK: Make "foo"_string infallible

Stop worrying about tiny OOMs.

Work towards #20405.
This commit is contained in:
Andreas Kling 2023-08-07 11:12:38 +02:00
parent db2a8725c6
commit 34344120f2
181 changed files with 626 additions and 630 deletions

View file

@ -108,7 +108,7 @@ AutocompleteBox::AutocompleteBox(TextEditor& editor)
apply_suggestion();
};
m_no_suggestions_view = main_widget->add<GUI::Label>("No suggestions"_string.release_value_but_fixme_should_propagate_errors());
m_no_suggestions_view = main_widget->add<GUI::Label>("No suggestions"_string);
}
void AutocompleteBox::update_suggestions(Vector<CodeComprehension::AutocompleteResultEntry>&& suggestions)

View file

@ -218,7 +218,7 @@ void ColorPicker::build_ui()
build_ui_palette(tab_palette);
auto& tab_custom_color = tab_widget.add_tab<Widget>("Custom Color"_string.release_value_but_fixme_should_propagate_errors());
auto& tab_custom_color = tab_widget.add_tab<Widget>("Custom Color"_string);
tab_custom_color.set_layout<VerticalBoxLayout>(4, 4);
build_ui_custom(tab_custom_color);
@ -412,7 +412,7 @@ void ColorPicker::build_ui_custom(Widget& root_container)
make_spinbox(Blue, m_color.blue());
make_spinbox(Alpha, m_color.alpha());
m_selector_button = vertical_container.add<GUI::Button>("Select on Screen"_string.release_value_but_fixme_should_propagate_errors());
m_selector_button = vertical_container.add<GUI::Button>("Select on Screen"_string);
m_selector_button->on_click = [this](auto) {
auto selector = ColorSelectOverlay::construct();
auto original_color = m_color;

View file

@ -28,42 +28,42 @@ NonnullRefPtr<Action> make_about_action(DeprecatedString const& app_name, Icon c
weak_parent)
.release_value_but_fixme_should_propagate_errors();
});
action->set_status_tip("Show application about box"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Show application about box"_string);
return action;
}
NonnullRefPtr<Action> make_open_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Open...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Open an existing file"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Open an existing file"_string);
return action;
}
NonnullRefPtr<Action> make_save_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Save the current file"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Save the current file"_string);
return action;
}
NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Save &As...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Save the current file with a new name"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Save the current file with a new name"_string);
return action;
}
NonnullRefPtr<Action> make_move_to_front_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Move to &Front", { Mod_Ctrl | Mod_Shift, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-front.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move to the top of the stack"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Move to the top of the stack"_string);
return action;
}
NonnullRefPtr<Action> make_move_to_back_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Move to &Back", { Mod_Ctrl | Mod_Shift, Key_Down }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move to the bottom of the stack"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Move to the bottom of the stack"_string);
return action;
}
@ -85,35 +85,35 @@ NonnullRefPtr<Action> make_delete_action(Function<void(Action&)> callback, Core:
NonnullRefPtr<Action> make_cut_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Cu&t", { Mod_Ctrl, Key_X }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-cut.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Cut to clipboard"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Cut to clipboard"_string);
return action;
}
NonnullRefPtr<Action> make_copy_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Copy", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Copy to clipboard"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Copy to clipboard"_string);
return action;
}
NonnullRefPtr<Action> make_paste_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Paste", { Mod_Ctrl, Key_V }, Gfx::Bitmap::load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Paste from clipboard"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Paste from clipboard"_string);
return action;
}
NonnullRefPtr<Action> make_insert_emoji_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Insert Emoji...", { Mod_Ctrl | Mod_Alt, Key_Space }, Gfx::Bitmap::load_from_file("/res/icons/16x16/emoji.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Open the Emoji Picker"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Open the Emoji Picker"_string);
return action;
}
NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Fullscreen", { Mod_None, Key_F11 }, move(callback), parent);
action->set_status_tip("Enter fullscreen mode"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Enter fullscreen mode"_string);
action->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/fullscreen.png"sv).release_value_but_fixme_should_propagate_errors());
return action;
}
@ -121,28 +121,28 @@ NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)> callback, C
NonnullRefPtr<Action> make_quit_action(Function<void(Action&)> callback)
{
auto action = Action::create("&Quit", { Mod_Alt, Key_F4 }, move(callback));
action->set_status_tip("Quit the application"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Quit the application"_string);
return action;
}
NonnullRefPtr<Action> make_help_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Manual", { Mod_None, Key_F1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Show help contents"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Show help contents"_string);
return action;
}
NonnullRefPtr<Action> make_go_back_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Go &Back", { Mod_Alt, Key_Left }, { MouseButton::Backward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move one step backward in history"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Move one step backward in history"_string);
return action;
}
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Go &Forward", { Mod_Alt, Key_Right }, { MouseButton::Forward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move one step forward in history"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Move one step forward in history"_string);
return action;
}
@ -154,7 +154,7 @@ NonnullRefPtr<Action> make_go_home_action(Function<void(Action&)> callback, Core
NonnullRefPtr<Action> make_close_tab_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::load_from_file("/res/icons/16x16/close-tab.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Close current tab"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Close current tab"_string);
return action;
}
@ -214,7 +214,7 @@ NonnullRefPtr<Action> make_command_palette_action(Window* window)
action->flash_menubar_menu(*window);
action->activate();
});
action->set_status_tip("Open the command palette"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Open the command palette"_string);
return action;
}

View file

@ -59,7 +59,7 @@ ErrorOr<NonnullRefPtr<Menu>> make_accessibility_menu(ColorFilterer& filterer)
group->add_action(*achromatomaly_accessibility_action);
(void)group.leak_ptr();
auto menu = TRY(Menu::try_create(TRY("&Accessibility"_string)));
auto menu = TRY(Menu::try_create("&Accessibility"_string));
menu->add_action(default_accessibility_action);
menu->add_action(pratanopia_accessibility_action);
menu->add_action(pratanomaly_accessibility_action);

View file

@ -778,11 +778,11 @@ ErrorOr<String> FileSystemModel::column_name(int column) const
case Column::Permissions:
return "Mode"_short_string;
case Column::ModificationTime:
return TRY("Modified"_string);
return "Modified"_string;
case Column::Inode:
return "Inode"_short_string;
case Column::SymlinkTarget:
return TRY("Symlink target"_string);
return "Symlink target"_string;
}
VERIFY_NOT_REACHED();
}

View file

@ -89,7 +89,7 @@ ErrorOr<Dialog::ExecResult> MessageBox::try_ask_about_unsaved_changes(Window* pa
box->set_icon(parent_window->icon());
if (path.is_empty())
box->m_yes_button->set_text(TRY("Save As..."_string));
box->m_yes_button->set_text("Save As..."_string);
else
box->m_yes_button->set_text("Save"_short_string);
box->m_no_button->set_text("Discard"_short_string);

View file

@ -43,7 +43,7 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(DeprecatedString t
TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 6));
if (show_defaults_button == ShowDefaultsButton::Yes) {
window->m_reset_button = TRY(button_container->try_add<GUI::DialogButton>(TRY("Defaults"_string)));
window->m_reset_button = TRY(button_container->try_add<GUI::DialogButton>("Defaults"_string));
window->m_reset_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) {
window->reset_default_values();
};

View file

@ -171,7 +171,7 @@ ErrorOr<void> Toolbar::create_overflow_objects()
m_overflow_action = Action::create("Overflow Menu", { Mod_Ctrl | Mod_Shift, Key_O }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/overflow-menu.png"sv)), [&](auto&) {
m_overflow_menu->popup(m_overflow_button->screen_relative_rect().bottom_left().moved_up(1), {}, m_overflow_button->rect());
});
m_overflow_action->set_status_tip(TRY("Show hidden toolbar actions"_string));
m_overflow_action->set_status_tip("Show hidden toolbar actions"_string);
m_overflow_action->set_enabled(false);
TRY(add_spacer());