mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 01:17:46 +00:00
Everywhere: Use _{short_,}string to create Strings from literals
This commit is contained in:
parent
85414d9338
commit
09d40bfbb2
92 changed files with 334 additions and 310 deletions
|
@ -110,12 +110,12 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
|
|||
};
|
||||
|
||||
auto& set_defaults_checkbox = main_widget->add<GUI::CheckBox>();
|
||||
set_defaults_checkbox.set_text(String::from_utf8("Use these settings as default"sv).release_value_but_fixme_should_propagate_errors());
|
||||
set_defaults_checkbox.set_text("Use these settings as default"_string.release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
auto& button_container = main_widget->add<GUI::Widget>();
|
||||
button_container.set_layout<GUI::HorizontalBoxLayout>();
|
||||
|
||||
auto& ok_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv));
|
||||
auto& ok_button = button_container.add<GUI::Button>("OK"_short_string);
|
||||
ok_button.on_click = [&](auto) {
|
||||
if (set_defaults_checkbox.is_checked()) {
|
||||
Config::write_string("PixelPaint"sv, "NewImage"sv, "Name"sv, m_image_name);
|
||||
|
@ -128,7 +128,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
|
|||
};
|
||||
ok_button.set_default(true);
|
||||
|
||||
auto& cancel_button = button_container.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv));
|
||||
auto& cancel_button = button_container.add<GUI::Button>("Cancel"_short_string);
|
||||
cancel_button.on_click = [this](auto) {
|
||||
done(ExecResult::Cancel);
|
||||
};
|
||||
|
|
|
@ -47,13 +47,13 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize suggested_size, GUI::Win
|
|||
auto& button_container = main_widget->add<GUI::Widget>();
|
||||
button_container.set_layout<GUI::HorizontalBoxLayout>();
|
||||
|
||||
auto& ok_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv));
|
||||
auto& ok_button = button_container.add<GUI::Button>("OK"_short_string);
|
||||
ok_button.on_click = [this](auto) {
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
ok_button.set_default(true);
|
||||
|
||||
auto& cancel_button = button_container.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv));
|
||||
auto& cancel_button = button_container.add<GUI::Button>("Cancel"_short_string);
|
||||
cancel_button.on_click = [this](auto) {
|
||||
done(ExecResult::Cancel);
|
||||
};
|
||||
|
|
|
@ -80,13 +80,13 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
auto& norm_checkbox = main_widget->template add<GUI::CheckBox>(String::from_utf8("Normalize"sv).release_value_but_fixme_should_propagate_errors());
|
||||
auto& norm_checkbox = main_widget->template add<GUI::CheckBox>("Normalize"_string.release_value_but_fixme_should_propagate_errors());
|
||||
norm_checkbox.set_checked(false);
|
||||
|
||||
auto& wrap_checkbox = main_widget->template add<GUI::CheckBox>(String::from_utf8_short_string("Wrap"sv));
|
||||
auto& wrap_checkbox = main_widget->template add<GUI::CheckBox>("Wrap"_short_string);
|
||||
wrap_checkbox.set_checked(m_should_wrap);
|
||||
|
||||
auto& button = main_widget->template add<GUI::Button>(String::from_utf8_short_string("Done"sv));
|
||||
auto& button = main_widget->template add<GUI::Button>("Done"_short_string);
|
||||
button.on_click = [&](auto) {
|
||||
m_should_wrap = wrap_checkbox.is_checked();
|
||||
if (norm_checkbox.is_checked())
|
||||
|
|
|
@ -69,7 +69,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
|
|||
radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
radius_label->set_fixed_height(20);
|
||||
|
||||
auto radius_slider = TRY(radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
auto radius_slider = TRY(radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
radius_slider->set_range(0, 50);
|
||||
radius_slider->set_value(m_blur_radius);
|
||||
radius_slider->on_change = [&](int value) {
|
||||
|
|
|
@ -47,7 +47,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
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(String::from_utf8("Use Asymmetric Radii"sv))));
|
||||
auto asymmetric_checkbox = TRY(settings_widget->try_add<GUI::CheckBox>(TRY("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(String::from_utf8("Use Direction and magnitude"sv))));
|
||||
m_vector_checkbox = TRY(settings_widget->try_add<GUI::CheckBox>(TRY("Use Direction and magnitude"_string)));
|
||||
m_vector_checkbox->set_checked(false);
|
||||
m_vector_checkbox->set_visible(false);
|
||||
m_vector_checkbox->set_fixed_height(15);
|
||||
|
@ -92,7 +92,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
radius_label->set_fixed_size(50, 20);
|
||||
|
||||
auto radius_slider = TRY(m_radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
auto radius_slider = TRY(m_radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
radius_slider->set_range(0, 25);
|
||||
radius_slider->set_value(m_radius);
|
||||
radius_slider->on_change = [&](int value) {
|
||||
|
@ -113,7 +113,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
radius_x_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
radius_x_label->set_fixed_size(50, 20);
|
||||
|
||||
m_radius_x_slider = TRY(radius_x_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
m_radius_x_slider = TRY(radius_x_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
m_radius_x_slider->set_range(0, 50);
|
||||
m_radius_x_slider->set_value(m_radius_x);
|
||||
m_radius_x_slider->on_change = [&](int value) {
|
||||
|
@ -129,7 +129,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
radius_y_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
radius_y_label->set_fixed_size(50, 20);
|
||||
|
||||
m_radius_y_slider = TRY(radius_y_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
m_radius_y_slider = TRY(radius_y_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
m_radius_y_slider->set_range(0, 50);
|
||||
m_radius_y_slider->set_value(m_radius_y);
|
||||
m_radius_y_slider->on_change = [&](int value) {
|
||||
|
@ -150,7 +150,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
angle_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
angle_label->set_fixed_size(60, 20);
|
||||
|
||||
m_angle_slider = TRY(angle_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("°"sv)));
|
||||
m_angle_slider = TRY(angle_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "°"_short_string));
|
||||
m_angle_slider->set_range(0, 360);
|
||||
m_angle_slider->set_value(m_angle);
|
||||
m_angle_slider->on_change = [&](int value) {
|
||||
|
@ -166,7 +166,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
magnitude_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
magnitude_label->set_fixed_size(60, 20);
|
||||
|
||||
m_magnitude_slider = TRY(magnitude_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
m_magnitude_slider = TRY(magnitude_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
m_magnitude_slider->set_range(0, 50);
|
||||
m_magnitude_slider->set_value(m_radius);
|
||||
m_magnitude_slider->on_change = [&](int value) {
|
||||
|
@ -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(String::from_utf8("Approximate Gaussian Blur"sv))));
|
||||
m_gaussian_checkbox = TRY(gaussian_container->try_add<GUI::CheckBox>(TRY("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) {
|
||||
|
|
|
@ -36,7 +36,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget()
|
|||
amount_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
amount_label->set_fixed_size(50, 20);
|
||||
|
||||
auto amount_slider = TRY(amount_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv)));
|
||||
auto amount_slider = TRY(amount_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string));
|
||||
amount_slider->set_range(0, 100);
|
||||
amount_slider->set_value(m_amount * 100);
|
||||
amount_slider->on_change = [this](int value) {
|
||||
|
|
|
@ -56,7 +56,7 @@ LayerPropertiesWidget::LayerPropertiesWidget()
|
|||
m_layer->set_opacity_percent(value);
|
||||
};
|
||||
|
||||
m_visibility_checkbox = group_box.add<GUI::CheckBox>(String::from_utf8_short_string("Visible"sv));
|
||||
m_visibility_checkbox = group_box.add<GUI::CheckBox>("Visible"_short_string);
|
||||
m_visibility_checkbox->set_fixed_height(20);
|
||||
m_visibility_checkbox->on_checked = [this](bool checked) {
|
||||
if (m_layer)
|
||||
|
|
|
@ -151,7 +151,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget()
|
|||
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
size_label->set_fixed_size(80, 20);
|
||||
|
||||
auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
size_slider->set_range(1, 100);
|
||||
size_slider->set_value(m_size);
|
||||
size_slider->set_override_cursor(cursor());
|
||||
|
@ -171,7 +171,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget()
|
|||
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
hardness_label->set_fixed_size(80, 20);
|
||||
|
||||
auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv)));
|
||||
auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string));
|
||||
hardness_slider->set_range(1, 100);
|
||||
hardness_slider->set_value(m_hardness);
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ ErrorOr<GUI::Widget*> BucketTool::get_properties_widget()
|
|||
threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
threshold_label->set_fixed_size(80, 20);
|
||||
|
||||
auto threshold_slider = TRY(threshold_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv)));
|
||||
auto threshold_slider = TRY(threshold_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string));
|
||||
threshold_slider->set_range(0, 100);
|
||||
threshold_slider->set_value(m_threshold);
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget()
|
|||
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
size_label->set_fixed_size(80, 20);
|
||||
|
||||
auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
size_slider->set_range(1, 100);
|
||||
size_slider->set_value(size());
|
||||
|
||||
|
@ -164,7 +164,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget()
|
|||
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
hardness_label->set_fixed_size(80, 20);
|
||||
|
||||
auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv)));
|
||||
auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string));
|
||||
hardness_slider->set_range(1, 100);
|
||||
hardness_slider->on_change = [&](int value) {
|
||||
set_hardness(value);
|
||||
|
|
|
@ -140,7 +140,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
|
|||
thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
thickness_label->set_fixed_size(80, 20);
|
||||
|
||||
auto thickness_slider = TRY(thickness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
auto thickness_slider = TRY(thickness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
thickness_slider->set_range(1, 10);
|
||||
thickness_slider->set_value(m_thickness);
|
||||
|
||||
|
@ -157,9 +157,9 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
|
|||
|
||||
auto mode_radio_container = TRY(mode_container->try_add<GUI::Widget>());
|
||||
(void)TRY(mode_radio_container->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
auto outline_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Outline"sv)));
|
||||
auto fill_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Fill"sv)));
|
||||
auto aa_enable_checkbox = TRY(mode_radio_container->try_add<GUI::CheckBox>(TRY(String::from_utf8("Anti-alias"sv))));
|
||||
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)));
|
||||
|
||||
aa_enable_checkbox->on_checked = [this](bool checked) {
|
||||
m_antialias_enabled = checked;
|
||||
|
|
|
@ -67,7 +67,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
|
|||
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
size_label->set_fixed_size(80, 20);
|
||||
|
||||
auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
size_slider->set_range(1, 100);
|
||||
size_slider->set_value(size());
|
||||
|
||||
|
@ -85,7 +85,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
|
|||
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
hardness_label->set_fixed_size(80, 20);
|
||||
|
||||
auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv)));
|
||||
auto hardness_slider = TRY(hardness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string));
|
||||
hardness_slider->set_range(1, 100);
|
||||
hardness_slider->set_value(hardness());
|
||||
|
||||
|
@ -100,7 +100,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(String::from_utf8("Use secondary color"sv)));
|
||||
use_secondary_color_checkbox->set_text(TRY("Use secondary color"_string));
|
||||
use_secondary_color_checkbox->on_checked = [this](bool checked) {
|
||||
m_use_secondary_color = checked;
|
||||
};
|
||||
|
@ -114,8 +114,8 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
|
|||
|
||||
auto mode_radio_container = TRY(mode_container->try_add<GUI::Widget>());
|
||||
(void)TRY(mode_radio_container->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
auto pencil_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Pencil"sv)));
|
||||
auto brush_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Brush"sv)));
|
||||
auto pencil_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Pencil"_short_string));
|
||||
auto brush_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Brush"_short_string));
|
||||
|
||||
pencil_mode_radio->on_checked = [this, hardness_slider, size_slider](bool) {
|
||||
m_draw_mode = DrawMode::Pencil;
|
||||
|
|
|
@ -206,7 +206,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
|
|||
|
||||
set_primary_slider(opacity_slider);
|
||||
|
||||
auto use_secondary_color_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>(TRY(String::from_utf8("Use secondary color"sv))));
|
||||
auto use_secondary_color_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>(TRY("Use secondary color"_string)));
|
||||
use_secondary_color_checkbox->on_checked = [this](bool checked) {
|
||||
m_use_secondary_color = checked;
|
||||
m_editor->update();
|
||||
|
@ -217,7 +217,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
|
|||
TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
button_container->add_spacer().release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
auto apply_button = TRY(button_container->try_add<GUI::DialogButton>(String::from_utf8_short_string("Apply"sv)));
|
||||
auto apply_button = TRY(button_container->try_add<GUI::DialogButton>("Apply"_short_string));
|
||||
apply_button->on_click = [this](auto) {
|
||||
rasterize_gradient();
|
||||
};
|
||||
|
|
|
@ -191,7 +191,7 @@ ErrorOr<GUI::Widget*> GuideTool::get_properties_widget()
|
|||
snapping_label->set_fixed_size(80, 20);
|
||||
snapping_label->set_tooltip("Press Shift to snap");
|
||||
|
||||
auto snapping_slider = TRY(snapping_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
auto snapping_slider = TRY(snapping_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
snapping_slider->set_range(0, 50);
|
||||
snapping_slider->set_value(m_snap_size);
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget()
|
|||
thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
thickness_label->set_fixed_size(80, 20);
|
||||
|
||||
auto thickness_slider = TRY(thickness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
auto thickness_slider = TRY(thickness_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
thickness_slider->set_range(1, 10);
|
||||
thickness_slider->set_value(m_thickness);
|
||||
|
||||
|
@ -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(String::from_utf8("Anti-alias"sv))));
|
||||
auto aa_enable_checkbox = TRY(mode_container->try_add<GUI::CheckBox>(TRY("Anti-alias"_string)));
|
||||
aa_enable_checkbox->on_checked = [this](bool checked) {
|
||||
m_antialias_enabled = checked;
|
||||
};
|
||||
|
|
|
@ -304,9 +304,9 @@ ErrorOr<GUI::Widget*> MoveTool::get_properties_widget()
|
|||
|
||||
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(String::from_utf8("Foreground"sv))));
|
||||
m_selection_mode_foreground = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY("Foreground"_string)));
|
||||
|
||||
m_selection_mode_active = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY(String::from_utf8("Active Layer"sv))));
|
||||
m_selection_mode_active = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY("Active Layer"_string)));
|
||||
|
||||
m_selection_mode_foreground->on_checked = [this](bool) {
|
||||
m_layer_selection_mode = LayerSelectionMode::ForegroundLayer;
|
||||
|
|
|
@ -49,7 +49,7 @@ ErrorOr<GUI::Widget*> PenTool::get_properties_widget()
|
|||
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
size_label->set_fixed_size(80, 20);
|
||||
|
||||
auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
size_slider->set_range(1, 20);
|
||||
size_slider->set_value(size());
|
||||
|
||||
|
|
|
@ -46,7 +46,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(String::from_utf8("Sample all layers"sv))));
|
||||
auto sample_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>(TRY("Sample all layers"_string)));
|
||||
sample_checkbox->set_checked(m_sample_all_layers);
|
||||
sample_checkbox->on_checked = [this](bool value) {
|
||||
m_sample_all_layers = value;
|
||||
|
|
|
@ -166,7 +166,7 @@ ErrorOr<GUI::Widget*> RectangleSelectTool::get_properties_widget()
|
|||
feather_label->set_fixed_size(80, 20);
|
||||
|
||||
int const feather_slider_max = 100;
|
||||
auto feather_slider = TRY(feather_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv)));
|
||||
auto feather_slider = TRY(feather_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string));
|
||||
feather_slider->set_range(0, feather_slider_max);
|
||||
feather_slider->set_value((int)floorf(m_edge_feathering * (float)feather_slider_max));
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
|
|||
thickness_or_radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
thickness_or_radius_label->set_fixed_size(80, 20);
|
||||
|
||||
auto thickness_or_radius_slider = TRY(thickness_or_radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
auto thickness_or_radius_slider = TRY(thickness_or_radius_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
|
||||
thickness_or_radius_slider->on_change = [&](int value) {
|
||||
if (m_fill_mode == FillMode::RoundedCorners) {
|
||||
|
@ -187,12 +187,12 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
|
|||
|
||||
auto mode_radio_container = TRY(mode_container->try_add<GUI::Widget>());
|
||||
(void)TRY(mode_radio_container->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
auto outline_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Outline"sv)));
|
||||
auto fill_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Fill"sv)));
|
||||
auto gradient_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(TRY(String::from_utf8("Gradient"sv))));
|
||||
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)));
|
||||
mode_radio_container->set_fixed_width(70);
|
||||
|
||||
auto rounded_corners_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>(String::from_utf8_short_string("Rounded"sv)));
|
||||
auto rounded_corners_mode_radio = TRY(mode_radio_container->try_add<GUI::RadioButton>("Rounded"_short_string));
|
||||
|
||||
outline_mode_radio->on_checked = [this, update_slider](bool) {
|
||||
m_fill_mode = FillMode::Outline;
|
||||
|
@ -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(String::from_utf8("Anti-alias"sv))));
|
||||
auto aa_enable_checkbox = TRY(mode_extras_container->try_add<GUI::CheckBox>(TRY("Anti-alias"_string)));
|
||||
aa_enable_checkbox->on_checked = [this](bool checked) {
|
||||
m_antialias_enabled = checked;
|
||||
};
|
||||
|
|
|
@ -104,7 +104,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget()
|
|||
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
size_label->set_fixed_size(80, 20);
|
||||
|
||||
auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("px"sv)));
|
||||
auto size_slider = TRY(size_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "px"_short_string));
|
||||
size_slider->set_range(1, 20);
|
||||
size_slider->set_value(m_thickness);
|
||||
|
||||
|
@ -121,7 +121,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget()
|
|||
density_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
density_label->set_fixed_size(80, 20);
|
||||
|
||||
auto density_slider = TRY(density_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv)));
|
||||
auto density_slider = TRY(density_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string));
|
||||
density_slider->set_range(1, 100);
|
||||
density_slider->set_value(m_density);
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ ErrorOr<GUI::Widget*> TextTool::get_properties_widget()
|
|||
|
||||
m_font_label = TRY(properties_widget->try_add<GUI::Label>(m_selected_font->human_readable_name()));
|
||||
|
||||
auto change_font_button = TRY(properties_widget->try_add<GUI::Button>(TRY(String::from_utf8("Change Font..."sv))));
|
||||
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) {
|
||||
|
|
|
@ -81,7 +81,7 @@ ErrorOr<GUI::Widget*> WandSelectTool::get_properties_widget()
|
|||
threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
threshold_label->set_fixed_size(80, 20);
|
||||
|
||||
auto threshold_slider = TRY(threshold_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv)));
|
||||
auto threshold_slider = TRY(threshold_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string));
|
||||
threshold_slider->set_range(0, 100);
|
||||
threshold_slider->set_value(m_threshold);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ ErrorOr<GUI::Widget*> ZoomTool::get_properties_widget()
|
|||
sensitivity_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
sensitivity_label->set_fixed_size(80, 20);
|
||||
|
||||
auto sensitivity_slider = TRY(sensitivity_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, String::from_utf8_short_string("%"sv)));
|
||||
auto sensitivity_slider = TRY(sensitivity_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_short_string));
|
||||
sensitivity_slider->set_range(1, 100);
|
||||
sensitivity_slider->set_value(100 * m_sensitivity);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue