diff options
author | Karol Kosek <krkk@serenityos.org> | 2023-04-16 12:20:42 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-19 07:59:54 +0200 |
commit | 51bd9ca037ec31c7fcc811bb3e97f2518d843b98 (patch) | |
tree | 6ddcf1494b59682d55951fffd9877d45d173d414 | |
parent | 969543a847c7792cb5ebe967c44b744bc24fb2cb (diff) | |
download | serenity-51bd9ca037ec31c7fcc811bb3e97f2518d843b98.zip |
LibGUI+Userland: Make Menu::*add_submmenu take name using new string
-rw-r--r-- | Userland/Applications/3DFileViewer/main.cpp | 12 | ||||
-rw-r--r-- | Userland/Applications/Browser/BrowserWindow.cpp | 8 | ||||
-rw-r--r-- | Userland/Applications/FileManager/main.cpp | 4 | ||||
-rw-r--r-- | Userland/Applications/FontEditor/MainWidget.cpp | 4 | ||||
-rw-r--r-- | Userland/Applications/HexEditor/HexEditorWidget.cpp | 4 | ||||
-rw-r--r-- | Userland/Applications/ImageViewer/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/PDFViewer/PDFViewerWidget.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/MainWidget.cpp | 4 | ||||
-rw-r--r-- | Userland/Applications/TextEditor/MainWidget.cpp | 12 | ||||
-rw-r--r-- | Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp | 2 | ||||
-rw-r--r-- | Userland/Demos/Mandelbrot/Mandelbrot.cpp | 2 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 8 | ||||
-rw-r--r-- | Userland/Games/Chess/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Games/GameOfLife/BoardWidget.cpp | 2 | ||||
-rw-r--r-- | Userland/Games/Snake/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Menu.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Menu.h | 4 | ||||
-rw-r--r-- | Userland/Services/Taskbar/main.cpp | 4 |
18 files changed, 42 insertions, 42 deletions
diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index 5cced716e0..0859873dbc 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -395,7 +395,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) window->set_fullscreen(!window->is_fullscreen()); })); - auto& rotation_axis_menu = view_menu.add_submenu("Rotation &Axis"); + auto& rotation_axis_menu = view_menu.add_submenu(TRY("Rotation &Axis"_string)); auto rotation_x_action = GUI::Action::create_checkable("&X", [&widget](auto&) { widget->toggle_rotate_x(); }); @@ -413,7 +413,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) rotation_x_action->set_checked(true); rotation_z_action->set_checked(true); - auto& rotation_speed_menu = view_menu.add_submenu("Rotation &Speed"); + auto& rotation_speed_menu = view_menu.add_submenu(TRY("Rotation &Speed"_string)); GUI::ActionGroup rotation_speed_actions; rotation_speed_actions.set_exclusive(true); @@ -456,7 +456,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) texture_enabled_action->set_checked(true); texture_menu.add_action(texture_enabled_action); - auto& wrap_u_menu = texture_menu.add_submenu("Wrap &S"); + auto& wrap_u_menu = texture_menu.add_submenu("Wrap &S"_short_string); GUI::ActionGroup wrap_s_actions; wrap_s_actions.set_exclusive(true); @@ -480,7 +480,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) wrap_u_repeat_action->set_checked(true); - auto& wrap_t_menu = texture_menu.add_submenu("Wrap &T"); + auto& wrap_t_menu = texture_menu.add_submenu("Wrap &T"_short_string); GUI::ActionGroup wrap_t_actions; wrap_t_actions.set_exclusive(true); @@ -504,7 +504,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) wrap_t_repeat_action->set_checked(true); - auto& texture_scale_menu = texture_menu.add_submenu("S&cale"); + auto& texture_scale_menu = texture_menu.add_submenu("S&cale"_short_string); GUI::ActionGroup texture_scale_actions; texture_scale_actions.set_exclusive(true); @@ -542,7 +542,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) texture_scale_1_action->set_checked(true); - auto& texture_mag_filter_menu = texture_menu.add_submenu("Mag Filter"); + auto& texture_mag_filter_menu = texture_menu.add_submenu(TRY("Mag Filter"_string)); GUI::ActionGroup texture_mag_filter_actions; texture_mag_filter_actions.set_exclusive(true); diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 57b24a4454..b04742e7aa 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -173,7 +173,7 @@ void BrowserWindow::build_menus() view_menu.add_action(WindowActions::the().show_bookmarks_bar_action()); view_menu.add_action(WindowActions::the().vertical_tabs_action()); view_menu.add_separator(); - m_zoom_menu = view_menu.add_submenu("&Zoom"); + m_zoom_menu = view_menu.add_submenu("&Zoom"_short_string); m_zoom_menu->add_action(GUI::CommonActions::make_zoom_in_action( [this](auto&) { auto& tab = active_tab(); @@ -327,7 +327,7 @@ void BrowserWindow::build_menus() dbgln("Failed to open search-engines file: {}", load_search_engines_result.error()); } - auto& color_scheme_menu = settings_menu.add_submenu("&Color Scheme"); + auto& color_scheme_menu = settings_menu.add_submenu("&Color Scheme"_string.release_value_but_fixme_should_propagate_errors()); color_scheme_menu.set_icon(g_icon_bag.color_chooser); { auto current_setting = Web::CSS::preferred_color_scheme_from_string(Config::read_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, "auto"sv)); @@ -413,7 +413,7 @@ void BrowserWindow::build_menus() })); m_user_agent_spoof_actions.set_exclusive(true); - auto& spoof_user_agent_menu = debug_menu.add_submenu("Spoof &User Agent"); + auto& spoof_user_agent_menu = debug_menu.add_submenu("Spoof &User Agent"_string.release_value_but_fixme_should_propagate_errors()); m_disable_user_agent_spoofing = GUI::Action::create_checkable("Disabled", [this](auto&) { active_tab().view().debug_request("spoof-user-agent", Web::default_user_agent); }); @@ -483,7 +483,7 @@ void BrowserWindow::build_menus() ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu) { m_search_engine_actions.set_exclusive(true); - auto& search_engine_menu = settings_menu.add_submenu("&Search Engine"); + auto& search_engine_menu = settings_menu.add_submenu("&Search Engine"_string.release_value_but_fixme_should_propagate_errors()); search_engine_menu.set_icon(g_icon_bag.find); bool search_engine_set = false; diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index b3c18edc4a..466be2b2e4 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -362,7 +362,7 @@ bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView c if (current_file_launch_handlers.size() > 1) { added_open_menu_items = true; - auto& file_open_with_menu = menu->add_submenu("Open with"); + auto& file_open_with_menu = menu->add_submenu("Open with"_string.release_value_but_fixme_should_propagate_errors()); for (auto& handler : current_file_launch_handlers) { if (handler == default_file_handler) continue; @@ -1034,7 +1034,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr show_dotfiles_in_view(show_dotfiles); auto view_menu = TRY(window->try_add_menu("&View"_short_string)); - auto layout_menu = TRY(view_menu->try_add_submenu("&Layout")); + auto layout_menu = TRY(view_menu->try_add_submenu("&Layout"_short_string)); TRY(layout_menu->try_add_action(*layout_toolbar_action)); TRY(layout_menu->try_add_action(*layout_location_action)); TRY(layout_menu->try_add_action(*layout_statusbar_action)); diff --git a/Userland/Applications/FontEditor/MainWidget.cpp b/Userland/Applications/FontEditor/MainWidget.cpp index d1a0d0dc13..97cbeb2f07 100644 --- a/Userland/Applications/FontEditor/MainWidget.cpp +++ b/Userland/Applications/FontEditor/MainWidget.cpp @@ -697,7 +697,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window) TRY(go_menu->try_add_action(*m_go_to_glyph_action)); auto view_menu = TRY(window.try_add_menu("&View"_short_string)); - auto layout_menu = TRY(view_menu->try_add_submenu("&Layout")); + auto layout_menu = TRY(view_menu->try_add_submenu("&Layout"_short_string)); TRY(layout_menu->try_add_action(*m_show_toolbar_action)); TRY(layout_menu->try_add_action(*m_show_statusbar_action)); TRY(layout_menu->try_add_action(*m_show_metadata_action)); @@ -708,7 +708,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window) TRY(view_menu->try_add_action(*m_highlight_modifications_action)); TRY(view_menu->try_add_action(*m_show_system_emoji_action)); TRY(view_menu->try_add_separator()); - auto scale_menu = TRY(view_menu->try_add_submenu("&Scale")); + auto scale_menu = TRY(view_menu->try_add_submenu("&Scale"_short_string)); scale_menu->set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/scale.png"sv))); TRY(scale_menu->try_add_action(*m_scale_five_action)); TRY(scale_menu->try_add_action(*m_scale_ten_action)); diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp index 111312df1a..45330999de 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.cpp +++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp @@ -477,7 +477,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) m_editor->update(); m_bytes_per_row_actions.set_exclusive(true); - auto& bytes_per_row_menu = view_menu.add_submenu("Bytes per &Row"); + auto& bytes_per_row_menu = view_menu.add_submenu("Bytes per &Row"_string.release_value_but_fixme_should_propagate_errors()); for (int i = 8; i <= 32; i += 8) { auto action = GUI::Action::create_checkable(DeprecatedString::number(i), [this, i](auto&) { m_editor->set_bytes_per_row(i); @@ -491,7 +491,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) } m_value_inspector_mode_actions.set_exclusive(true); - auto& inspector_mode_menu = view_menu.add_submenu("Value Inspector &Mode"); + auto& inspector_mode_menu = view_menu.add_submenu("Value Inspector &Mode"_string.release_value_but_fixme_should_propagate_errors()); auto little_endian_mode = GUI::Action::create_checkable("&Little Endian", [&](auto& action) { m_value_inspector_little_endian = action.is_checked(); update_inspector_values(m_editor->selection_start_offset()); diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp index b60e31de43..ae6e7248e5 100644 --- a/Userland/Applications/ImageViewer/main.cpp +++ b/Userland/Applications/ImageViewer/main.cpp @@ -337,7 +337,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(view_menu->try_add_action(zoom_out_action)); TRY(view_menu->try_add_separator()); - auto scaling_mode_menu = TRY(view_menu->try_add_submenu("&Scaling Mode")); + auto scaling_mode_menu = TRY(view_menu->try_add_submenu(TRY("&Scaling Mode"_string))); scaling_mode_menu->set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/scale.png"sv))); auto scaling_mode_group = make<GUI::ActionGroup>(); diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index 54ac99dd69..6b3dc9b412 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -228,7 +228,7 @@ void PDFViewerWidget::initialize_menubar(GUI::Window& window) auto& view_menu = window.add_menu("&View"_short_string); view_menu.add_action(*m_toggle_sidebar_action); view_menu.add_separator(); - auto& view_mode_menu = view_menu.add_submenu("View &Mode"); + auto& view_mode_menu = view_menu.add_submenu("View &Mode"_string.release_value_but_fixme_should_propagate_errors()); view_mode_menu.add_action(*m_page_view_mode_single); view_mode_menu.add_action(*m_page_view_mode_multiple); view_menu.add_separator(); diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index 1285f30d4e..c6f45430c6 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -220,7 +220,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window) TRY(file_menu->try_add_action(*m_save_image_action)); TRY(file_menu->try_add_action(*m_save_image_as_action)); - m_export_submenu = TRY(file_menu->try_add_submenu("&Export")); + m_export_submenu = TRY(file_menu->try_add_submenu("&Export"_short_string)); TRY(m_export_submenu->try_add_action( GUI::Action::create( @@ -589,7 +589,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window) vectorscope_action->set_checked(Config::read_bool("PixelPaint"sv, "Scopes"sv, "ShowVectorscope"sv, false)); m_vectorscope_widget->parent_widget()->set_visible(vectorscope_action->is_checked()); - auto scopes_menu = TRY(m_view_menu->try_add_submenu("&Scopes")); + auto scopes_menu = TRY(m_view_menu->try_add_submenu("&Scopes"_short_string)); TRY(scopes_menu->try_add_action(histogram_action)); TRY(scopes_menu->try_add_action(vectorscope_action)); diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index 9f1ea8e3b1..8345400a3b 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -466,7 +466,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) m_editor->set_ruler_visible(show_ruler); auto& view_menu = window.add_menu("&View"_short_string); - auto& layout_menu = view_menu.add_submenu("&Layout"); + auto& layout_menu = view_menu.add_submenu("&Layout"_short_string); layout_menu.add_action(*m_layout_toolbar_action); layout_menu.add_action(*m_layout_statusbar_action); layout_menu.add_action(*m_layout_ruler_action); @@ -486,7 +486,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) view_menu.add_separator(); m_wrapping_mode_actions.set_exclusive(true); - auto& wrapping_mode_menu = view_menu.add_submenu("&Wrapping Mode"); + auto& wrapping_mode_menu = view_menu.add_submenu("&Wrapping Mode"_string.release_value_but_fixme_should_propagate_errors()); m_no_wrapping_action = GUI::Action::create_checkable("&No Wrapping", [&](auto&) { m_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::NoWrap); Config::write_string("TextEditor"sv, "View"sv, "WrappingMode"sv, "None"sv); @@ -521,7 +521,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) } m_soft_tab_width_actions.set_exclusive(true); - auto& soft_tab_width_menu = view_menu.add_submenu("&Tab Width"); + auto& soft_tab_width_menu = view_menu.add_submenu("&Tab Width"_string.release_value_but_fixme_should_propagate_errors()); m_soft_tab_1_width_action = GUI::Action::create_checkable("1", [&](auto&) { m_editor->set_soft_tab_width(1); }); @@ -599,7 +599,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) syntax_actions.set_exclusive(true); - auto& syntax_menu = view_menu.add_submenu("&Syntax"); + auto& syntax_menu = view_menu.add_submenu("&Syntax"_short_string); m_plain_text_highlight = GUI::Action::create_checkable("&Plain Text", [&](auto&) { m_statusbar->set_text(1, "Plain Text"); m_editor->set_syntax_highlighter({}); @@ -694,12 +694,12 @@ void MainWidget::initialize_menubar(GUI::Window& window) })); help_menu.add_action(GUI::CommonActions::make_about_action("Text Editor", GUI::Icon::default_icon("app-text-editor"sv), &window)); - auto& wrapping_statusbar_menu = m_line_column_statusbar_menu->add_submenu("&Wrapping Mode"); + auto& wrapping_statusbar_menu = m_line_column_statusbar_menu->add_submenu("&Wrapping Mode"_string.release_value_but_fixme_should_propagate_errors()); wrapping_statusbar_menu.add_action(*m_no_wrapping_action); wrapping_statusbar_menu.add_action(*m_wrap_anywhere_action); wrapping_statusbar_menu.add_action(*m_wrap_at_words_action); - auto& tab_width_statusbar_menu = m_line_column_statusbar_menu->add_submenu("&Tab Width"); + auto& tab_width_statusbar_menu = m_line_column_statusbar_menu->add_submenu("&Tab Width"_string.release_value_but_fixme_should_propagate_errors()); tab_width_statusbar_menu.add_action(*m_soft_tab_1_width_action); tab_width_statusbar_menu.add_action(*m_soft_tab_2_width_action); tab_width_statusbar_menu.add_action(*m_soft_tab_4_width_action); diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp index 1f68285f3e..70e99f4ab3 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp @@ -376,7 +376,7 @@ ErrorOr<void> VideoPlayerWidget::initialize_menubar(GUI::Window& window) auto view_menu = TRY(window.try_add_menu("&View"_short_string)); TRY(view_menu->try_add_action(*m_toggle_fullscreen_action)); - auto sizing_mode_menu = TRY(view_menu->try_add_submenu("&Sizing mode")); + auto sizing_mode_menu = TRY(view_menu->try_add_submenu(TRY("&Sizing mode"_string))); sizing_mode_menu->set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/fit-image-to-view.png"sv))); m_sizing_mode_group = make<GUI::ActionGroup>(); diff --git a/Userland/Demos/Mandelbrot/Mandelbrot.cpp b/Userland/Demos/Mandelbrot/Mandelbrot.cpp index 5d38b1f46d..197c235579 100644 --- a/Userland/Demos/Mandelbrot/Mandelbrot.cpp +++ b/Userland/Demos/Mandelbrot/Mandelbrot.cpp @@ -415,7 +415,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto file_menu = TRY(window->try_add_menu("&File"_short_string)); - auto& export_submenu = file_menu->add_submenu("&Export"); + auto& export_submenu = file_menu->add_submenu("&Export"_short_string); TRY(export_submenu.try_add_action(GUI::Action::create("As &BMP", [&](GUI::Action&) { diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index ef22ed01ff..02fcc289c5 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -497,7 +497,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> HackStudioWidget::create_project_tree_view_con }); auto project_tree_view_context_menu = GUI::Menu::construct(TRY("Project Files"_string)); - auto& new_file_submenu = project_tree_view_context_menu->add_submenu("N&ew..."); + auto& new_file_submenu = project_tree_view_context_menu->add_submenu("N&ew..."_short_string); for (auto& new_file_action : m_new_file_actions) { new_file_submenu.add_action(new_file_action); } @@ -1411,7 +1411,7 @@ ErrorOr<void> HackStudioWidget::create_file_menu(GUI::Window& window) { auto& file_menu = window.add_menu("&File"_short_string); - auto& new_submenu = file_menu.add_submenu("&New..."); + auto& new_submenu = file_menu.add_submenu("&New..."_short_string); new_submenu.add_action(*m_new_project_action); new_submenu.add_separator(); for (auto& new_file_action : m_new_file_actions) { @@ -1427,7 +1427,7 @@ ErrorOr<void> HackStudioWidget::create_file_menu(GUI::Window& window) new_submenu.add_action(*m_new_directory_action); file_menu.add_action(*m_open_action); - m_recent_projects_submenu = &file_menu.add_submenu("Open &Recent"); + m_recent_projects_submenu = &file_menu.add_submenu(TRY("Open &Recent"_string)); { auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/open-recent.png"sv)); m_recent_projects_submenu->set_icon(icon); @@ -1504,7 +1504,7 @@ ErrorOr<void> HackStudioWidget::create_view_menu(GUI::Window& window) view_menu.add_separator(); m_wrapping_mode_actions.set_exclusive(true); - auto& wrapping_mode_menu = view_menu.add_submenu("&Wrapping Mode"); + auto& wrapping_mode_menu = view_menu.add_submenu(TRY("&Wrapping Mode"_string)); m_no_wrapping_action = GUI::Action::create_checkable("&No Wrapping", [&](auto&) { m_wrapping_mode = GUI::TextEditor::WrappingMode::NoWrap; for (auto& wrapper : m_all_editor_wrappers) diff --git a/Userland/Games/Chess/main.cpp b/Userland/Games/Chess/main.cpp index 08b40b3dbe..f777277598 100644 --- a/Userland/Games/Chess/main.cpp +++ b/Userland/Games/Chess/main.cpp @@ -127,7 +127,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) GUI::ActionGroup engines_action_group; engines_action_group.set_exclusive(true); - auto engine_submenu = TRY(engine_menu->try_add_submenu("&Engine")); + auto engine_submenu = TRY(engine_menu->try_add_submenu("&Engine"_short_string)); for (auto const& engine : { "Human", "ChessEngine" }) { auto action = GUI::Action::create_checkable(engine, [&](auto& action) { if (action.text() == "Human") { diff --git a/Userland/Games/GameOfLife/BoardWidget.cpp b/Userland/Games/GameOfLife/BoardWidget.cpp index 0dc944f050..ae8729a22c 100644 --- a/Userland/Games/GameOfLife/BoardWidget.cpp +++ b/Userland/Games/GameOfLife/BoardWidget.cpp @@ -186,7 +186,7 @@ void BoardWidget::context_menu_event(GUI::ContextMenuEvent& event) if (!m_context_menu) { m_context_menu = GUI::Menu::construct(); - auto& insert_pattern_menu = m_context_menu->add_submenu("&Insert Pattern"); + auto& insert_pattern_menu = m_context_menu->add_submenu("&Insert Pattern"_string.release_value_but_fixme_should_propagate_errors()); for_each_pattern([&](auto& pattern) { if (pattern.action()) insert_pattern_menu.add_action(*pattern.action()); diff --git a/Userland/Games/Snake/main.cpp b/Userland/Games/Snake/main.cpp index 8a9cef6b74..7a9c422ff2 100644 --- a/Userland/Games/Snake/main.cpp +++ b/Userland/Games/Snake/main.cpp @@ -116,7 +116,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) GUI::ActionGroup skin_action_group; skin_action_group.set_exclusive(true); - auto skin_menu = TRY(game_menu->try_add_submenu("&Skin")); + auto skin_menu = TRY(game_menu->try_add_submenu("&Skin"_short_string)); skin_menu->set_icon(app_icon.bitmap_for_size(16)); auto add_skin_action = [&](StringView name, bool enable_color) -> ErrorOr<void> { diff --git a/Userland/Libraries/LibGUI/Menu.cpp b/Userland/Libraries/LibGUI/Menu.cpp index f35e0d4fe6..49374c98c2 100644 --- a/Userland/Libraries/LibGUI/Menu.cpp +++ b/Userland/Libraries/LibGUI/Menu.cpp @@ -104,12 +104,12 @@ void Menu::set_parent(Menu& menu, int submenu_index) m_index_in_parent_menu = submenu_index; } -ErrorOr<NonnullRefPtr<Menu>> Menu::try_add_submenu(DeprecatedString name) +ErrorOr<NonnullRefPtr<Menu>> Menu::try_add_submenu(String name) { // NOTE: We grow the vector first, to get allocation failure handled immediately. TRY(m_items.try_ensure_capacity(m_items.size() + 1)); - auto submenu = TRY(Menu::try_create(TRY(String::from_deprecated_string(name)))); + auto submenu = TRY(Menu::try_create(move(name))); auto item = TRY(adopt_nonnull_own_or_enomem(new (nothrow) MenuItem(m_menu_id, submenu))); submenu->set_parent(*this, m_items.size()); @@ -121,7 +121,7 @@ ErrorOr<NonnullRefPtr<Menu>> Menu::try_add_submenu(DeprecatedString name) return submenu; } -Menu& Menu::add_submenu(DeprecatedString name) +Menu& Menu::add_submenu(String name) { auto menu = MUST(try_add_submenu(move(name))); return menu; diff --git a/Userland/Libraries/LibGUI/Menu.h b/Userland/Libraries/LibGUI/Menu.h index 8e4d9a268d..9ac12e3dd8 100644 --- a/Userland/Libraries/LibGUI/Menu.h +++ b/Userland/Libraries/LibGUI/Menu.h @@ -43,11 +43,11 @@ public: ErrorOr<void> try_add_action(NonnullRefPtr<Action>); ErrorOr<void> try_add_separator(); - ErrorOr<NonnullRefPtr<Menu>> try_add_submenu(DeprecatedString name); + ErrorOr<NonnullRefPtr<Menu>> try_add_submenu(String name); void add_action(NonnullRefPtr<Action>); void add_separator(); - Menu& add_submenu(DeprecatedString name); + Menu& add_submenu(String name); void remove_all_actions(); ErrorOr<void> add_recent_files_list(Function<void(Action&)>); diff --git a/Userland/Services/Taskbar/main.cpp b/Userland/Services/Taskbar/main.cpp index e64b3559c3..099b53fbc8 100644 --- a/Userland/Services/Taskbar/main.cpp +++ b/Userland/Services/Taskbar/main.cpp @@ -151,7 +151,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window) VERIFY(parent_menu); } } - auto& category_menu = parent_menu->add_submenu(child_category); + auto& category_menu = parent_menu->add_submenu(String::from_deprecated_string(child_category).release_value_but_fixme_should_propagate_errors()); auto category_icon_path = category_icons->read_entry("16x16", category); if (!category_icon_path.is_empty()) { auto icon_or_error = Gfx::Bitmap::load_from_file(category_icon_path); @@ -205,7 +205,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window) g_themes_group.set_exclusive(true); g_themes_group.set_unchecking_allowed(false); - g_themes_menu = &system_menu->add_submenu("&Themes"); + g_themes_menu = &system_menu->add_submenu("&Themes"_short_string); g_themes_menu->set_icon(TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/themes.png"sv))); g_themes = TRY(Gfx::list_installed_system_themes()); |