mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:17:35 +00:00
DisplaySettings: Propagate errors in FontSettingsWidget
This commit is contained in:
parent
00be9eb210
commit
682bff4c49
2 changed files with 15 additions and 4 deletions
|
@ -17,9 +17,16 @@ namespace DisplaySettings {
|
||||||
|
|
||||||
static void update_label_with_font(GUI::Label&, Gfx::Font const&);
|
static void update_label_with_font(GUI::Label&, Gfx::Font const&);
|
||||||
|
|
||||||
FontSettingsWidget::FontSettingsWidget()
|
ErrorOr<NonnullRefPtr<FontSettingsWidget>> FontSettingsWidget::try_create()
|
||||||
{
|
{
|
||||||
load_from_gml(font_settings_gml).release_value_but_fixme_should_propagate_errors();
|
auto font_settings_widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) FontSettingsWidget()));
|
||||||
|
TRY(font_settings_widget->setup_interface());
|
||||||
|
return font_settings_widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorOr<void> FontSettingsWidget::setup_interface()
|
||||||
|
{
|
||||||
|
TRY(load_from_gml(font_settings_gml));
|
||||||
|
|
||||||
auto& default_font = Gfx::FontDatabase::default_font();
|
auto& default_font = Gfx::FontDatabase::default_font();
|
||||||
m_default_font_label = *find_descendant_of_type_named<GUI::Label>("default_font_label");
|
m_default_font_label = *find_descendant_of_type_named<GUI::Label>("default_font_label");
|
||||||
|
@ -59,6 +66,8 @@ FontSettingsWidget::FontSettingsWidget()
|
||||||
set_modified(true);
|
set_modified(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_label_with_font(GUI::Label& label, Gfx::Font const& font)
|
static void update_label_with_font(GUI::Label& label, Gfx::Font const& font)
|
||||||
|
|
|
@ -13,15 +13,17 @@
|
||||||
namespace DisplaySettings {
|
namespace DisplaySettings {
|
||||||
|
|
||||||
class FontSettingsWidget final : public GUI::SettingsWindow::Tab {
|
class FontSettingsWidget final : public GUI::SettingsWindow::Tab {
|
||||||
C_OBJECT(FontSettingsWidget);
|
C_OBJECT_ABSTRACT(FontSettingsWidget);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static ErrorOr<NonnullRefPtr<FontSettingsWidget>> try_create();
|
||||||
virtual ~FontSettingsWidget() override = default;
|
virtual ~FontSettingsWidget() override = default;
|
||||||
|
|
||||||
virtual void apply_settings() override;
|
virtual void apply_settings() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FontSettingsWidget();
|
FontSettingsWidget() = default;
|
||||||
|
ErrorOr<void> setup_interface();
|
||||||
|
|
||||||
RefPtr<GUI::Label> m_default_font_label;
|
RefPtr<GUI::Label> m_default_font_label;
|
||||||
RefPtr<GUI::Label> m_window_title_font_label;
|
RefPtr<GUI::Label> m_window_title_font_label;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue