mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:07:34 +00:00
Userland: Construct Menus with name using the non-deprecated String
This commit is contained in:
parent
c4c1df7621
commit
956f4d9205
9 changed files with 15 additions and 21 deletions
|
@ -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("&Accessibility"));
|
||||
auto menu = TRY(Menu::try_create(TRY("&Accessibility"_string)));
|
||||
menu->add_action(default_accessibility_action);
|
||||
menu->add_action(pratanopia_accessibility_action);
|
||||
menu->add_action(pratanomaly_accessibility_action);
|
||||
|
|
|
@ -38,11 +38,6 @@ Menu::Menu(String name)
|
|||
{
|
||||
}
|
||||
|
||||
Menu::Menu(DeprecatedString name)
|
||||
: m_name(String::from_deprecated_string(name).release_value_but_fixme_should_propagate_errors())
|
||||
{
|
||||
}
|
||||
|
||||
Menu::~Menu()
|
||||
{
|
||||
unrealize_menu();
|
||||
|
@ -119,7 +114,7 @@ ErrorOr<NonnullRefPtr<Menu>> Menu::try_add_submenu(DeprecatedString 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(name));
|
||||
auto submenu = TRY(Menu::try_create(TRY(String::from_deprecated_string(name))));
|
||||
|
||||
auto item = TRY(adopt_nonnull_own_or_enomem(new (nothrow) MenuItem(m_menu_id, submenu)));
|
||||
submenu->set_parent(*this, m_items.size());
|
||||
|
|
|
@ -70,7 +70,6 @@ private:
|
|||
friend class Menubar;
|
||||
|
||||
explicit Menu(String name = {});
|
||||
explicit Menu(DeprecatedString name);
|
||||
|
||||
int realize_menu(RefPtr<Action> default_action = nullptr);
|
||||
void unrealize_menu();
|
||||
|
|
|
@ -18,14 +18,14 @@ ErrorOr<void> Menubar::try_add_menu(Badge<Window>, NonnullRefPtr<Menu> menu)
|
|||
|
||||
ErrorOr<NonnullRefPtr<Menu>> Menubar::try_add_menu(Badge<Window>, DeprecatedString name)
|
||||
{
|
||||
auto menu = TRY(try_add<Menu>(move(name)));
|
||||
auto menu = TRY(try_add<Menu>(TRY(String::from_deprecated_string(name))));
|
||||
TRY(m_menus.try_append(menu));
|
||||
return menu;
|
||||
}
|
||||
|
||||
Menu& Menubar::add_menu(Badge<Window>, DeprecatedString name)
|
||||
{
|
||||
auto& menu = add<Menu>(move(name));
|
||||
auto& menu = add<Menu>(String::from_deprecated_string(name).release_value_but_fixme_should_propagate_errors());
|
||||
m_menus.append(menu);
|
||||
return menu;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue