LibGUI+Userland: Port Action status tips to String

This commit is contained in:
Karol Kosek 2023-06-04 11:22:04 +02:00 committed by Sam Atkins
parent 4b169cf25f
commit 5234a30731
16 changed files with 86 additions and 85 deletions

View file

@ -214,9 +214,9 @@ void BrowserWindow::build_menus()
m_go_back_action = GUI::CommonActions::make_go_back_action([this](auto&) { active_tab().go_back(); }, this);
m_go_forward_action = GUI::CommonActions::make_go_forward_action([this](auto&) { active_tab().go_forward(); }, this);
m_go_home_action = GUI::CommonActions::make_go_home_action([this](auto&) { active_tab().load(Browser::url_from_user_input(g_home_url)); }, this);
m_go_home_action->set_status_tip("Go to home page");
m_go_home_action->set_status_tip("Go to home page"_string.release_value_but_fixme_should_propagate_errors());
m_reload_action = GUI::CommonActions::make_reload_action([this](auto&) { active_tab().reload(); }, this);
m_reload_action->set_status_tip("Reload current page");
m_reload_action->set_status_tip("Reload current page"_string.release_value_but_fixme_should_propagate_errors());
auto& go_menu = add_menu("&Go"_short_string);
go_menu.add_action(*m_go_back_action);
@ -241,21 +241,21 @@ void BrowserWindow::build_menus()
active_tab().view().get_source();
},
this);
m_view_source_action->set_status_tip("View source code of the current page");
m_view_source_action->set_status_tip("View source code of the current page"_string.release_value_but_fixme_should_propagate_errors());
m_inspect_dom_tree_action = GUI::Action::create(
"Inspect &DOM Tree", { Mod_None, Key_F12 }, g_icon_bag.dom_tree, [this](auto&) {
active_tab().show_inspector_window(Tab::InspectorTarget::Document);
},
this);
m_inspect_dom_tree_action->set_status_tip("Open inspector window for this page");
m_inspect_dom_tree_action->set_status_tip("Open inspector window for this page"_string.release_value_but_fixme_should_propagate_errors());
m_inspect_dom_node_action = GUI::Action::create(
"&Inspect Element", g_icon_bag.inspect, [this](auto&) {
active_tab().show_inspector_window(Tab::InspectorTarget::HoveredElement);
},
this);
m_inspect_dom_node_action->set_status_tip("Open inspector for this element");
m_inspect_dom_node_action->set_status_tip("Open inspector for this element"_string.release_value_but_fixme_should_propagate_errors());
auto& inspect_menu = add_menu("&Inspect"_string.release_value_but_fixme_should_propagate_errors());
inspect_menu.add_action(*m_view_source_action);
@ -266,7 +266,7 @@ void BrowserWindow::build_menus()
active_tab().show_console_window();
},
this);
js_console_action->set_status_tip("Open JavaScript console for this page");
js_console_action->set_status_tip("Open JavaScript console for this page"_string.release_value_but_fixme_should_propagate_errors());
inspect_menu.add_action(js_console_action);
auto storage_window_action = GUI::Action::create(
@ -274,7 +274,7 @@ void BrowserWindow::build_menus()
active_tab().show_storage_inspector();
},
this);
storage_window_action->set_status_tip("Show Storage inspector for this page");
storage_window_action->set_status_tip("Show Storage inspector for this page"_string.release_value_but_fixme_should_propagate_errors());
inspect_menu.add_action(storage_window_action);
auto history_window_action = GUI::Action::create(
@ -282,7 +282,7 @@ void BrowserWindow::build_menus()
active_tab().show_history_inspector();
},
this);
storage_window_action->set_status_tip("Show History inspector for this tab");
storage_window_action->set_status_tip("Show History inspector for this tab"_string.release_value_but_fixme_should_propagate_errors());
inspect_menu.add_action(history_window_action);
auto& settings_menu = add_menu("&Settings"_string.release_value_but_fixme_should_propagate_errors());
@ -403,26 +403,26 @@ void BrowserWindow::build_menus()
m_disable_user_agent_spoofing = GUI::Action::create_checkable("Disabled", [this](auto&) {
active_tab().view().debug_request("spoof-user-agent", Web::default_user_agent);
});
m_disable_user_agent_spoofing->set_status_tip(Web::default_user_agent);
m_disable_user_agent_spoofing->set_status_tip(String::from_utf8(Web::default_user_agent).release_value_but_fixme_should_propagate_errors());
spoof_user_agent_menu.add_action(*m_disable_user_agent_spoofing);
spoof_user_agent_menu.set_icon(g_icon_bag.spoof);
m_user_agent_spoof_actions.add_action(*m_disable_user_agent_spoofing);
m_disable_user_agent_spoofing->set_checked(true);
auto add_user_agent = [this, &spoof_user_agent_menu](auto& name, auto& user_agent) {
auto add_user_agent = [this, &spoof_user_agent_menu](auto& name, auto user_agent) {
auto action = GUI::Action::create_checkable(name, [this, user_agent](auto&) {
active_tab().view().debug_request("spoof-user-agent", user_agent);
});
action->set_status_tip(user_agent);
action->set_status_tip(String::from_utf8(user_agent).release_value_but_fixme_should_propagate_errors());
spoof_user_agent_menu.add_action(action);
m_user_agent_spoof_actions.add_action(action);
};
add_user_agent("Chrome Linux Desktop", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36");
add_user_agent("Firefox Linux Desktop", "Mozilla/5.0 (X11; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0");
add_user_agent("Safari macOS Desktop", "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15");
add_user_agent("Chrome Android Mobile", "Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.66 Mobile Safari/537.36");
add_user_agent("Firefox Android Mobile", "Mozilla/5.0 (Android 11; Mobile; rv:68.0) Gecko/68.0 Firefox/86.0");
add_user_agent("Safari iOS Mobile", "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1");
add_user_agent("Chrome Linux Desktop", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36"sv);
add_user_agent("Firefox Linux Desktop", "Mozilla/5.0 (X11; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0"sv);
add_user_agent("Safari macOS Desktop", "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15"sv);
add_user_agent("Chrome Android Mobile", "Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.66 Mobile Safari/537.36"sv);
add_user_agent("Firefox Android Mobile", "Mozilla/5.0 (Android 11; Mobile; rv:68.0) Gecko/68.0 Firefox/86.0"sv);
add_user_agent("Safari iOS Mobile", "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1"sv);
auto custom_user_agent = GUI::Action::create_checkable("Custom...", [this](auto& action) {
String user_agent;
@ -431,7 +431,7 @@ void BrowserWindow::build_menus()
return;
}
active_tab().view().debug_request("spoof-user-agent", user_agent.to_deprecated_string());
action.set_status_tip(user_agent.to_deprecated_string());
action.set_status_tip(user_agent);
});
spoof_user_agent_menu.add_action(custom_user_agent);
m_user_agent_spoof_actions.add_action(custom_user_agent);
@ -510,7 +510,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
action->set_checked(true);
search_engine_set = true;
}
action->set_status_tip(url_format);
action->set_status_tip(TRY(String::from_deprecated_string(url_format)));
}
}
}
@ -531,14 +531,14 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
g_search_engine = search_engine.to_deprecated_string();
Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, g_search_engine);
action.set_status_tip(search_engine.to_deprecated_string());
action.set_status_tip(search_engine);
});
search_engine_menu.add_action(custom_search_engine_action);
m_search_engine_actions.add_action(custom_search_engine_action);
if (!search_engine_set && !g_search_engine.is_empty()) {
custom_search_engine_action->set_checked(true);
custom_search_engine_action->set_status_tip(g_search_engine);
custom_search_engine_action->set_status_tip(TRY(String::from_deprecated_string(g_search_engine)));
}
return {};

View file

@ -562,7 +562,7 @@ Tab::Tab(BrowserWindow& window)
}
},
this);
take_visible_screenshot_action->set_status_tip("Save a screenshot of the visible portion of the current tab to the Downloads directory"sv);
take_visible_screenshot_action->set_status_tip("Save a screenshot of the visible portion of the current tab to the Downloads directory"_string.release_value_but_fixme_should_propagate_errors());
auto take_full_screenshot_action = GUI::Action::create(
"Take &Full Screenshot"sv, g_icon_bag.filetype_image, [this](auto&) {
@ -572,7 +572,7 @@ Tab::Tab(BrowserWindow& window)
}
},
this);
take_full_screenshot_action->set_status_tip("Save a screenshot of the entirety of the current tab to the Downloads directory"sv);
take_full_screenshot_action->set_status_tip("Save a screenshot of the entirety of the current tab to the Downloads directory"_string.release_value_but_fixme_should_propagate_errors());
m_page_context_menu = GUI::Menu::construct();
m_page_context_menu->add_action(window.go_back_action());

View file

@ -31,7 +31,7 @@ WindowActions::WindowActions(GUI::Window& window)
on_create_new_tab();
},
&window);
m_create_new_tab_action->set_status_tip("Open a new tab");
m_create_new_tab_action->set_status_tip("Open a new tab"_string.release_value_but_fixme_should_propagate_errors());
m_create_new_window_action = GUI::Action::create(
"&New Window", { Mod_Ctrl, Key_N }, g_icon_bag.new_window, [this](auto&) {
@ -40,7 +40,7 @@ WindowActions::WindowActions(GUI::Window& window)
}
},
&window);
m_create_new_window_action->set_status_tip("Open a new browser window");
m_create_new_window_action->set_status_tip("Open a new browser window"_string.release_value_but_fixme_should_propagate_errors());
m_next_tab_action = GUI::Action::create(
"&Next Tab", { Mod_Ctrl, Key_PageDown }, [this](auto&) {
@ -48,7 +48,7 @@ WindowActions::WindowActions(GUI::Window& window)
on_next_tab();
},
&window);
m_next_tab_action->set_status_tip("Switch to the next tab");
m_next_tab_action->set_status_tip("Switch to the next tab"_string.release_value_but_fixme_should_propagate_errors());
m_previous_tab_action = GUI::Action::create(
"&Previous Tab", { Mod_Ctrl, Key_PageUp }, [this](auto&) {
@ -56,7 +56,7 @@ WindowActions::WindowActions(GUI::Window& window)
on_previous_tab();
},
&window);
m_previous_tab_action->set_status_tip("Switch to the previous tab");
m_previous_tab_action->set_status_tip("Switch to the previous tab"_string.release_value_but_fixme_should_propagate_errors());
for (auto i = 0; i <= 7; ++i) {
m_tab_actions.append(GUI::Action::create(
@ -65,7 +65,7 @@ WindowActions::WindowActions(GUI::Window& window)
on_tabs[i]();
},
&window));
m_tab_actions.last()->set_status_tip(DeprecatedString::formatted("Switch to tab {}", i + 1));
m_tab_actions.last()->set_status_tip(String::formatted("Switch to tab {}", i + 1).release_value_but_fixme_should_propagate_errors());
}
m_tab_actions.append(GUI::Action::create(
"Last tab", { Mod_Ctrl, Key_9 }, [this](auto&) {
@ -73,7 +73,7 @@ WindowActions::WindowActions(GUI::Window& window)
on_tabs[8]();
},
&window));
m_tab_actions.last()->set_status_tip("Switch to last tab");
m_tab_actions.last()->set_status_tip("Switch to last tab"_string.release_value_but_fixme_should_propagate_errors());
m_about_action = GUI::CommonActions::make_about_action("Ladybird", GUI::Icon::default_icon("app-browser"sv), &window);
@ -84,7 +84,7 @@ WindowActions::WindowActions(GUI::Window& window)
on_show_bookmarks_bar(action);
},
&window);
m_show_bookmarks_bar_action->set_status_tip("Show/hide the bookmarks bar");
m_show_bookmarks_bar_action->set_status_tip("Show/hide the bookmarks bar"_string.release_value_but_fixme_should_propagate_errors());
m_vertical_tabs_action = GUI::Action::create_checkable(
"&Vertical Tabs", { Mod_Ctrl, Key_Comma },
@ -93,7 +93,7 @@ WindowActions::WindowActions(GUI::Window& window)
on_vertical_tabs(action);
},
&window);
m_vertical_tabs_action->set_status_tip("Enable/Disable vertical tabs");
m_vertical_tabs_action->set_status_tip("Enable/Disable vertical tabs"_string.release_value_but_fixme_should_propagate_errors());
}
}

View file

@ -56,17 +56,17 @@ CharacterMapWidget::CharacterMapWidget()
}
GUI::Clipboard::the().set_plain_text(builder.to_deprecated_string());
});
m_copy_selection_action->set_status_tip("Copy the highlighted characters to the clipboard");
m_copy_selection_action->set_status_tip("Copy the highlighted characters to the clipboard"_string.release_value_but_fixme_should_propagate_errors());
m_previous_glyph_action = GUI::Action::create("&Previous Glyph", { Mod_Alt, Key_Left }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_glyph_map->select_previous_existing_glyph();
});
m_previous_glyph_action->set_status_tip("Seek the previous visible glyph");
m_previous_glyph_action->set_status_tip("Seek the previous visible glyph"_string.release_value_but_fixme_should_propagate_errors());
m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_glyph_map->select_next_existing_glyph();
});
m_next_glyph_action->set_status_tip("Seek the next visible glyph");
m_next_glyph_action->set_status_tip("Seek the next visible glyph"_string.release_value_but_fixme_should_propagate_errors());
m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
String input;
@ -81,7 +81,7 @@ CharacterMapWidget::CharacterMapWidget()
m_glyph_map->scroll_to_glyph(code_point);
}
});
m_go_to_glyph_action->set_status_tip("Go to the specified code point");
m_go_to_glyph_action->set_status_tip("Go to the specified code point"_string.release_value_but_fixme_should_propagate_errors());
m_find_glyphs_action = GUI::Action::create("&Find Glyphs...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
if (m_find_window.is_null()) {

View file

@ -128,7 +128,7 @@ ErrorOr<void> MainWidget::create_actions()
if (auto result = initialize({}, move(maybe_font.value())); result.is_error())
show_error(result.release_error(), "Initializing new font failed"sv);
});
m_new_action->set_status_tip("Create a new font");
m_new_action->set_status_tip(TRY("Create a new font"_string));
m_open_action = GUI::CommonActions::make_open_action([this](auto&) {
if (!request_close())
@ -221,7 +221,7 @@ ErrorOr<void> MainWidget::create_actions()
if (m_font_preview_window)
m_font_preview_window->show();
});
m_open_preview_action->set_status_tip("Preview the current font");
m_open_preview_action->set_status_tip(TRY("Preview the current font"_string));
bool show_metadata = Config::read_bool("FontEditor"sv, "Layout"sv, "ShowMetadata"sv, true);
m_font_metadata_groupbox->set_visible(show_metadata);
@ -230,7 +230,7 @@ ErrorOr<void> MainWidget::create_actions()
Config::write_bool("FontEditor"sv, "Layout"sv, "ShowMetadata"sv, action.is_checked());
});
m_show_metadata_action->set_checked(show_metadata);
m_show_metadata_action->set_status_tip("Show or hide metadata about the current font");
m_show_metadata_action->set_status_tip(TRY("Show or hide metadata about the current font"_string));
bool show_unicode_blocks = Config::read_bool("FontEditor"sv, "Layout"sv, "ShowUnicodeBlocks"sv, true);
m_unicode_block_container->set_visible(show_unicode_blocks);
@ -243,7 +243,7 @@ ErrorOr<void> MainWidget::create_actions()
Config::write_bool("FontEditor"sv, "Layout"sv, "ShowUnicodeBlocks"sv, action.is_checked());
});
m_show_unicode_blocks_action->set_checked(show_unicode_blocks);
m_show_unicode_blocks_action->set_status_tip("Show or hide the Unicode block list");
m_show_unicode_blocks_action->set_status_tip(TRY("Show or hide the Unicode block list"_string));
bool show_toolbar = Config::read_bool("FontEditor"sv, "Layout"sv, "ShowToolbar"sv, true);
m_toolbar_container->set_visible(show_toolbar);
@ -252,7 +252,7 @@ ErrorOr<void> MainWidget::create_actions()
Config::write_bool("FontEditor"sv, "Layout"sv, "ShowToolbar"sv, action.is_checked());
});
m_show_toolbar_action->set_checked(show_toolbar);
m_show_toolbar_action->set_status_tip("Show or hide the toolbar");
m_show_toolbar_action->set_status_tip(TRY("Show or hide the toolbar"_string));
bool show_statusbar = Config::read_bool("FontEditor"sv, "Layout"sv, "ShowStatusbar"sv, true);
m_statusbar->set_visible(show_statusbar);
@ -262,7 +262,7 @@ ErrorOr<void> MainWidget::create_actions()
Config::write_bool("FontEditor"sv, "Layout"sv, "ShowStatusbar"sv, action.is_checked());
});
m_show_statusbar_action->set_checked(show_statusbar);
m_show_statusbar_action->set_status_tip("Show or hide the status bar");
m_show_statusbar_action->set_status_tip(TRY("Show or hide the status bar"_string));
bool highlight_modifications = Config::read_bool("FontEditor"sv, "GlyphMap"sv, "HighlightModifications"sv, true);
m_glyph_map_widget->set_highlight_modifications(highlight_modifications);
@ -271,7 +271,7 @@ ErrorOr<void> MainWidget::create_actions()
Config::write_bool("FontEditor"sv, "GlyphMap"sv, "HighlightModifications"sv, action.is_checked());
});
m_highlight_modifications_action->set_checked(highlight_modifications);
m_highlight_modifications_action->set_status_tip("Show or hide highlights on modified glyphs");
m_highlight_modifications_action->set_status_tip(TRY("Show or hide highlights on modified glyphs"_string));
bool show_system_emoji = Config::read_bool("FontEditor"sv, "GlyphMap"sv, "ShowSystemEmoji"sv, true);
m_glyph_map_widget->set_show_system_emoji(show_system_emoji);
@ -280,7 +280,7 @@ ErrorOr<void> MainWidget::create_actions()
Config::write_bool("FontEditor"sv, "GlyphMap"sv, "ShowSystemEmoji"sv, action.is_checked());
});
m_show_system_emoji_action->set_checked(show_system_emoji);
m_show_system_emoji_action->set_status_tip("Show or hide system emoji");
m_show_system_emoji_action->set_status_tip(TRY("Show or hide system emoji"_string));
m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, g_resources.go_to_glyph, [this](auto&) {
String input;
@ -296,17 +296,17 @@ ErrorOr<void> MainWidget::create_actions()
m_glyph_map_widget->scroll_to_glyph(code_point);
}
});
m_go_to_glyph_action->set_status_tip("Go to the specified code point");
m_go_to_glyph_action->set_status_tip(TRY("Go to the specified code point"_string));
m_previous_glyph_action = GUI::Action::create("Pre&vious Glyph", { Mod_Alt, Key_Left }, g_resources.previous_glyph, [this](auto&) {
m_glyph_map_widget->select_previous_existing_glyph();
});
m_previous_glyph_action->set_status_tip("Seek the previous visible glyph");
m_previous_glyph_action->set_status_tip(TRY("Seek the previous visible glyph"_string));
m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, g_resources.next_glyph, [this](auto&) {
m_glyph_map_widget->select_next_existing_glyph();
});
m_next_glyph_action->set_status_tip("Seek the next visible glyph");
m_next_glyph_action->set_status_tip(TRY("Seek the next visible glyph"_string));
i32 scale = Config::read_i32("FontEditor"sv, "GlyphEditor"sv, "Scale"sv, 10);
m_glyph_editor_widget->set_scale(scale);
@ -314,17 +314,17 @@ ErrorOr<void> MainWidget::create_actions()
set_scale_and_save(5);
});
m_scale_five_action->set_checked(scale == 5);
m_scale_five_action->set_status_tip("Scale the editor in proportion to the current font");
m_scale_five_action->set_status_tip(TRY("Scale the editor in proportion to the current font"_string));
m_scale_ten_action = GUI::Action::create_checkable("1000%", { Mod_Ctrl, Key_2 }, [this](auto&) {
set_scale_and_save(10);
});
m_scale_ten_action->set_checked(scale == 10);
m_scale_ten_action->set_status_tip("Scale the editor in proportion to the current font");
m_scale_ten_action->set_status_tip(TRY("Scale the editor in proportion to the current font"_string));
m_scale_fifteen_action = GUI::Action::create_checkable("1500%", { Mod_Ctrl, Key_3 }, [this](auto&) {
set_scale_and_save(15);
});
m_scale_fifteen_action->set_checked(scale == 15);
m_scale_fifteen_action->set_status_tip("Scale the editor in proportion to the current font");
m_scale_fifteen_action->set_status_tip(TRY("Scale the editor in proportion to the current font"_string));
m_glyph_editor_scale_actions.add_action(*m_scale_five_action);
m_glyph_editor_scale_actions.add_action(*m_scale_ten_action);
@ -370,7 +370,7 @@ ErrorOr<void> MainWidget::create_actions()
}
GUI::Clipboard::the().set_plain_text(builder.to_deprecated_string());
});
m_copy_text_action->set_status_tip("Copy to clipboard as text");
m_copy_text_action->set_status_tip(TRY("Copy to clipboard as text"_string));
return {};
}

View file

@ -79,7 +79,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto auto_modifier_action = GUI::Action::create("Auto-Modifier", [&](auto& act) {
keyboard_mapper_widget->set_automatic_modifier(act.is_checked());
});
auto_modifier_action->set_status_tip("Toggle automatic modifier");
auto_modifier_action->set_status_tip(TRY("Toggle automatic modifier"_string));
auto_modifier_action->set_checkable(true);
auto_modifier_action->set_checked(false);

View file

@ -323,12 +323,12 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar)
m_page_view_mode_single = GUI::Action::create_checkable("Single", [&](auto&) {
m_viewer->set_page_view_mode(PDFViewer::PageViewMode::Single);
});
m_page_view_mode_single->set_status_tip("Show single page at a time");
m_page_view_mode_single->set_status_tip("Show single page at a time"_string.release_value_but_fixme_should_propagate_errors());
m_page_view_mode_multiple = GUI::Action::create_checkable("Multiple", [&](auto&) {
m_viewer->set_page_view_mode(PDFViewer::PageViewMode::Multiple);
});
m_page_view_mode_multiple->set_status_tip("Show multiple pages at a time");
m_page_view_mode_multiple->set_status_tip("Show multiple pages at a time"_string.release_value_but_fixme_should_propagate_errors());
if (m_viewer->page_view_mode() == PDFViewer::PageViewMode::Single) {
m_page_view_mode_single->set_checked(true);

View file

@ -455,7 +455,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Config::write_i32("SystemMonitor"sv, "Monitor"sv, "Frequency"sv, seconds);
refresh_timer->restart(seconds * 1000);
});
action->set_status_tip(DeprecatedString::formatted("Refresh every {} seconds", seconds));
action->set_status_tip(TRY(String::formatted("Refresh every {} seconds", seconds)));
action->set_checked(frequency == seconds);
frequency_action_group.add_action(*action);
TRY(frequency_menu->try_add_action(*action));

View file

@ -317,7 +317,7 @@ MainWidget::MainWidget()
Desktop::Launcher::open(URL::create_with_file_scheme(lexical_path.dirname(), lexical_path.basename()));
});
m_open_folder_action->set_enabled(!m_path.is_empty());
m_open_folder_action->set_status_tip("Open the current file location in File Manager");
m_open_folder_action->set_status_tip("Open the current file location in File Manager"_string.release_value_but_fixme_should_propagate_errors());
m_toolbar->add_action(*m_new_action);
m_toolbar->add_action(*m_open_action);
@ -557,8 +557,8 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
});
m_visualize_trailing_whitespace_action->set_checked(true);
m_visualize_trailing_whitespace_action->set_status_tip("Visualize trailing whitespace");
m_visualize_leading_whitespace_action->set_status_tip("Visualize leading whitespace");
m_visualize_trailing_whitespace_action->set_status_tip(TRY("Visualize trailing whitespace"_string));
m_visualize_leading_whitespace_action->set_status_tip(TRY("Visualize leading whitespace"_string));
TRY(view_menu->try_add_action(*m_visualize_trailing_whitespace_action));
TRY(view_menu->try_add_action(*m_visualize_leading_whitespace_action));
@ -568,7 +568,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
});
m_cursor_line_highlighting_action->set_checked(true);
m_cursor_line_highlighting_action->set_status_tip("Highlight the current line");
m_cursor_line_highlighting_action->set_status_tip(TRY("Highlight the current line"_string));
TRY(view_menu->try_add_action(*m_cursor_line_highlighting_action));
@ -581,7 +581,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
m_relative_line_number_action->set_checked(show_relative_line_number);
m_editor->set_relative_line_number(show_relative_line_number);
m_relative_line_number_action->set_status_tip("Set relative line number");
m_relative_line_number_action->set_status_tip(TRY("Set relative line number"_string));
TRY(view_menu->try_add_action(*m_relative_line_number_action));

View file

@ -144,7 +144,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
GUI::Process::spawn_or_show_error(window, "/bin/GamesSettings"sv, Array { "--open-tab", "chess" });
},
window);
settings_action->set_status_tip("Open the Game Settings for Chess");
settings_action->set_status_tip(TRY("Open the Game Settings for Chess"_string));
TRY(game_menu->try_add_action(settings_action));
auto show_available_moves_action = GUI::Action::create_checkable("Show Available Moves", [&](auto& action) {

View file

@ -176,7 +176,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
game.setup(mode);
});
single_card_draw_action->set_checked(mode == Solitaire::Mode::SingleCardDraw);
single_card_draw_action->set_status_tip("Draw one card at a time");
single_card_draw_action->set_status_tip(TRY("Draw one card at a time"_string));
draw_setting_actions.add_action(single_card_draw_action);
auto three_card_draw_action = GUI::Action::create_checkable("&Three Card Draw", [&](auto&) {
@ -189,7 +189,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
game.setup(mode);
});
three_card_draw_action->set_checked(mode == Solitaire::Mode::ThreeCardDraw);
three_card_draw_action->set_status_tip("Draw three cards at a time");
three_card_draw_action->set_status_tip(TRY("Draw three cards at a time"_string));
draw_setting_actions.add_action(three_card_draw_action);
game.set_auto_collect(Config::read_bool("Solitaire"sv, "Settings"sv, "AutoCollect"sv, false));
@ -199,7 +199,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Config::write_bool("Solitaire"sv, "Settings"sv, "AutoCollect"sv, checked);
});
toggle_auto_collect_action->set_checked(game.is_auto_collecting());
toggle_auto_collect_action->set_status_tip("Auto-collect to foundation piles");
toggle_auto_collect_action->set_status_tip(TRY("Auto-collect to foundation piles"_string));
auto game_menu = TRY(window->try_add_menu("&Game"_short_string));

View file

@ -23,7 +23,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> make_cards_settings_action(GUI::Window* pare
GUI::Process::spawn_or_show_error(parent, "/bin/GamesSettings"sv, Array { "--open-tab", "cards" });
},
parent);
action->set_status_tip("Open the Game Settings for Cards");
action->set_status_tip(TRY("Open the Game Settings for Cards"_string));
return action;
}

View file

@ -318,7 +318,7 @@ void Action::set_tooltip(DeprecatedString tooltip)
DeprecatedString Action::status_tip() const
{
if (!m_status_tip.is_empty())
return m_status_tip;
return m_status_tip.to_deprecated_string();
return Gfx::parse_ampersand_string(m_text);
}

View file

@ -12,6 +12,7 @@
#include <AK/HashTable.h>
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <AK/WeakPtr.h>
#include <AK/Weakable.h>
#include <LibCore/Object.h>
@ -89,7 +90,7 @@ public:
void set_tooltip(DeprecatedString);
DeprecatedString status_tip() const;
void set_status_tip(DeprecatedString status_tip) { m_status_tip = move(status_tip); }
void set_status_tip(String status_tip) { m_status_tip = move(status_tip); }
Shortcut const& shortcut() const { return m_shortcut; }
Shortcut const& alternate_shortcut() const { return m_alternate_shortcut; }
@ -150,7 +151,7 @@ private:
DeprecatedString m_text;
Optional<DeprecatedString> m_tooltip;
DeprecatedString m_status_tip;
String m_status_tip;
RefPtr<Gfx::Bitmap const> m_icon;
Shortcut m_shortcut;
Shortcut m_alternate_shortcut;

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");
action->set_status_tip("Show application about box"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_open_action(Function<void(Action&)> callback, Core::Object* 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");
action->set_status_tip("Open an existing file"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_save_action(Function<void(Action&)> callback, Core::Object* 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");
action->set_status_tip("Save the current file"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)> callback, Core::Object* 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");
action->set_status_tip("Save the current file with a new name"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_move_to_front_action(Function<void(Action&)> callback, Core::Object* 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");
action->set_status_tip("Move to the top of the stack"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_move_to_back_action(Function<void(Action&)> callback, Core::Object* 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");
action->set_status_tip("Move to the bottom of the stack"_string.release_value_but_fixme_should_propagate_errors());
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::Object* 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");
action->set_status_tip("Cut to clipboard"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_copy_action(Function<void(Action&)> callback, Core::Object* 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");
action->set_status_tip("Copy to clipboard"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_paste_action(Function<void(Action&)> callback, Core::Object* 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");
action->set_status_tip("Paste from clipboard"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_insert_emoji_action(Function<void(Action&)> callback, Core::Object* 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");
action->set_status_tip("Open the Emoji Picker"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("&Fullscreen", { Mod_None, Key_F11 }, move(callback), parent);
action->set_status_tip("Enter fullscreen mode");
action->set_status_tip("Enter fullscreen mode"_string.release_value_but_fixme_should_propagate_errors());
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");
action->set_status_tip("Quit the application"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_help_action(Function<void(Action&)> callback, Core::Object* 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");
action->set_status_tip("Show help contents"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_go_back_action(Function<void(Action&)> callback, Core::Object* 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");
action->set_status_tip("Move one step backward in history"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)> callback, Core::Object* 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");
action->set_status_tip("Move one step forward in history"_string.release_value_but_fixme_should_propagate_errors());
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::Object* 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");
action->set_status_tip("Close current tab"_string.release_value_but_fixme_should_propagate_errors());
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");
action->set_status_tip("Open the command palette"_string.release_value_but_fixme_should_propagate_errors());
return action;
}

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("Show hidden toolbar actions");
m_overflow_action->set_status_tip(TRY("Show hidden toolbar actions"_string));
m_overflow_action->set_enabled(false);
TRY(add_spacer());