mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:47:45 +00:00
LibGUI+Userland: Stop returning Layout from Widget::(try_)set_layout()
Nobody uses this return value any more. It also lets us remove a whole bunch of `(void)` casts. :^)
This commit is contained in:
parent
77ad0fdb07
commit
6b66e39df4
20 changed files with 47 additions and 48 deletions
|
@ -216,7 +216,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto& tab_widget = *widget->find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
|
||||
|
||||
auto backtrace_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Backtrace"));
|
||||
(void)TRY(backtrace_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
TRY(backtrace_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
|
||||
auto backtrace_label = TRY(backtrace_tab->try_add<GUI::Label>("A backtrace for each thread alive during the crash is listed below:"));
|
||||
backtrace_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
@ -236,7 +236,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
cpu_registers_tab_widget->set_tab_position(GUI::TabWidget::TabPosition::Bottom);
|
||||
|
||||
auto environment_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Environment"));
|
||||
(void)TRY(environment_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
TRY(environment_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
|
||||
auto environment_text_editor = TRY(environment_tab->try_add<GUI::TextEditor>());
|
||||
environment_text_editor->set_text(DeprecatedString::join('\n', environment));
|
||||
|
@ -245,7 +245,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
environment_text_editor->set_should_hide_unnecessary_scrollbars(true);
|
||||
|
||||
auto memory_regions_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Memory Regions"));
|
||||
(void)TRY(memory_regions_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
TRY(memory_regions_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
|
||||
auto memory_regions_text_editor = TRY(memory_regions_tab->try_add<GUI::TextEditor>());
|
||||
memory_regions_text_editor->set_text(DeprecatedString::join('\n', memory_regions));
|
||||
|
@ -303,7 +303,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
[&](auto results) -> ErrorOr<void> {
|
||||
for (auto& backtrace : results.thread_backtraces) {
|
||||
auto container = TRY(backtrace_tab_widget->try_add_tab<GUI::Widget>(backtrace.title));
|
||||
(void)TRY(container->template try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
TRY(container->template try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
auto backtrace_text_editor = TRY(container->template try_add<GUI::TextEditor>());
|
||||
backtrace_text_editor->set_text(backtrace.text);
|
||||
backtrace_text_editor->set_mode(GUI::TextEditor::Mode::ReadOnly);
|
||||
|
@ -314,7 +314,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
for (auto& cpu_registers : results.thread_cpu_registers) {
|
||||
auto container = TRY(cpu_registers_tab_widget->try_add_tab<GUI::Widget>(cpu_registers.title));
|
||||
(void)TRY(container->template try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
TRY(container->template try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
auto cpu_registers_text_editor = TRY(container->template try_add<GUI::TextEditor>());
|
||||
cpu_registers_text_editor->set_text(cpu_registers.text);
|
||||
cpu_registers_text_editor->set_mode(GUI::TextEditor::Mode::ReadOnly);
|
||||
|
|
|
@ -53,7 +53,7 @@ PropertiesWindow::PropertiesWindow(DeprecatedString const& path, Window* parent_
|
|||
ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
|
||||
{
|
||||
auto main_widget = TRY(set_main_widget<GUI::Widget>());
|
||||
(void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>(4, 6));
|
||||
TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>(4, 6));
|
||||
main_widget->set_fill_with_background_color(true);
|
||||
|
||||
auto tab_widget = TRY(main_widget->try_add<GUI::TabWidget>());
|
||||
|
@ -149,7 +149,7 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
|
|||
TRY(setup_permission_checkboxes(*others_read, *others_write, *others_execute, { S_IROTH, S_IWOTH, S_IXOTH }, m_mode));
|
||||
|
||||
auto button_widget = TRY(main_widget->try_add<GUI::Widget>());
|
||||
(void)TRY(button_widget->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 5));
|
||||
TRY(button_widget->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 5));
|
||||
button_widget->set_fixed_height(22);
|
||||
|
||||
TRY(button_widget->add_spacer());
|
||||
|
|
|
@ -358,7 +358,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
window->set_has_alpha_channel(true);
|
||||
|
||||
auto desktop_widget = TRY(window->set_main_widget<FileManager::DesktopWidget>());
|
||||
(void)TRY(desktop_widget->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
TRY(desktop_widget->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
|
||||
auto directory_view = TRY(desktop_widget->try_add<DirectoryView>(DirectoryView::Mode::Desktop));
|
||||
directory_view->set_name("directory_view");
|
||||
|
|
|
@ -34,7 +34,7 @@ MainWidget::MainWidget(TrackManager& track_manager, AudioPlayerLoop& loop)
|
|||
|
||||
ErrorOr<void> MainWidget::initialize()
|
||||
{
|
||||
(void)TRY(try_set_layout<GUI::VerticalBoxLayout>(2, 2));
|
||||
TRY(try_set_layout<GUI::VerticalBoxLayout>(2, 2));
|
||||
set_fill_with_background_color(true);
|
||||
|
||||
m_wave_widget = TRY(try_add<WaveWidget>(m_track_manager));
|
||||
|
@ -49,7 +49,7 @@ ErrorOr<void> MainWidget::initialize()
|
|||
m_player_widget = TRY(try_add<PlayerWidget>(m_track_manager, m_audio_loop));
|
||||
|
||||
m_keys_and_knobs_container = TRY(try_add<GUI::Widget>());
|
||||
(void)TRY(m_keys_and_knobs_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 2));
|
||||
TRY(m_keys_and_knobs_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 2));
|
||||
m_keys_and_knobs_container->set_fixed_height(130);
|
||||
m_keys_and_knobs_container->set_fill_with_background_color(true);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ PlayerWidget::PlayerWidget(TrackManager& manager, AudioPlayerLoop& loop)
|
|||
|
||||
ErrorOr<void> PlayerWidget::initialize()
|
||||
{
|
||||
(void)TRY(try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
TRY(try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
set_fill_with_background_color(true);
|
||||
TRY(m_track_number_choices.try_append("1"));
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
|
|||
{
|
||||
if (!m_settings_widget) {
|
||||
auto settings_widget = TRY(GUI::Widget::try_create());
|
||||
(void)TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
|
||||
auto name_label = TRY(settings_widget->try_add<GUI::Label>("Bloom Filter"));
|
||||
name_label->set_font_weight(Gfx::FontWeight::Bold);
|
||||
|
@ -47,7 +47,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
|
|||
|
||||
auto luma_lower_container = TRY(settings_widget->try_add<GUI::Widget>());
|
||||
luma_lower_container->set_fixed_height(50);
|
||||
(void)TRY(luma_lower_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
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>("Luma lower bound:"));
|
||||
luma_lower_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
@ -63,7 +63,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
|
|||
|
||||
auto radius_container = TRY(settings_widget->try_add<GUI::Widget>());
|
||||
radius_container->set_fixed_height(50);
|
||||
(void)TRY(radius_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
TRY(radius_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
|
||||
auto radius_label = TRY(radius_container->try_add<GUI::Label>("Blur Radius:"));
|
||||
radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
|
|
@ -40,7 +40,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
{
|
||||
if (!m_settings_widget) {
|
||||
auto settings_widget = TRY(GUI::Widget::try_create());
|
||||
(void)TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
|
||||
auto name_label = TRY(settings_widget->try_add<GUI::Label>("Fast Box Blur Filter"));
|
||||
name_label->set_font_weight(Gfx::FontWeight::Bold);
|
||||
|
@ -86,7 +86,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
|
||||
m_radius_container = TRY(settings_widget->try_add<GUI::Widget>());
|
||||
m_radius_container->set_fixed_height(20);
|
||||
(void)TRY(m_radius_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
TRY(m_radius_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
|
||||
auto radius_label = TRY(m_radius_container->try_add<GUI::Label>("Radius:"));
|
||||
radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
@ -103,7 +103,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
m_asymmetric_radius_container = TRY(settings_widget->try_add<GUI::Widget>());
|
||||
m_asymmetric_radius_container->set_visible(false);
|
||||
m_asymmetric_radius_container->set_fixed_height(50);
|
||||
(void)TRY(m_asymmetric_radius_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
TRY(m_asymmetric_radius_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
|
||||
auto radius_x_container = TRY(m_asymmetric_radius_container->try_add<GUI::Widget>());
|
||||
radius_x_container->set_fixed_height(20);
|
||||
|
@ -123,7 +123,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
|
||||
auto radius_y_container = TRY(m_asymmetric_radius_container->try_add<GUI::Widget>());
|
||||
radius_y_container->set_fixed_height(20);
|
||||
(void)TRY(radius_y_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
TRY(radius_y_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto radius_y_label = TRY(radius_y_container->try_add<GUI::Label>("Radius Y:"));
|
||||
radius_y_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
@ -140,11 +140,11 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
m_vector_container = TRY(settings_widget->try_add<GUI::Widget>());
|
||||
m_vector_container->set_visible(false);
|
||||
m_vector_container->set_fixed_height(50);
|
||||
(void)TRY(m_vector_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
TRY(m_vector_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
|
||||
auto angle_container = TRY(m_vector_container->try_add<GUI::Widget>());
|
||||
angle_container->set_fixed_height(20);
|
||||
(void)TRY(angle_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
TRY(angle_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto angle_label = TRY(angle_container->try_add<GUI::Label>("Angle:"));
|
||||
angle_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
@ -160,7 +160,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
|
||||
auto magnitude_container = TRY(m_vector_container->try_add<GUI::Widget>());
|
||||
magnitude_container->set_fixed_height(20);
|
||||
(void)TRY(magnitude_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
TRY(magnitude_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto magnitude_label = TRY(magnitude_container->try_add<GUI::Label>("Magnitude:"));
|
||||
magnitude_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
@ -176,7 +176,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
|
|||
|
||||
auto gaussian_container = TRY(settings_widget->try_add<GUI::Widget>());
|
||||
gaussian_container->set_fixed_height(20);
|
||||
(void)TRY(gaussian_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
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->set_checked(m_approximate_gauss);
|
||||
|
|
|
@ -21,7 +21,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget()
|
|||
{
|
||||
if (!m_settings_widget) {
|
||||
auto settings_widget = TRY(GUI::Widget::try_create());
|
||||
(void)TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
|
||||
auto name_label = TRY(settings_widget->try_add<GUI::Label>("Sepia Filter"));
|
||||
name_label->set_font_weight(Gfx::FontWeight::Bold);
|
||||
|
@ -30,7 +30,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget()
|
|||
|
||||
auto amount_container = TRY(settings_widget->try_add<GUI::Widget>());
|
||||
amount_container->set_fixed_height(20);
|
||||
(void)TRY(amount_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
TRY(amount_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
|
||||
|
||||
auto amount_label = TRY(amount_container->try_add<GUI::Label>("Amount:"));
|
||||
amount_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
|
|
@ -214,7 +214,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
|
|||
|
||||
auto button_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
button_container->set_fixed_height(22);
|
||||
(void)TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>());
|
||||
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)));
|
||||
|
|
|
@ -16,7 +16,7 @@ ErrorOr<NonnullRefPtr<ProgressWindow>> ProgressWindow::try_create(StringView tit
|
|||
|
||||
auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
|
||||
main_widget->set_fill_with_background_color(true);
|
||||
(void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
|
||||
|
||||
auto label = TRY(main_widget->try_add<GUI::Label>("Analyzing storage space..."));
|
||||
label->set_fixed_height(22);
|
||||
|
|
|
@ -175,10 +175,10 @@ static ErrorOr<NonnullRefPtr<GUI::Window>> create_find_window(VT::TerminalWidget
|
|||
auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
|
||||
main_widget->set_fill_with_background_color(true);
|
||||
main_widget->set_background_role(ColorRole::Button);
|
||||
(void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>(4));
|
||||
|
||||
auto find = TRY(main_widget->try_add<GUI::Widget>());
|
||||
(void)TRY(find->try_set_layout<GUI::HorizontalBoxLayout>(4));
|
||||
TRY(find->try_set_layout<GUI::HorizontalBoxLayout>(4));
|
||||
find->set_fixed_height(30);
|
||||
|
||||
auto find_textbox = TRY(find->try_add<GUI::TextBox>());
|
||||
|
|
|
@ -435,12 +435,12 @@ ErrorOr<void> MainWidget::add_property_tab(PropertyTab const& property_tab)
|
|||
|
||||
auto properties_list = TRY(GUI::Widget::try_create());
|
||||
scrollable_container->set_widget(properties_list);
|
||||
(void)TRY(properties_list->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8 }, 12));
|
||||
TRY(properties_list->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8 }, 12));
|
||||
|
||||
for (auto const& group : property_tab.property_groups) {
|
||||
NonnullRefPtr<GUI::GroupBox> group_box = TRY(properties_list->try_add<GUI::GroupBox>(group.title));
|
||||
// 1px less on the left makes the text line up with the group title.
|
||||
(void)TRY(group_box->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8, 8, 8, 7 }, 12));
|
||||
TRY(group_box->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8, 8, 8, 7 }, 12));
|
||||
group_box->set_preferred_height(GUI::SpecialDimension::Fit);
|
||||
|
||||
for (auto const& property : group.properties) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue