1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 00:37:35 +00:00

LibGUI+Applications: Use the new layout system in the settings screens

This commit is contained in:
FrHun 2022-02-22 20:01:20 +01:00 committed by Sam Atkins
parent 3978960481
commit a6ec2b9d0a
8 changed files with 35 additions and 38 deletions

View file

@ -28,22 +28,20 @@
@GUI::IconView { @GUI::IconView {
name: "wallpaper_view" name: "wallpaper_view"
preferred_width: "opportunistic_grow"
} }
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_width: "fit"
layout: @GUI::VerticalBoxLayout {} layout: @GUI::VerticalBoxLayout {}
@GUI::Button { @GUI::Button {
name: "wallpaper_open_button" name: "wallpaper_open_button"
tooltip: "Select wallpaper from file system" tooltip: "Select wallpaper from file system"
text: "Browse..." text: "Browse..."
shrink_to_fit: true
} }
@GUI::Widget { @GUI::Layout::Spacer {}
fixed_height: 12
}
@GUI::Label { @GUI::Label {
text: "Mode:" text: "Mode:"
@ -55,9 +53,7 @@
name: "mode_combo" name: "mode_combo"
} }
@GUI::Widget { @GUI::Layout::Spacer {}
fixed_height: 12
}
@GUI::Label { @GUI::Label {
text: "Color:" text: "Color:"

View file

@ -6,7 +6,7 @@
} }
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::HorizontalBoxLayout { layout: @GUI::HorizontalBoxLayout {
spacing: 6 spacing: 6
} }
@ -17,14 +17,13 @@
text_alignment: "CenterLeft" text_alignment: "CenterLeft"
} }
@GUI::Frame { @GUI::Label {
background_role: "Base" background_role: "Base"
shadow: "Sunken"
shape: "Container"
thickness: 2
fill_with_background_color: true fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {} name: "default_font_label"
@GUI::Label {
name: "default_font_label"
}
} }
@GUI::Button { @GUI::Button {
@ -35,7 +34,7 @@
} }
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::HorizontalBoxLayout { layout: @GUI::HorizontalBoxLayout {
spacing: 6 spacing: 6
} }
@ -46,14 +45,13 @@
text_alignment: "CenterLeft" text_alignment: "CenterLeft"
} }
@GUI::Frame { @GUI::Label {
background_role: "Base" background_role: "Base"
shadow: "Sunken"
shape: "Container"
thickness: 2
fill_with_background_color: true fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {} name: "fixed_width_font_label"
@GUI::Label {
name: "fixed_width_font_label"
}
} }
@GUI::Button { @GUI::Button {
@ -63,5 +61,5 @@
} }
} }
@GUI::Widget {} @GUI::Layout::Spacer {}
} }

View file

@ -15,7 +15,7 @@
} }
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::HorizontalBoxLayout { layout: @GUI::HorizontalBoxLayout {
margins: [8, 8, 6, 16] margins: [8, 8, 6, 16]
} }
@ -38,7 +38,7 @@
title: "Screen settings" title: "Screen settings"
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::HorizontalBoxLayout {} layout: @GUI::HorizontalBoxLayout {}
@GUI::Label { @GUI::Label {
@ -64,7 +64,7 @@
} }
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::HorizontalBoxLayout {} layout: @GUI::HorizontalBoxLayout {}
@GUI::Label { @GUI::Label {
@ -84,6 +84,8 @@
text: "2x" text: "2x"
fixed_width: 50 fixed_width: 50
} }
@GUI::Layout::Spacer {}
} }
} }
} }

View file

@ -23,13 +23,13 @@
} }
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::HorizontalBoxLayout {} layout: @GUI::HorizontalBoxLayout {}
@GUI::Label { @GUI::Label {
text: "Theme:" text: "Theme:"
text_alignment: "CenterLeft" text_alignment: "CenterLeft"
fixed_width: 95 preferred_width: 95
} }
@GUI::ComboBox { @GUI::ComboBox {

View file

@ -12,7 +12,7 @@
} }
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::HorizontalBoxLayout { layout: @GUI::HorizontalBoxLayout {
spacing: 8 spacing: 8
} }

View file

@ -7,7 +7,7 @@
@GUI::GroupBox { @GUI::GroupBox {
title: "Bell Mode" title: "Bell Mode"
shrink_to_fit: false preferred_height: "fit"
fixed_height: 160 fixed_height: 160
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [16, 8, 8] margins: [16, 8, 8]
@ -20,7 +20,7 @@
} }
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
spacing: 4 spacing: 4
} }
@ -44,7 +44,7 @@
@GUI::GroupBox { @GUI::GroupBox {
title: "Scrollback Size (Lines)" title: "Scrollback Size (Lines)"
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [16, 8, 8] margins: [16, 8, 8]
} }
@ -64,7 +64,7 @@
@GUI::GroupBox { @GUI::GroupBox {
title: "Exit Behaviour" title: "Exit Behaviour"
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [16, 8, 8] margins: [16, 8, 8]
} }

View file

@ -7,7 +7,7 @@
@GUI::GroupBox { @GUI::GroupBox {
title: "Background Opacity" title: "Background Opacity"
fixed_height: 70 preferred_height: "fit"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [16, 8, 8] margins: [16, 8, 8]
spacing: 16 spacing: 16
@ -23,7 +23,7 @@
@GUI::GroupBox { @GUI::GroupBox {
title: "Terminal Font" title: "Terminal Font"
fixed_height: 100 preferred_height: "fit"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [16, 8, 8] margins: [16, 8, 8]
spacing: 16 spacing: 16
@ -35,13 +35,14 @@
} }
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_height: "fit"
name: "terminal_font_selection" name: "terminal_font_selection"
layout: @GUI::HorizontalBoxLayout { layout: @GUI::HorizontalBoxLayout {
spacing: 6 spacing: 6
} }
@GUI::Frame { @GUI::Frame {
preferred_height: "fit"
background_role: "Base" background_role: "Base"
fill_with_background_color: true fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {} layout: @GUI::VerticalBoxLayout {}
@ -89,7 +90,7 @@
@GUI::GroupBox { @GUI::GroupBox {
title: "Color Scheme" title: "Color Scheme"
fixed_height: 70 preferred_height: "fit"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [16, 8, 8] margins: [16, 8, 8]
spacing: 16 spacing: 16

View file

@ -41,7 +41,7 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(String title, Show
window->m_tab_widget = TRY(main_widget->try_add<GUI::TabWidget>()); window->m_tab_widget = TRY(main_widget->try_add<GUI::TabWidget>());
auto button_container = TRY(main_widget->try_add<GUI::Widget>()); auto button_container = TRY(main_widget->try_add<GUI::Widget>());
button_container->set_shrink_to_fit(true); button_container->set_preferred_size({ SpecialDimension::Grow, SpecialDimension::Fit });
(void)TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>()); (void)TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>());
button_container->layout()->set_spacing(6); button_container->layout()->set_spacing(6);