mirror of
https://github.com/RGBCube/serenity
synced 2025-07-19 13:07:40 +00:00
FontEditor: Propagate errors when loading GML
This commit is contained in:
parent
1a30439b11
commit
5ec9654477
2 changed files with 19 additions and 12 deletions
|
@ -59,6 +59,18 @@ static constexpr Array pangrams = {
|
||||||
"<fox color=\"brown\" speed=\"quick\" jumps=\"over\">lazy dog</fox>"sv
|
"<fox color=\"brown\" speed=\"quick\" jumps=\"over\">lazy dog</fox>"sv
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ErrorOr<NonnullRefPtr<MainWidget>> MainWidget::try_create()
|
||||||
|
{
|
||||||
|
auto main_widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) MainWidget()));
|
||||||
|
TRY(main_widget->create_widgets());
|
||||||
|
TRY(main_widget->create_actions());
|
||||||
|
TRY(main_widget->create_models());
|
||||||
|
TRY(main_widget->create_toolbars());
|
||||||
|
TRY(main_widget->create_undo_stack());
|
||||||
|
|
||||||
|
return main_widget;
|
||||||
|
}
|
||||||
|
|
||||||
ErrorOr<RefPtr<GUI::Window>> MainWidget::create_preview_window()
|
ErrorOr<RefPtr<GUI::Window>> MainWidget::create_preview_window()
|
||||||
{
|
{
|
||||||
auto window = TRY(GUI::Window::try_create(this));
|
auto window = TRY(GUI::Window::try_create(this));
|
||||||
|
@ -433,9 +445,9 @@ ErrorOr<void> MainWidget::create_undo_stack()
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWidget::MainWidget()
|
ErrorOr<void> MainWidget::create_widgets()
|
||||||
{
|
{
|
||||||
load_from_gml(font_editor_window_gml).release_value_but_fixme_should_propagate_errors();
|
TRY(load_from_gml(font_editor_window_gml));
|
||||||
|
|
||||||
m_font_metadata_groupbox = find_descendant_of_type_named<GUI::GroupBox>("font_metadata_groupbox");
|
m_font_metadata_groupbox = find_descendant_of_type_named<GUI::GroupBox>("font_metadata_groupbox");
|
||||||
m_unicode_block_container = find_descendant_of_type_named<GUI::Widget>("unicode_block_container");
|
m_unicode_block_container = find_descendant_of_type_named<GUI::Widget>("unicode_block_container");
|
||||||
|
@ -603,6 +615,8 @@ MainWidget::MainWidget()
|
||||||
GUI::Application::the()->on_action_leave = [this](GUI::Action&) {
|
GUI::Application::the()->on_action_leave = [this](GUI::Action&) {
|
||||||
m_statusbar->set_override_text({});
|
m_statusbar->set_override_text({});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<void> MainWidget::initialize(StringView path, RefPtr<Gfx::BitmapFont>&& edited_font)
|
ErrorOr<void> MainWidget::initialize(StringView path, RefPtr<Gfx::BitmapFont>&& edited_font)
|
||||||
|
|
|
@ -22,15 +22,7 @@ class GlyphEditorWidget;
|
||||||
class MainWidget final : public GUI::Widget {
|
class MainWidget final : public GUI::Widget {
|
||||||
C_OBJECT(MainWidget)
|
C_OBJECT(MainWidget)
|
||||||
public:
|
public:
|
||||||
static ErrorOr<NonnullRefPtr<MainWidget>> try_create()
|
static ErrorOr<NonnullRefPtr<MainWidget>> try_create();
|
||||||
{
|
|
||||||
NonnullRefPtr<MainWidget> font_editor = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) MainWidget()));
|
|
||||||
TRY(font_editor->create_actions());
|
|
||||||
TRY(font_editor->create_models());
|
|
||||||
TRY(font_editor->create_toolbars());
|
|
||||||
TRY(font_editor->create_undo_stack());
|
|
||||||
return font_editor;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~MainWidget() override = default;
|
virtual ~MainWidget() override = default;
|
||||||
|
|
||||||
|
@ -58,8 +50,9 @@ public:
|
||||||
void set_show_system_emoji(bool);
|
void set_show_system_emoji(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWidget();
|
MainWidget() = default;
|
||||||
|
|
||||||
|
ErrorOr<void> create_widgets();
|
||||||
ErrorOr<void> create_actions();
|
ErrorOr<void> create_actions();
|
||||||
ErrorOr<void> create_models();
|
ErrorOr<void> create_models();
|
||||||
ErrorOr<void> create_toolbars();
|
ErrorOr<void> create_toolbars();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue