1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:07:44 +00:00

AK: Make "foo"_string infallible

Stop worrying about tiny OOMs.

Work towards #20405.
This commit is contained in:
Andreas Kling 2023-08-07 11:12:38 +02:00
parent db2a8725c6
commit 34344120f2
181 changed files with 626 additions and 630 deletions

View file

@ -80,7 +80,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
return BackgroundIndex::Custom;
}();
auto& background_label = main_widget->add<GUI::Label>("Background:"_string.release_value_but_fixme_should_propagate_errors());
auto& background_label = main_widget->add<GUI::Label>("Background:"_string);
background_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto& background_color_combo = main_widget->add<GUI::ComboBox>();
auto& background_color_input = main_widget->add<GUI::ColorInput>();
@ -110,7 +110,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
};
auto& set_defaults_checkbox = main_widget->add<GUI::CheckBox>();
set_defaults_checkbox.set_text("Use these settings as default"_string.release_value_but_fixme_should_propagate_errors());
set_defaults_checkbox.set_text("Use these settings as default"_string);
auto& button_container = main_widget->add<GUI::Widget>();
button_container.set_layout<GUI::HorizontalBoxLayout>();

View file

@ -79,7 +79,7 @@ private:
}
}
auto& norm_checkbox = main_widget->template add<GUI::CheckBox>("Normalize"_string.release_value_but_fixme_should_propagate_errors());
auto& norm_checkbox = main_widget->template add<GUI::CheckBox>("Normalize"_string);
norm_checkbox.set_checked(false);
auto& wrap_checkbox = main_widget->template add<GUI::CheckBox>("Wrap"_short_string);

View file

@ -40,7 +40,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
auto settings_widget = TRY(GUI::Widget::try_create());
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto name_label = TRY(settings_widget->try_add<GUI::Label>(TRY("Bloom Filter"_string)));
auto name_label = TRY(settings_widget->try_add<GUI::Label>("Bloom Filter"_string));
name_label->set_font_weight(Gfx::FontWeight::Bold);
name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label->set_fixed_height(20);
@ -49,7 +49,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
luma_lower_container->set_fixed_height(50);
TRY(luma_lower_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto luma_lower_label = TRY(luma_lower_container->try_add<GUI::Label>(TRY("Luma lower bound:"_string)));
auto luma_lower_label = TRY(luma_lower_container->try_add<GUI::Label>("Luma lower bound:"_string));
luma_lower_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
luma_lower_label->set_fixed_height(20);
@ -65,7 +65,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
radius_container->set_fixed_height(50);
TRY(radius_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto radius_label = TRY(radius_container->try_add<GUI::Label>(TRY("Blur Radius:"_string)));
auto radius_label = TRY(radius_container->try_add<GUI::Label>("Blur Radius:"_string));
radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
radius_label->set_fixed_height(20);

View file

@ -42,12 +42,12 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
auto settings_widget = TRY(GUI::Widget::try_create());
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto name_label = TRY(settings_widget->try_add<GUI::Label>(TRY("Fast Box Blur Filter"_string)));
auto name_label = TRY(settings_widget->try_add<GUI::Label>("Fast Box Blur Filter"_string));
name_label->set_font_weight(Gfx::FontWeight::Bold);
name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label->set_fixed_height(10);
auto asymmetric_checkbox = TRY(settings_widget->try_add<GUI::CheckBox>(TRY("Use Asymmetric Radii"_string)));
auto asymmetric_checkbox = TRY(settings_widget->try_add<GUI::CheckBox>("Use Asymmetric Radii"_string));
asymmetric_checkbox->set_checked(false);
asymmetric_checkbox->set_fixed_height(15);
asymmetric_checkbox->on_checked = [this](bool checked) {
@ -68,7 +68,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
update_preview();
};
m_vector_checkbox = TRY(settings_widget->try_add<GUI::CheckBox>(TRY("Use Direction and magnitude"_string)));
m_vector_checkbox = TRY(settings_widget->try_add<GUI::CheckBox>("Use Direction and magnitude"_string));
m_vector_checkbox->set_checked(false);
m_vector_checkbox->set_visible(false);
m_vector_checkbox->set_fixed_height(15);
@ -109,7 +109,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
radius_x_container->set_fixed_height(20);
radius_x_container->set_layout<GUI::HorizontalBoxLayout>();
auto radius_x_label = TRY(radius_x_container->try_add<GUI::Label>(TRY("Radius X:"_string)));
auto radius_x_label = TRY(radius_x_container->try_add<GUI::Label>("Radius X:"_string));
radius_x_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
radius_x_label->set_fixed_size(50, 20);
@ -125,7 +125,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
radius_y_container->set_fixed_height(20);
TRY(radius_y_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto radius_y_label = TRY(radius_y_container->try_add<GUI::Label>(TRY("Radius Y:"_string)));
auto radius_y_label = TRY(radius_y_container->try_add<GUI::Label>("Radius Y:"_string));
radius_y_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
radius_y_label->set_fixed_size(50, 20);
@ -162,7 +162,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
magnitude_container->set_fixed_height(20);
TRY(magnitude_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto magnitude_label = TRY(magnitude_container->try_add<GUI::Label>(TRY("Magnitude:"_string)));
auto magnitude_label = TRY(magnitude_container->try_add<GUI::Label>("Magnitude:"_string));
magnitude_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
magnitude_label->set_fixed_size(60, 20);
@ -178,7 +178,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
gaussian_container->set_fixed_height(20);
TRY(gaussian_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
m_gaussian_checkbox = TRY(gaussian_container->try_add<GUI::CheckBox>(TRY("Approximate Gaussian Blur"_string)));
m_gaussian_checkbox = TRY(gaussian_container->try_add<GUI::CheckBox>("Approximate Gaussian Blur"_string));
m_gaussian_checkbox->set_checked(m_approximate_gauss);
m_gaussian_checkbox->set_tooltip("A real gaussian blur can be approximated by running the box blur multiple times with different weights.");
m_gaussian_checkbox->on_checked = [this](bool checked) {

View file

@ -23,7 +23,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget()
auto settings_widget = TRY(GUI::Widget::try_create());
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto name_label = TRY(settings_widget->try_add<GUI::Label>(TRY("Sepia Filter"_string)));
auto name_label = TRY(settings_widget->try_add<GUI::Label>("Sepia Filter"_string));
name_label->set_font_weight(Gfx::FontWeight::Bold);
name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label->set_fixed_height(20);

View file

@ -30,7 +30,7 @@ constexpr int marching_ant_length = 4;
ImageEditor::ImageEditor(NonnullRefPtr<Image> image)
: m_image(move(image))
, m_title("Untitled"_string.release_value_but_fixme_should_propagate_errors())
, m_title("Untitled"_string)
, m_gui_event_loop(Core::EventLoop::current())
{
set_focus_policy(GUI::FocusPolicy::StrongFocus);

View file

@ -45,7 +45,7 @@ LayerPropertiesWidget::LayerPropertiesWidget()
opacity_container.set_fixed_height(20);
opacity_container.set_layout<GUI::HorizontalBoxLayout>();
auto& opacity_label = opacity_container.add<GUI::Label>("Opacity:"_string.release_value_but_fixme_should_propagate_errors());
auto& opacity_label = opacity_container.add<GUI::Label>("Opacity:"_string);
opacity_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
opacity_label.set_fixed_size(80, 20);

View file

@ -1314,7 +1314,7 @@ ErrorOr<void> MainWidget::create_default_image()
m_layer_list_widget->set_image(image);
auto& editor = create_new_editor(*image);
editor.set_title(TRY("Untitled"_string));
editor.set_title("Untitled"_string);
editor.set_active_layer(bg_layer);
editor.set_unmodified();
@ -1333,7 +1333,7 @@ ErrorOr<void> MainWidget::create_image_from_clipboard()
image->add_layer(*layer);
auto& editor = create_new_editor(*image);
editor.set_title(TRY("Untitled"_string));
editor.set_title("Untitled"_string);
m_layer_list_widget->set_image(image);
m_layer_list_widget->set_selected_layer(layer);
@ -1362,7 +1362,7 @@ ImageEditor* MainWidget::current_image_editor()
ImageEditor& MainWidget::create_new_editor(NonnullRefPtr<Image> image)
{
auto& image_editor = m_tab_widget->add_tab<PixelPaint::ImageEditor>("Untitled"_string.release_value_but_fixme_should_propagate_errors(), image);
auto& image_editor = m_tab_widget->add_tab<PixelPaint::ImageEditor>("Untitled"_string, image);
image_editor.on_active_layer_change = [&](auto* layer) {
if (current_image_editor() != &image_editor)

View file

@ -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>(TRY("Hardness:"_string)));
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"_string));
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
hardness_label->set_fixed_size(80, 20);

View file

@ -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>(TRY("Threshold:"_string)));
auto threshold_label = TRY(threshold_container->try_add<GUI::Label>("Threshold:"_string));
threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
threshold_label->set_fixed_size(80, 20);

View file

@ -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>(TRY("Hardness:"_string)));
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"_string));
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
hardness_label->set_fixed_size(80, 20);

View file

@ -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>(TRY("Thickness:"_string)));
auto thickness_label = TRY(thickness_container->try_add<GUI::Label>("Thickness:"_string));
thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
thickness_label->set_fixed_size(80, 20);
@ -159,7 +159,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
(void)TRY(mode_radio_container->try_set_layout<GUI::VerticalBoxLayout>());
auto outline_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Outline"_short_string));
auto fill_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Fill"_short_string));
auto aa_enable_checkbox = TRY(mode_radio_container->try_add<GUI::CheckBox>(TRY("Anti-alias"_string)));
auto aa_enable_checkbox = TRY(mode_radio_container->try_add<GUI::CheckBox>("Anti-alias"_string));
aa_enable_checkbox->on_checked = [this](bool checked) {
m_antialias_enabled = checked;
@ -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>(TRY("Aspect Ratio:"_string)));
auto aspect_label = TRY(aspect_container->try_add<GUI::Label>("Aspect Ratio:"_string));
aspect_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
aspect_label->set_fixed_size(80, 20);

View file

@ -82,7 +82,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>(TRY("Hardness:"_string)));
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"_string));
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
hardness_label->set_fixed_size(80, 20);
@ -101,7 +101,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
auto use_secondary_color_checkbox = TRY(secondary_color_container->try_add<GUI::CheckBox>());
use_secondary_color_checkbox->set_checked(m_use_secondary_color);
use_secondary_color_checkbox->set_text(TRY("Use secondary color"_string));
use_secondary_color_checkbox->set_text("Use secondary color"_string);
use_secondary_color_checkbox->on_checked = [this](bool checked) {
m_use_secondary_color = checked;
};
@ -109,7 +109,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>(TRY("Draw Mode:"_string)));
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Draw Mode:"_string));
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20);

View file

@ -207,7 +207,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>(TRY("Gradient Type:"_string)));
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Gradient Type:"_string));
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20);
@ -237,7 +237,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
opacity_container->set_fixed_height(20);
(void)TRY(opacity_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto opacity_label = TRY(opacity_container->try_add<GUI::Label>(TRY("Opacity:"_string)));
auto opacity_label = TRY(opacity_container->try_add<GUI::Label>("Opacity:"_string));
opacity_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
opacity_label->set_fixed_size(80, 20);
@ -271,7 +271,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>(TRY("Hardness:"_string)));
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"_string));
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
hardness_label->set_fixed_size(80, 20);
@ -286,7 +286,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
};
set_secondary_slider(hardness_slider);
auto use_secondary_color_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>(TRY("Use secondary color"_string)));
auto use_secondary_color_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>("Use secondary color"_string));
use_secondary_color_checkbox->on_checked = [this](bool checked) {
m_use_secondary_color = checked;
m_editor->update();

View file

@ -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>(TRY("Snap offset:"_string)));
auto snapping_label = TRY(snapping_container->try_add<GUI::Label>("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");

View file

@ -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>(TRY("Thickness:"_string)));
auto thickness_label = TRY(thickness_container->try_add<GUI::Label>("Thickness:"_string));
thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
thickness_label->set_fixed_size(80, 20);
@ -150,7 +150,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget()
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20);
auto aa_enable_checkbox = TRY(mode_container->try_add<GUI::CheckBox>(TRY("Anti-alias"_string)));
auto aa_enable_checkbox = TRY(mode_container->try_add<GUI::CheckBox>("Anti-alias"_string));
aa_enable_checkbox->on_checked = [this](bool checked) {
m_antialias_enabled = checked;
};

View file

@ -298,15 +298,15 @@ 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>(TRY("Selection Mode:"_string)));
auto selection_mode_label = TRY(selection_mode_container->try_add<GUI::Label>("Selection Mode:"_string));
selection_mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
selection_mode_label->set_fixed_size(80, 40);
auto mode_radio_container = TRY(selection_mode_container->try_add<GUI::Widget>());
(void)TRY(mode_radio_container->try_set_layout<GUI::VerticalBoxLayout>());
m_selection_mode_foreground = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY("Foreground"_string)));
m_selection_mode_foreground = TRY(mode_radio_container->try_add<GUI::RadioButton>("Foreground"_string));
m_selection_mode_active = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY("Active Layer"_string)));
m_selection_mode_active = TRY(mode_radio_container->try_add<GUI::RadioButton>("Active Layer"_string));
m_selection_mode_foreground->on_checked = [this](bool) {
m_layer_selection_mode = LayerSelectionMode::ForegroundLayer;

View file

@ -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>(TRY("Thickness:"_string)));
auto size_label = TRY(size_container->try_add<GUI::Label>("Thickness:"_string));
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20);

View file

@ -47,7 +47,7 @@ ErrorOr<GUI::Widget*> PickerTool::get_properties_widget()
auto properties_widget = TRY(GUI::Widget::try_create());
(void)TRY(properties_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto sample_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>(TRY("Sample all layers"_string)));
auto sample_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>("Sample all layers"_string));
sample_checkbox->set_checked(m_sample_all_layers);
sample_checkbox->on_checked = [this](bool value) {
m_sample_all_layers = value;

View file

@ -165,7 +165,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(TRY("Feather:"_string));
feather_label->set_text("Feather:"_string);
feather_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
feather_label->set_fixed_size(80, 20);

View file

@ -189,7 +189,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
(void)TRY(mode_radio_container->try_set_layout<GUI::VerticalBoxLayout>());
auto outline_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Outline"_short_string));
auto fill_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Fill"_short_string));
auto gradient_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY("Gradient"_string)));
auto gradient_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Gradient"_string));
mode_radio_container->set_fixed_width(70);
auto rounded_corners_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Rounded"_short_string));
@ -215,7 +215,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
auto mode_extras_container = TRY(mode_container->try_add<GUI::Widget>());
(void)TRY(mode_extras_container->try_set_layout<GUI::VerticalBoxLayout>());
auto aa_enable_checkbox = TRY(mode_extras_container->try_add<GUI::CheckBox>(TRY("Anti-alias"_string)));
auto aa_enable_checkbox = TRY(mode_extras_container->try_add<GUI::CheckBox>("Anti-alias"_string));
aa_enable_checkbox->on_checked = [this](bool checked) {
m_antialias_enabled = checked;
};
@ -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>(TRY("Aspect Ratio:"_string)));
auto aspect_label = TRY(aspect_container->try_add<GUI::Label>("Aspect Ratio:"_string));
aspect_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
aspect_label->set_fixed_size(75, 20);

View file

@ -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>(TRY("Density:"_string)));
auto density_label = TRY(density_container->try_add<GUI::Label>("Density:"_string));
density_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
density_label->set_fixed_size(80, 20);

View file

@ -111,12 +111,12 @@ 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>(TRY("Current Font:"_string)));
auto font_header = TRY(properties_widget->try_add<GUI::Label>("Current Font:"_string));
font_header->set_text_alignment(Gfx::TextAlignment::CenterLeft);
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)));
auto change_font_button = TRY(properties_widget->try_add<GUI::Button>("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) {

View file

@ -79,7 +79,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>(TRY("Threshold:"_string)));
auto threshold_label = TRY(threshold_container->try_add<GUI::Label>("Threshold:"_string));
threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
threshold_label->set_fixed_size(80, 20);

View file

@ -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>(TRY("Sensitivity:"_string)));
auto sensitivity_label = TRY(sensitivity_container->try_add<GUI::Label>("Sensitivity:"_string));
sensitivity_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
sensitivity_label->set_fixed_size(80, 20);