mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:27:45 +00:00
LibGUI+Userland: Port Labels to String
This commit is contained in:
parent
3d53dc8228
commit
91bafc2653
92 changed files with 240 additions and 242 deletions
|
@ -147,7 +147,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget()
|
|||
size_container->set_fixed_height(20);
|
||||
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"));
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string));
|
||||
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
size_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -167,7 +167,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget()
|
|||
hardness_container->set_fixed_height(20);
|
||||
(void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"));
|
||||
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string)));
|
||||
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
hardness_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ ErrorOr<GUI::Widget*> BucketTool::get_properties_widget()
|
|||
threshold_container->set_fixed_height(20);
|
||||
(void)TRY(threshold_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto threshold_label = TRY(threshold_container->try_add<GUI::Label>("Threshold:"));
|
||||
auto threshold_label = TRY(threshold_container->try_add<GUI::Label>(TRY("Threshold:"_string)));
|
||||
threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
threshold_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget()
|
|||
size_container->set_fixed_height(20);
|
||||
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"));
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string));
|
||||
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
size_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -154,7 +154,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget()
|
|||
hardness_container->set_fixed_height(20);
|
||||
(void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"));
|
||||
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string)));
|
||||
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
hardness_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
|
|||
thickness_container->set_fixed_height(20);
|
||||
(void)TRY(thickness_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto thickness_label = TRY(thickness_container->try_add<GUI::Label>("Thickness:"));
|
||||
auto thickness_label = TRY(thickness_container->try_add<GUI::Label>(TRY("Thickness:"_string)));
|
||||
thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
thickness_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -152,7 +152,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
|
|||
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
mode_container->set_fixed_height(70);
|
||||
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"));
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"_short_string));
|
||||
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
||||
auto mode_radio_container = TRY(mode_container->try_add<GUI::Widget>());
|
||||
|
@ -180,7 +180,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
|
|||
aspect_container->set_fixed_height(20);
|
||||
(void)TRY(aspect_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto aspect_label = TRY(aspect_container->try_add<GUI::Label>("Aspect Ratio:"));
|
||||
auto aspect_label = TRY(aspect_container->try_add<GUI::Label>(TRY("Aspect Ratio:"_string)));
|
||||
aspect_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
aspect_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -197,7 +197,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
|
|||
}
|
||||
};
|
||||
|
||||
auto multiply_label = TRY(aspect_container->try_add<GUI::Label>("x"));
|
||||
auto multiply_label = TRY(aspect_container->try_add<GUI::Label>("x"_short_string));
|
||||
multiply_label->set_text_alignment(Gfx::TextAlignment::Center);
|
||||
multiply_label->set_fixed_size(10, 20);
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
|
|||
size_container->set_fixed_height(20);
|
||||
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"));
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string));
|
||||
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
size_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -81,7 +81,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
|
|||
hardness_container->set_fixed_height(20);
|
||||
(void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"));
|
||||
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string)));
|
||||
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
hardness_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -108,7 +108,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
|
|||
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
mode_container->set_fixed_height(46);
|
||||
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Draw Mode:"));
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>(TRY("Draw Mode:"_string)));
|
||||
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
mode_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
|
|||
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
mode_container->set_fixed_height(20);
|
||||
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Gradient Type:"));
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>(TRY("Gradient Type:"_string)));
|
||||
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
mode_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -236,7 +236,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
|
|||
size_container->set_fixed_height(20);
|
||||
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>("Opacity:"));
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>(TRY("Opacity:"_string)));
|
||||
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
size_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -270,7 +270,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
|
|||
hardness_container->set_visible(m_mode == GradientMode::Radial);
|
||||
};
|
||||
|
||||
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"));
|
||||
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string)));
|
||||
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
||||
auto hardness_slider = TRY(hardness_container->try_add<GUI::HorizontalOpacitySlider>());
|
||||
|
|
|
@ -186,7 +186,7 @@ ErrorOr<GUI::Widget*> GuideTool::get_properties_widget()
|
|||
snapping_container->set_fixed_height(20);
|
||||
(void)TRY(snapping_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto snapping_label = TRY(snapping_container->try_add<GUI::Label>("Snap offset:"));
|
||||
auto snapping_label = TRY(snapping_container->try_add<GUI::Label>(TRY("Snap offset:"_string)));
|
||||
snapping_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
snapping_label->set_fixed_size(80, 20);
|
||||
snapping_label->set_tooltip("Press Shift to snap");
|
||||
|
|
|
@ -185,7 +185,7 @@ ErrorOr<GUI::Widget*> LassoSelectTool::get_properties_widget()
|
|||
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>());
|
||||
mode_label->set_text("Mode:");
|
||||
mode_label->set_text("Mode:"_short_string);
|
||||
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
mode_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget()
|
|||
thickness_container->set_fixed_height(20);
|
||||
(void)TRY(thickness_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto thickness_label = TRY(thickness_container->try_add<GUI::Label>("Thickness:"));
|
||||
auto thickness_label = TRY(thickness_container->try_add<GUI::Label>(TRY("Thickness:"_string)));
|
||||
thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
thickness_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -146,7 +146,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget()
|
|||
mode_container->set_fixed_height(20);
|
||||
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"));
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"_short_string));
|
||||
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
mode_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ ErrorOr<GUI::Widget*> MoveTool::get_properties_widget()
|
|||
auto selection_mode_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
(void)TRY(selection_mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
selection_mode_container->set_fixed_height(46);
|
||||
auto selection_mode_label = TRY(selection_mode_container->try_add<GUI::Label>("Selection Mode:"));
|
||||
auto selection_mode_label = TRY(selection_mode_container->try_add<GUI::Label>(TRY("Selection Mode:"_string)));
|
||||
selection_mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
selection_mode_label->set_fixed_size(80, 40);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ ErrorOr<GUI::Widget*> PenTool::get_properties_widget()
|
|||
size_container->set_fixed_height(20);
|
||||
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>("Thickness:"));
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>(TRY("Thickness:"_string)));
|
||||
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
size_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ ErrorOr<GUI::Widget*> PolygonalSelectTool::get_properties_widget()
|
|||
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>());
|
||||
mode_label->set_text("Mode:");
|
||||
mode_label->set_text("Mode:"_short_string);
|
||||
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
mode_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ ErrorOr<GUI::Widget*> RectangleSelectTool::get_properties_widget()
|
|||
(void)TRY(feather_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto feather_label = TRY(feather_container->try_add<GUI::Label>());
|
||||
feather_label->set_text("Feather:");
|
||||
feather_label->set_text(TRY("Feather:"_string));
|
||||
feather_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
feather_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -180,7 +180,7 @@ ErrorOr<GUI::Widget*> RectangleSelectTool::get_properties_widget()
|
|||
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>());
|
||||
mode_label->set_text("Mode:");
|
||||
mode_label->set_text("Mode:"_short_string);
|
||||
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
mode_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
|
@ -165,14 +165,14 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
|
|||
|
||||
auto update_slider = [this, thickness_or_radius_label, thickness_or_radius_slider] {
|
||||
auto update_values = [&](auto label, int value, int range_min, int range_max = 10) {
|
||||
thickness_or_radius_label->set_text(label);
|
||||
thickness_or_radius_label->set_text(String::from_utf8(label).release_value_but_fixme_should_propagate_errors());
|
||||
thickness_or_radius_slider->set_range(range_min, range_max);
|
||||
thickness_or_radius_slider->set_value(value);
|
||||
};
|
||||
if (m_fill_mode == FillMode::RoundedCorners)
|
||||
update_values("Radius:", m_corner_radius, 0, 50);
|
||||
update_values("Radius:"sv, m_corner_radius, 0, 50);
|
||||
else
|
||||
update_values("Thickness:", m_thickness, 1);
|
||||
update_values("Thickness:"sv, m_thickness, 1);
|
||||
};
|
||||
|
||||
update_slider();
|
||||
|
@ -181,7 +181,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
|
|||
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
mode_container->set_fixed_height(90);
|
||||
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"));
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"_short_string));
|
||||
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
mode_label->set_fixed_size(30, 20);
|
||||
|
||||
|
@ -225,7 +225,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
|
|||
(void)TRY(aspect_container->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
aspect_container->set_fixed_width(75);
|
||||
|
||||
auto aspect_label = TRY(aspect_container->try_add<GUI::Label>("Aspect Ratio:"));
|
||||
auto aspect_label = TRY(aspect_container->try_add<GUI::Label>(TRY("Aspect Ratio:"_string)));
|
||||
aspect_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
aspect_label->set_fixed_size(75, 20);
|
||||
|
||||
|
@ -246,7 +246,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
|
|||
}
|
||||
};
|
||||
|
||||
auto multiply_label = TRY(aspect_fields_container->try_add<GUI::Label>("x"));
|
||||
auto multiply_label = TRY(aspect_fields_container->try_add<GUI::Label>("x"_short_string));
|
||||
multiply_label->set_text_alignment(Gfx::TextAlignment::Center);
|
||||
multiply_label->set_fixed_size(10, 20);
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget()
|
|||
size_container->set_fixed_height(20);
|
||||
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"));
|
||||
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string));
|
||||
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
size_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -117,7 +117,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget()
|
|||
density_container->set_fixed_height(20);
|
||||
(void)TRY(density_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto density_label = TRY(density_container->try_add<GUI::Label>("Density:"));
|
||||
auto density_label = TRY(density_container->try_add<GUI::Label>(TRY("Density:"_string)));
|
||||
density_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
density_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
|
@ -111,16 +111,16 @@ ErrorOr<GUI::Widget*> TextTool::get_properties_widget()
|
|||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
(void)TRY(properties_widget->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
|
||||
auto font_header = TRY(properties_widget->try_add<GUI::Label>("Current Font:"));
|
||||
auto font_header = TRY(properties_widget->try_add<GUI::Label>(TRY("Current Font:"_string)));
|
||||
font_header->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
||||
m_font_label = TRY(properties_widget->try_add<GUI::Label>(m_selected_font->human_readable_name()));
|
||||
m_font_label = TRY(properties_widget->try_add<GUI::Label>(TRY(String::from_deprecated_string(m_selected_font->human_readable_name()))));
|
||||
|
||||
auto change_font_button = TRY(properties_widget->try_add<GUI::Button>(TRY("Change Font..."_string)));
|
||||
change_font_button->on_click = [this](auto) {
|
||||
auto picker = GUI::FontPicker::construct(nullptr, m_selected_font, false);
|
||||
if (picker->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
m_font_label->set_text(picker->font()->human_readable_name());
|
||||
m_font_label->set_text(String::from_deprecated_string(picker->font()->human_readable_name()).release_value_but_fixme_should_propagate_errors());
|
||||
m_selected_font = picker->font();
|
||||
m_text_editor->set_font(m_selected_font);
|
||||
m_editor->set_focus(true);
|
||||
|
|
|
@ -77,7 +77,7 @@ ErrorOr<GUI::Widget*> WandSelectTool::get_properties_widget()
|
|||
threshold_container->set_fixed_height(20);
|
||||
(void)TRY(threshold_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto threshold_label = TRY(threshold_container->try_add<GUI::Label>("Threshold:"));
|
||||
auto threshold_label = TRY(threshold_container->try_add<GUI::Label>(TRY("Threshold:"_string)));
|
||||
threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
threshold_label->set_fixed_size(80, 20);
|
||||
|
||||
|
@ -95,7 +95,7 @@ ErrorOr<GUI::Widget*> WandSelectTool::get_properties_widget()
|
|||
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto mode_label = TRY(mode_container->try_add<GUI::Label>());
|
||||
mode_label->set_text("Mode:");
|
||||
mode_label->set_text("Mode:"_short_string);
|
||||
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
mode_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ ErrorOr<GUI::Widget*> ZoomTool::get_properties_widget()
|
|||
sensitivity_container->set_fixed_height(20);
|
||||
(void)TRY(sensitivity_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto sensitivity_label = TRY(sensitivity_container->try_add<GUI::Label>("Sensitivity:"));
|
||||
auto sensitivity_label = TRY(sensitivity_container->try_add<GUI::Label>(TRY("Sensitivity:"_string)));
|
||||
sensitivity_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
sensitivity_label->set_fixed_size(80, 20);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue