1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:07:45 +00:00

CalendarSettings: Use new GML compiler

This commit is contained in:
kleines Filmröllchen 2023-05-26 21:32:39 +02:00 committed by Sam Atkins
parent 14a99bb22d
commit 63687c46ff
5 changed files with 20 additions and 16 deletions

View file

@ -7,12 +7,13 @@
#include "CalendarSettingsWidget.h"
#include <AK/DateConstants.h>
#include <Applications/CalendarSettings/CalendarSettingsWidgetGML.h>
#include <LibConfig/Client.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/ItemListModel.h>
#include <LibGUI/SpinBox.h>
namespace CalendarSettings {
void CalendarSettingsWidget::apply_settings()
{
Config::write_string("Calendar"sv, "View"sv, "FirstDayOfWeek"sv, m_first_day_of_week_combobox->text());
@ -29,17 +30,15 @@ void CalendarSettingsWidget::reset_default_values()
m_default_view_combobox->set_text("Month");
}
ErrorOr<NonnullRefPtr<CalendarSettingsWidget>> CalendarSettingsWidget::try_create()
ErrorOr<NonnullRefPtr<CalendarSettingsWidget>> CalendarSettingsWidget::create()
{
auto widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) CalendarSettingsWidget()));
auto widget = TRY(try_create());
TRY(widget->setup());
return widget;
}
ErrorOr<void> CalendarSettingsWidget::setup()
{
TRY(load_from_gml(calendar_settings_widget_gml));
m_first_day_of_week_combobox = *find_descendant_of_type_named<GUI::ComboBox>("first_day_of_week");
m_first_day_of_week_combobox->set_text(Config::read_string("Calendar"sv, "View"sv, "FirstDayOfWeek"sv, "Sunday"sv));
m_first_day_of_week_combobox->set_only_allow_values_from_model(true);
@ -71,3 +70,5 @@ ErrorOr<void> CalendarSettingsWidget::setup()
};
return {};
}
}