1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 17:57:36 +00:00

Userland: Use Core::Timer::create_foo() factory functions where possible

This commit is contained in:
Sam Atkins 2023-01-11 20:00:46 +00:00 committed by Andreas Kling
parent 6edc0cf5ab
commit e181b1cb82
12 changed files with 37 additions and 51 deletions

View file

@ -66,17 +66,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
(void)TRY(advice_widget->try_set_layout<GUI::VerticalBoxLayout>());
advice_widget->layout()->set_spacing(0);
auto advice_timer = TRY(Core::Timer::try_create());
advice_timer->set_interval(15'000);
advice_timer->set_single_shot(true);
advice_timer->on_timeout = [&] {
auto advice_timer = TRY(Core::Timer::create_single_shot(15'000, [&] {
window->move_to_front();
advice_window->move_to_front();
catdog_widget->set_roaming(false);
advice_window->move_to(window->x() - advice_window->width() / 2, window->y() - advice_window->height());
advice_window->show();
advice_window->set_always_on_top();
};
}));
advice_timer->start();
advice_widget->on_dismiss = [&] {