AboutDialog: Port to GML Complier

This commit is contained in:
Aarushi Chauhan 2024-01-31 19:20:44 +05:30 committed by Andrew Kaster
parent ea59bfaae7
commit 564e619f57
Notes: sideshowbarker 2024-07-19 16:49:45 +09:00
4 changed files with 29 additions and 6 deletions

View file

@ -8,7 +8,7 @@
#include <AK/StringBuilder.h>
#include <LibGUI/AboutDialog.h>
#include <LibGUI/AboutDialogGML.h>
#include <LibGUI/AboutDialogWidget.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/ImageWidget.h>
@ -24,8 +24,8 @@ NonnullRefPtr<AboutDialog> AboutDialog::create(String const& name, String versio
auto dialog = adopt_ref(*new AboutDialog(name, version, icon, parent_window));
dialog->set_title(ByteString::formatted("About {}", name));
auto widget = dialog->set_main_widget<Widget>();
MUST(widget->load_from_gml(about_dialog_gml));
auto widget = AboutDialogWidget::try_create().release_value_but_fixme_should_propagate_errors();
dialog->set_main_widget(widget);
auto icon_wrapper = widget->find_descendant_of_type_named<Widget>("icon_wrapper");
if (icon) {

View file

@ -1,4 +1,4 @@
@GUI::Frame {
@GUI::AboutDialogWidget {
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
spacing: 0

View file

@ -0,0 +1,23 @@
/*
* Copyright (c) 2024, Aarushi Chauhan <aarushi595.chauhan@gmail.com>.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Frame.h>
namespace GUI {
class AboutDialogWidget : public GUI::Widget {
C_OBJECT_ABSTRACT(AboutDialogWidget)
public:
static ErrorOr<NonnullRefPtr<AboutDialogWidget>> try_create();
virtual ~AboutDialogWidget() override = default;
private:
AboutDialogWidget() = default;
};
}

View file

@ -1,6 +1,6 @@
compile_gml(DynamicWidgetContainerControls.gml DynamicWidgetContainerControls.cpp)
stringify_gml(AboutDialog.gml AboutDialogGML.h about_dialog_gml)
compile_gml(AboutDialog.gml AboutDialogGML.cpp)
stringify_gml(DatePickerDialog.gml DatePickerDialogGML.h date_picker_dialog_gml)
stringify_gml(EmojiInputDialog.gml EmojiInputDialogGML.h emoji_input_dialog_gml)
stringify_gml(FontPickerDialog.gml FontPickerDialogGML.h font_picker_dialog_gml)
@ -10,6 +10,7 @@ stringify_gml(PasswordInputDialog.gml PasswordInputDialogGML.h password_input_di
set(SOURCES
AboutDialog.cpp
AboutDialogGML.cpp
AbstractButton.cpp
AbstractScrollableWidget.cpp
AbstractSlider.cpp
@ -146,7 +147,6 @@ set(GENERATED_SOURCES
../../Services/WindowServer/WindowManagerClientEndpoint.h
../../Services/WindowServer/WindowManagerServerEndpoint.h
../../Services/WindowServer/WindowServerEndpoint.h
AboutDialogGML.h
DatePickerDialogGML.h
EmojiInputDialogGML.h
FilePickerDialogGML.h