1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 19:27: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

@ -31,8 +31,7 @@
#include <unistd.h>
HexEditor::HexEditor()
: m_blink_timer(Core::Timer::construct())
, m_document(make<HexDocumentMemory>(ByteBuffer::create_zeroed(0).release_value_but_fixme_should_propagate_errors()))
: m_document(make<HexDocumentMemory>(ByteBuffer::create_zeroed(0).release_value_but_fixme_should_propagate_errors()))
{
set_should_hide_unnecessary_scrollbars(true);
set_focus_policy(GUI::FocusPolicy::StrongFocus);
@ -42,11 +41,10 @@ HexEditor::HexEditor()
set_foreground_role(ColorRole::BaseText);
vertical_scrollbar().set_step(line_height());
m_blink_timer->set_interval(500);
m_blink_timer->on_timeout = [this]() {
m_blink_timer = Core::Timer::create_repeating(500, [this]() {
m_cursor_blink_active = !m_cursor_blink_active;
update();
};
}).release_value_but_fixme_should_propagate_errors();
m_blink_timer->start();
}

View file

@ -85,7 +85,7 @@ private:
size_t m_position { 0 };
bool m_cursor_at_low_nibble { false };
EditMode m_edit_mode { Hex };
NonnullRefPtr<Core::Timer> m_blink_timer;
RefPtr<Core::Timer> m_blink_timer;
bool m_cursor_blink_active { false };
NonnullOwnPtr<HexDocument> m_document;
GUI::UndoStack m_undo_stack;