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

Userland: Prefer _string over _short_string

As `_string` can't fail anymore (since 3434412), there are no real
benefits to use the short variant in most cases.
This commit is contained in:
Lucas CHOLLET 2023-08-07 22:26:17 -04:00 committed by Andreas Kling
parent a5edc9cdfc
commit 3f35ffb648
198 changed files with 684 additions and 684 deletions

View file

@ -213,7 +213,7 @@ void ColorPicker::build_ui()
auto& tab_widget = root_container->add<GUI::TabWidget>();
auto& tab_palette = tab_widget.add_tab<Widget>("Palette"_short_string);
auto& tab_palette = tab_widget.add_tab<Widget>("Palette"_string);
tab_palette.set_layout<VerticalBoxLayout>(4, 4);
build_ui_palette(tab_palette);
@ -229,7 +229,7 @@ void ColorPicker::build_ui()
button_container.add_spacer().release_value_but_fixme_should_propagate_errors();
auto& ok_button = button_container.add<DialogButton>();
ok_button.set_text("OK"_short_string);
ok_button.set_text("OK"_string);
ok_button.on_click = [this](auto) {
if (on_color_changed)
on_color_changed(m_color);
@ -238,7 +238,7 @@ void ColorPicker::build_ui()
ok_button.set_default(true);
auto& cancel_button = button_container.add<DialogButton>();
cancel_button.set_text("Cancel"_short_string);
cancel_button.set_text("Cancel"_string);
cancel_button.on_click = [this](auto) {
if (on_color_changed)
on_color_changed(m_original_color);
@ -337,7 +337,7 @@ void ColorPicker::build_ui_custom(Widget& root_container)
auto& html_label = html_container.add<GUI::Label>();
html_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
html_label.set_preferred_width(48);
html_label.set_text("HTML:"_short_string);
html_label.set_text("HTML:"_string);
m_html_text = html_container.add<GUI::TextBox>();
m_html_text->set_text(m_color_has_alpha_channel ? m_color.to_deprecated_string() : m_color.to_deprecated_string_without_alpha());
@ -393,16 +393,16 @@ void ColorPicker::build_ui_custom(Widget& root_container)
};
if (component == Red) {
rgb_label.set_text("Red:"_short_string);
rgb_label.set_text("Red:"_string);
m_red_spinbox = spinbox;
} else if (component == Green) {
rgb_label.set_text("Green:"_short_string);
rgb_label.set_text("Green:"_string);
m_green_spinbox = spinbox;
} else if (component == Blue) {
rgb_label.set_text("Blue:"_short_string);
rgb_label.set_text("Blue:"_string);
m_blue_spinbox = spinbox;
} else if (component == Alpha) {
rgb_label.set_text("Alpha:"_short_string);
rgb_label.set_text("Alpha:"_string);
m_alpha_spinbox = spinbox;
}
};

View file

@ -257,7 +257,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
};
auto& cancel_button = *widget->find_descendant_of_type_named<GUI::Button>("cancel_button");
cancel_button.set_text("Cancel"_short_string);
cancel_button.set_text("Cancel"_string);
cancel_button.on_click = [this](auto) {
done(ExecResult::Cancel);
};

View file

@ -62,11 +62,11 @@ private:
case Mode::Open:
case Mode::OpenMultiple:
case Mode::OpenFolder:
return "Open"_short_string;
return "Open"_string;
case Mode::Save:
return "Save"_short_string;
return "Save"_string;
default:
return "OK"_short_string;
return "OK"_string;
}
}

View file

@ -768,19 +768,19 @@ ErrorOr<String> FileSystemModel::column_name(int column) const
case Column::Icon:
return String {};
case Column::Name:
return "Name"_short_string;
return "Name"_string;
case Column::Size:
return "Size"_short_string;
return "Size"_string;
case Column::User:
return "User"_short_string;
return "User"_string;
case Column::Group:
return "Group"_short_string;
return "Group"_string;
case Column::Permissions:
return "Mode"_short_string;
return "Mode"_string;
case Column::ModificationTime:
return "Modified"_string;
case Column::Inode:
return "Inode"_short_string;
return "Inode"_string;
case Column::SymlinkTarget:
return "Symlink target"_string;
}

View file

@ -37,7 +37,7 @@ IncrementalSearchBanner::IncrementalSearchBanner(TextEditor& editor)
};
m_close_button = find_descendant_of_type_named<Button>("incremental_search_banner_close_button");
m_close_button->set_text("\xE2\x9D\x8C"_short_string);
m_close_button->set_text("\xE2\x9D\x8C"_string);
m_close_button->on_click = [this](auto) {
hide();
};

View file

@ -161,7 +161,7 @@ ErrorOr<void> InputBox::build()
TRY(button_container->try_set_layout<HorizontalBoxLayout>(0, 6));
TRY(button_container->add_spacer());
m_ok_button = TRY(button_container->try_add<DialogButton>("OK"_short_string));
m_ok_button = TRY(button_container->try_add<DialogButton>("OK"_string));
m_ok_button->on_click = [this](auto) {
if (m_spinbox)
m_spinbox->set_value_from_current_text();
@ -169,7 +169,7 @@ ErrorOr<void> InputBox::build()
};
m_ok_button->set_default(true);
m_cancel_button = TRY(button_container->try_add<DialogButton>("Cancel"_short_string));
m_cancel_button = TRY(button_container->try_add<DialogButton>("Cancel"_string));
m_cancel_button->on_click = [this](auto) { done(ExecResult::Cancel); };
auto guarantee_width = [this, button_container] {

View file

@ -75,7 +75,7 @@ public:
{
if constexpr (IsTwoDimensional)
return m_column_names[index];
return "Data"_short_string;
return "Data"_string;
}
virtual Variant data(ModelIndex const& index, ModelRole role) const override

View file

@ -91,9 +91,9 @@ ErrorOr<Dialog::ExecResult> MessageBox::try_ask_about_unsaved_changes(Window* pa
if (path.is_empty())
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);
box->m_cancel_button->set_text("Cancel"_short_string);
box->m_yes_button->set_text("Save"_string);
box->m_no_button->set_text("Discard"_string);
box->m_cancel_button->set_text("Cancel"_string);
return box->exec();
}
@ -181,13 +181,13 @@ ErrorOr<void> MessageBox::build()
TRY(button_container->add_spacer());
if (should_include_ok_button())
m_ok_button = TRY(add_button("OK"_short_string, ExecResult::OK));
m_ok_button = TRY(add_button("OK"_string, ExecResult::OK));
if (should_include_yes_button())
m_yes_button = TRY(add_button("Yes"_short_string, ExecResult::Yes));
m_yes_button = TRY(add_button("Yes"_string, ExecResult::Yes));
if (should_include_no_button())
m_no_button = TRY(add_button("No"_short_string, ExecResult::No));
m_no_button = TRY(add_button("No"_string, ExecResult::No));
if (should_include_cancel_button())
m_cancel_button = TRY(add_button("Cancel"_short_string, ExecResult::Cancel));
m_cancel_button = TRY(add_button("Cancel"_string, ExecResult::Cancel));
TRY(button_container->add_spacer());
return {};

View file

@ -61,7 +61,7 @@ ProcessChooser::ProcessChooser(StringView window_title, String button_label, Gfx
auto index = m_table_view->selection().first();
set_pid_from_index_and_close(index);
};
auto& cancel_button = button_container.add<GUI::Button>("Cancel"_short_string);
auto& cancel_button = button_container.add<GUI::Button>("Cancel"_string);
cancel_button.set_fixed_width(80);
cancel_button.on_click = [this](auto) {
done(ExecResult::Cancel);

View file

@ -23,7 +23,7 @@ public:
pid_t pid() const { return m_pid; }
private:
ProcessChooser(StringView window_title = "Process Chooser"sv, String button_label = "Select"_short_string, Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr);
ProcessChooser(StringView window_title = "Process Chooser"sv, String button_label = "Select"_string, Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr);
void set_pid_from_index_and_close(ModelIndex const&);

View file

@ -51,11 +51,11 @@ ErrorOr<String> RunningProcessesModel::column_name(int column_index) const
case Column::Icon:
return String {};
case Column::PID:
return "PID"_short_string;
return "PID"_string;
case Column::UID:
return "UID"_short_string;
return "UID"_string;
case Column::Name:
return "Name"_short_string;
return "Name"_string;
}
VERIFY_NOT_REACHED();
}

View file

@ -51,19 +51,19 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(DeprecatedString t
TRY(button_container->add_spacer());
window->m_ok_button = TRY(button_container->try_add<GUI::DialogButton>("OK"_short_string));
window->m_ok_button = TRY(button_container->try_add<GUI::DialogButton>("OK"_string));
window->m_ok_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) {
window->apply_settings();
GUI::Application::the()->quit();
};
window->m_cancel_button = TRY(button_container->try_add<GUI::DialogButton>("Cancel"_short_string));
window->m_cancel_button = TRY(button_container->try_add<GUI::DialogButton>("Cancel"_string));
window->m_cancel_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) {
window->cancel_settings();
GUI::Application::the()->quit();
};
window->m_apply_button = TRY(button_container->try_add<GUI::DialogButton>("Apply"_short_string));
window->m_apply_button = TRY(button_container->try_add<GUI::DialogButton>("Apply"_string));
window->m_apply_button->set_enabled(false);
window->m_apply_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) {
window->apply_settings();

View file

@ -41,12 +41,12 @@ ErrorOr<void> WizardDialog::build()
nav_container_widget->set_fixed_height(42);
TRY(nav_container_widget->add_spacer());
m_back_button = TRY(nav_container_widget->try_add<DialogButton>("< Back"_short_string));
m_back_button = TRY(nav_container_widget->try_add<DialogButton>("< Back"_string));
m_back_button->on_click = [&](auto) {
pop_page();
};
m_next_button = TRY(nav_container_widget->try_add<DialogButton>("Next >"_short_string));
m_next_button = TRY(nav_container_widget->try_add<DialogButton>("Next >"_string));
m_next_button->on_click = [&](auto) {
VERIFY(has_pages());
@ -63,7 +63,7 @@ ErrorOr<void> WizardDialog::build()
auto button_spacer = TRY(nav_container_widget->try_add<Widget>());
button_spacer->set_fixed_width(10);
m_cancel_button = TRY(nav_container_widget->try_add<DialogButton>("Cancel"_short_string));
m_cancel_button = TRY(nav_container_widget->try_add<DialogButton>("Cancel"_string));
m_cancel_button->on_click = [&](auto) {
handle_cancel();
};
@ -128,11 +128,11 @@ void WizardDialog::update_navigation()
if (has_pages()) {
m_next_button->set_enabled(current_page().is_final_page() || current_page().can_go_next());
if (current_page().is_final_page())
m_next_button->set_text("Finish"_short_string);
m_next_button->set_text("Finish"_string);
else
m_next_button->set_text("Next >"_short_string);
m_next_button->set_text("Next >"_string);
} else {
m_next_button->set_text("Next >"_short_string);
m_next_button->set_text("Next >"_string);
m_next_button->set_enabled(false);
}
}