diff --git a/Userland/Applications/Welcome/WelcomeWidget.cpp b/Userland/Applications/Welcome/WelcomeWidget.cpp index c31fd2d5e42..56b6d4ce3e6 100644 --- a/Userland/Applications/Welcome/WelcomeWidget.cpp +++ b/Userland/Applications/Welcome/WelcomeWidget.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -23,24 +24,14 @@ WelcomeWidget::WelcomeWidget() { load_from_gml(welcome_window_gml); - auto& tip_frame = *find_descendant_of_type_named("tip_frame"); - tip_frame.set_background_role(Gfx::ColorRole::Base); - tip_frame.set_fill_with_background_color(true); + m_web_view = find_descendant_of_type_named("web_view"); + m_tip_label = find_descendant_of_type_named("tip_label"); + m_tip_frame = find_descendant_of_type_named("tip_frame"); - auto& light_bulb_label = *find_descendant_of_type_named("light_bulb_label"); - light_bulb_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-welcome.png"sv).release_value_but_fixme_should_propagate_errors()); - - m_web_view = *find_descendant_of_type_named("web_view"); - - m_tip_label = *find_descendant_of_type_named("tip_label"); - - m_next_button = *find_descendant_of_type_named("next_button"); - m_next_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors()); + m_next_button = find_descendant_of_type_named("next_button"); m_next_button->on_click = [&](auto) { - if (!tip_frame.is_visible()) { - m_web_view->set_visible(false); - tip_frame.set_visible(true); - } + m_web_view->set_visible(false); + m_tip_frame->set_visible(true); if (m_tips.is_empty()) return; m_initial_tip_index++; @@ -49,19 +40,18 @@ WelcomeWidget::WelcomeWidget() m_tip_label->set_text(m_tips[m_initial_tip_index]); }; - m_help_button = *find_descendant_of_type_named("help_button"); - m_help_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png"sv).release_value_but_fixme_should_propagate_errors()); + m_help_button = find_descendant_of_type_named("help_button"); m_help_button->on_click = [&](auto) { GUI::Process::spawn_or_show_error(window(), "/bin/Help"sv); }; - m_new_button = *find_descendant_of_type_named("new_button"); + m_new_button = find_descendant_of_type_named("new_button"); m_new_button->on_click = [&](auto) { m_web_view->set_visible(!m_web_view->is_visible()); - tip_frame.set_visible(!tip_frame.is_visible()); + m_tip_frame->set_visible(!m_tip_frame->is_visible()); }; - m_close_button = *find_descendant_of_type_named("close_button"); + m_close_button = find_descendant_of_type_named("close_button"); m_close_button->on_click = [](auto) { GUI::Application::the()->quit(); }; diff --git a/Userland/Applications/Welcome/WelcomeWidget.h b/Userland/Applications/Welcome/WelcomeWidget.h index 4d304ce27e1..361f224672b 100644 --- a/Userland/Applications/Welcome/WelcomeWidget.h +++ b/Userland/Applications/Welcome/WelcomeWidget.h @@ -28,6 +28,7 @@ private: RefPtr m_next_button; RefPtr m_help_button; RefPtr m_new_button; + RefPtr m_tip_frame; RefPtr m_tip_label; RefPtr m_startup_checkbox; RefPtr m_web_view; diff --git a/Userland/Applications/Welcome/WelcomeWindow.gml b/Userland/Applications/Welcome/WelcomeWindow.gml index fded2e54440..233bfc8c470 100644 --- a/Userland/Applications/Welcome/WelcomeWindow.gml +++ b/Userland/Applications/Welcome/WelcomeWindow.gml @@ -1,74 +1,87 @@ @GUI::Widget { fill_with_background_color: true layout: @GUI::VerticalBoxLayout { - margins: [8, 8, 8, 8] + margins: [8] + spacing: 4 } @GUI::Widget { + name: "welcome_banner" fixed_height: 30 } @GUI::Widget { - min_height: 160 - layout: @GUI::HorizontalBoxLayout {} - - @GUI::Frame { - name: "tip_frame" - min_width: 340 - min_height: 160 - layout: @GUI::HorizontalBoxLayout { - margins: [0, 16, 0, 0] - } - - @GUI::Widget { - fixed_width: 60 - layout: @GUI::VerticalBoxLayout {} - - @GUI::Label { - name: "light_bulb_label" - fixed_height: 60 - } - - @GUI::Layout::Spacer {} - } - - @GUI::Widget { - layout: @GUI::VerticalBoxLayout {} - - @GUI::Label { - fixed_height: 60 - name: "did_you_know_label" - text: "Did you know..." - text_alignment: "CenterLeft" - font_size: 12 - font_weight: "Bold" - } - - @GUI::Label { - name: "tip_label" - text_alignment: "TopLeft" - word_wrap: true - font_size: 12 - } - } - } - - @WebView::OutOfProcessWebView { - name: "web_view" - min_width: 340 - min_height: 160 - visible: false + layout: @GUI::HorizontalBoxLayout { + spacing: 8 } @GUI::Widget { - fixed_width: 3 + layout: @GUI::VerticalBoxLayout { + spacing: 8 + } + + @GUI::Frame { + name: "tip_frame" + min_width: 340 + min_height: 170 + fill_with_background_color: true + background_role: "Base" + layout: @GUI::HorizontalBoxLayout { + margins: [0, 16, 0, 0] + } + + @GUI::Widget { + fixed_width: 60 + layout: @GUI::VerticalBoxLayout {} + + @GUI::Label { + name: "light_bulb_label" + fixed_height: 60 + icon: "/res/icons/32x32/app-welcome.png" + } + } + + @GUI::Widget { + layout: @GUI::VerticalBoxLayout {} + + @GUI::Label { + fixed_height: 60 + name: "did_you_know_label" + text: "Did you know..." + text_alignment: "CenterLeft" + font_size: 12 + font_weight: "Bold" + } + + @GUI::Label { + name: "tip_label" + text_alignment: "TopLeft" + word_wrap: true + font_size: 12 + } + } + } + + @WebView::OutOfProcessWebView { + name: "web_view" + min_width: 340 + min_height: 170 + visible: false + } + + @GUI::CheckBox { + name: "startup_checkbox" + text: "Show Welcome the next time SerenityOS starts" + } } @GUI::Widget { name: "navigation_column" - fixed_width: 115 - min_height: 160 - layout: @GUI::VerticalBoxLayout {} + fixed_width: 116 + min_height: 170 + layout: @GUI::VerticalBoxLayout { + spacing: 4 + } @GUI::Button { name: "new_button" @@ -78,42 +91,25 @@ @GUI::Button { name: "help_button" text: "Help Contents" + icon: "/res/icons/16x16/book-open.png" } @GUI::Button { name: "next_button" text: "Next Tip" + icon: "/res/icons/16x16/go-forward.png" } @GUI::Layout::Spacer {} @GUI::HorizontalSeparator { - fixed_height: 2 + fixed_height: 10 + } + + @GUI::Button { + name: "close_button" + text: "Close" } } } - - @GUI::Widget { - fixed_height: 5 - } - - @GUI::Widget { - fixed_height: 24 - layout: @GUI::HorizontalBoxLayout {} - - @GUI::CheckBox { - name: "startup_checkbox" - text: "Show Welcome the next time SerenityOS starts" - autosize: true - } - - @GUI::Layout::Spacer {} - - @GUI::Button { - name: "close_button" - text: "Close" - fixed_width: 115 - fixed_height: 24 - } - } }