mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:17:35 +00:00
BrowserSettings: Use new GML compiler
This commit is contained in:
parent
6f554af9c5
commit
182126dfda
11 changed files with 59 additions and 32 deletions
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include "AutoplaySettingsWidget.h"
|
||||
#include <Applications/BrowserSettings/AutoplaySettingsWidgetGML.h>
|
||||
#include <Applications/BrowserSettings/Defaults.h>
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
|
@ -28,13 +27,15 @@ void AutoplayAllowlistModel::reset_default_values()
|
|||
did_update(UpdateFlag::InvalidateAllIndices);
|
||||
}
|
||||
|
||||
namespace BrowserSettings {
|
||||
|
||||
ErrorOr<NonnullRefPtr<AutoplaySettingsWidget>> AutoplaySettingsWidget::create()
|
||||
{
|
||||
auto allowlist_model = TRY(try_make_ref_counted<AutoplayAllowlistModel>());
|
||||
TRY(allowlist_model->load());
|
||||
|
||||
auto widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) AutoplaySettingsWidget(move(allowlist_model))));
|
||||
TRY(widget->load_from_gml(autoplay_settings_widget_gml));
|
||||
auto widget = TRY(AutoplaySettingsWidget::try_create());
|
||||
widget->set_allowlist_model(move(allowlist_model));
|
||||
|
||||
widget->m_allow_autoplay_on_all_websites_checkbox = widget->find_descendant_of_type_named<GUI::CheckBox>("allow_autoplay_on_all_websites_checkbox");
|
||||
widget->m_allow_autoplay_on_all_websites_checkbox->set_checked(Config::read_bool("Browser"sv, "Preferences"sv, "AllowAutoplayOnAllWebsites"sv, Browser::default_allow_autoplay_on_all_websites), GUI::AllowCallback::No);
|
||||
|
@ -71,9 +72,9 @@ ErrorOr<NonnullRefPtr<AutoplaySettingsWidget>> AutoplaySettingsWidget::create()
|
|||
return widget;
|
||||
}
|
||||
|
||||
AutoplaySettingsWidget::AutoplaySettingsWidget(NonnullRefPtr<AutoplayAllowlistModel> allowlist_model)
|
||||
: m_allowlist_model(move(allowlist_model))
|
||||
void AutoplaySettingsWidget::set_allowlist_model(NonnullRefPtr<AutoplayAllowlistModel> model)
|
||||
{
|
||||
m_allowlist_model = model;
|
||||
}
|
||||
|
||||
void AutoplaySettingsWidget::apply_settings()
|
||||
|
@ -87,3 +88,5 @@ void AutoplaySettingsWidget::reset_default_values()
|
|||
m_allowlist_model->reset_default_values();
|
||||
m_allow_autoplay_on_all_websites_checkbox->set_checked(Browser::default_allow_autoplay_on_all_websites);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue