LibCore: Remove CTimer::create() overloads in favor of construct()
This commit is contained in:
parent
9e00651e14
commit
f4b51a63ec
Notes:
sideshowbarker
2024-07-19 12:01:31 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/f4b51a63ec0
13 changed files with 14 additions and 24 deletions
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
SprayTool::SprayTool()
|
SprayTool::SprayTool()
|
||||||
{
|
{
|
||||||
m_timer = CTimer::create();
|
m_timer = CTimer::construct();
|
||||||
m_timer->on_timeout = [&]() {
|
m_timer->on_timeout = [&]() {
|
||||||
paint_it();
|
paint_it();
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,7 +52,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
auto next_sample_buffer = loader.get_more_samples();
|
auto next_sample_buffer = loader.get_more_samples();
|
||||||
|
|
||||||
auto timer = CTimer::create(100, [&] {
|
auto timer = CTimer::construct(100, [&] {
|
||||||
if (!next_sample_buffer) {
|
if (!next_sample_buffer) {
|
||||||
sample_widget->set_buffer(nullptr);
|
sample_widget->set_buffer(nullptr);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -55,7 +55,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GWidget* parent)
|
||||||
net_tcp_fields.empend("bytes_out", "Bytes Out", TextAlignment::CenterRight);
|
net_tcp_fields.empend("bytes_out", "Bytes Out", TextAlignment::CenterRight);
|
||||||
m_socket_table_view->set_model(GJsonArrayModel::create("/proc/net/tcp", move(net_tcp_fields)));
|
m_socket_table_view->set_model(GJsonArrayModel::create("/proc/net/tcp", move(net_tcp_fields)));
|
||||||
|
|
||||||
m_update_timer = CTimer::create(
|
m_update_timer = CTimer::construct(
|
||||||
1000, [this] {
|
1000, [this] {
|
||||||
update_models();
|
update_models();
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,7 @@ ProcessStacksWidget::ProcessStacksWidget(GWidget* parent)
|
||||||
m_stacks_editor = GTextEditor::construct(GTextEditor::Type::MultiLine, this);
|
m_stacks_editor = GTextEditor::construct(GTextEditor::Type::MultiLine, this);
|
||||||
m_stacks_editor->set_readonly(true);
|
m_stacks_editor->set_readonly(true);
|
||||||
|
|
||||||
m_timer = CTimer::create(1000, [this] { refresh(); }, this);
|
m_timer = CTimer::construct(1000, [this] { refresh(); }, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessStacksWidget::~ProcessStacksWidget()
|
ProcessStacksWidget::~ProcessStacksWidget()
|
||||||
|
|
|
@ -111,7 +111,7 @@ int main(int argc, char** argv)
|
||||||
auto* process_table_view = new ProcessTableView(*cpu_graph, process_table_container);
|
auto* process_table_view = new ProcessTableView(*cpu_graph, process_table_container);
|
||||||
auto* memory_stats_widget = new MemoryStatsWidget(*memory_graph, graphs_container);
|
auto* memory_stats_widget = new MemoryStatsWidget(*memory_graph, graphs_container);
|
||||||
|
|
||||||
auto refresh_timer = CTimer::create(1000, [&] {
|
auto refresh_timer = CTimer::construct(1000, [&] {
|
||||||
process_table_view->refresh();
|
process_table_view->refresh();
|
||||||
memory_stats_widget->refresh();
|
memory_stats_widget->refresh();
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,8 +25,8 @@ TerminalWidget::TerminalWidget(int ptm_fd, RefPtr<CConfigFile> config)
|
||||||
, m_notifier(CNotifier::construct(ptm_fd, CNotifier::Read))
|
, m_notifier(CNotifier::construct(ptm_fd, CNotifier::Read))
|
||||||
, m_config(move(config))
|
, m_config(move(config))
|
||||||
{
|
{
|
||||||
m_cursor_blink_timer = CTimer::create();
|
m_cursor_blink_timer = CTimer::construct();
|
||||||
m_visual_beep_timer = CTimer::create();
|
m_visual_beep_timer = CTimer::construct();
|
||||||
|
|
||||||
set_frame_shape(FrameShape::Container);
|
set_frame_shape(FrameShape::Container);
|
||||||
set_frame_shadow(FrameShadow::Sunken);
|
set_frame_shadow(FrameShadow::Sunken);
|
||||||
|
|
|
@ -44,7 +44,7 @@ int main(int argc, char** argv)
|
||||||
button2->set_enabled(false);
|
button2->set_enabled(false);
|
||||||
|
|
||||||
auto progress1 = GProgressBar::construct(main_widget);
|
auto progress1 = GProgressBar::construct(main_widget);
|
||||||
auto timer = CTimer::create(100, [&] {
|
auto timer = CTimer::construct(100, [&] {
|
||||||
progress1->set_value(progress1->value() + 1);
|
progress1->set_value(progress1->value() + 1);
|
||||||
if (progress1->value() == progress1->max())
|
if (progress1->value() == progress1->max())
|
||||||
progress1->set_value(progress1->min());
|
progress1->set_value(progress1->min());
|
||||||
|
|
|
@ -101,7 +101,7 @@ Field::Field(GLabel& flag_label, GLabel& time_label, GButton& face_button, GWidg
|
||||||
, m_on_size_changed(move(on_size_changed))
|
, m_on_size_changed(move(on_size_changed))
|
||||||
{
|
{
|
||||||
srand(time(nullptr));
|
srand(time(nullptr));
|
||||||
m_timer = CTimer::create();
|
m_timer = CTimer::construct();
|
||||||
m_timer->on_timeout = [this] {
|
m_timer->on_timeout = [this] {
|
||||||
++m_time_elapsed;
|
++m_time_elapsed;
|
||||||
m_time_label.set_text(String::format("%u.%u", m_time_elapsed / 10, m_time_elapsed % 10));
|
m_time_label.set_text(String::format("%u.%u", m_time_elapsed / 10, m_time_elapsed % 10));
|
||||||
|
|
|
@ -7,16 +7,6 @@
|
||||||
class CTimer final : public CObject {
|
class CTimer final : public CObject {
|
||||||
C_OBJECT(CTimer)
|
C_OBJECT(CTimer)
|
||||||
public:
|
public:
|
||||||
static ObjectPtr<CTimer> create(CObject* parent = nullptr)
|
|
||||||
{
|
|
||||||
return new CTimer(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ObjectPtr<CTimer> create(int interval, Function<void()>&& timeout_handler, CObject* parent = nullptr)
|
|
||||||
{
|
|
||||||
return new CTimer(interval, move(timeout_handler), parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~CTimer() override;
|
virtual ~CTimer() override;
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
|
|
|
@ -10,7 +10,7 @@ GAbstractButton::GAbstractButton(const StringView& text, GWidget* parent)
|
||||||
: GWidget(parent)
|
: GWidget(parent)
|
||||||
, m_text(text)
|
, m_text(text)
|
||||||
{
|
{
|
||||||
m_auto_repeat_timer = CTimer::create(this);
|
m_auto_repeat_timer = CTimer::construct(this);
|
||||||
m_auto_repeat_timer->on_timeout = [this] {
|
m_auto_repeat_timer->on_timeout = [this] {
|
||||||
click();
|
click();
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,7 +61,7 @@ GScrollBar::GScrollBar(Orientation orientation, GWidget* parent)
|
||||||
: GWidget(parent)
|
: GWidget(parent)
|
||||||
, m_orientation(orientation)
|
, m_orientation(orientation)
|
||||||
{
|
{
|
||||||
m_automatic_scrolling_timer = CTimer::create(this);
|
m_automatic_scrolling_timer = CTimer::construct(this);
|
||||||
if (!s_up_arrow_bitmap)
|
if (!s_up_arrow_bitmap)
|
||||||
s_up_arrow_bitmap = &CharacterBitmap::create_from_ascii(s_up_arrow_bitmap_data, 9, 9).leak_ref();
|
s_up_arrow_bitmap = &CharacterBitmap::create_from_ascii(s_up_arrow_bitmap_data, 9, 9).leak_ref();
|
||||||
if (!s_down_arrow_bitmap)
|
if (!s_down_arrow_bitmap)
|
||||||
|
|
|
@ -32,8 +32,8 @@ WallpaperMode mode_to_enum(const String& name)
|
||||||
|
|
||||||
WSCompositor::WSCompositor()
|
WSCompositor::WSCompositor()
|
||||||
{
|
{
|
||||||
m_compose_timer = CTimer::create(this);
|
m_compose_timer = CTimer::construct(this);
|
||||||
m_immediate_compose_timer = CTimer::create(this);
|
m_immediate_compose_timer = CTimer::construct(this);
|
||||||
|
|
||||||
m_screen_can_set_buffer = WSScreen::the().can_set_buffer();
|
m_screen_can_set_buffer = WSScreen::the().can_set_buffer();
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ WSMenuManager::WSMenuManager()
|
||||||
{
|
{
|
||||||
m_username = getlogin();
|
m_username = getlogin();
|
||||||
|
|
||||||
m_timer = CTimer::create(300, [this] {
|
m_timer = CTimer::construct(300, [this] {
|
||||||
static time_t last_update_time;
|
static time_t last_update_time;
|
||||||
time_t now = time(nullptr);
|
time_t now = time(nullptr);
|
||||||
if (now != last_update_time || m_cpu_monitor.is_dirty()) {
|
if (now != last_update_time || m_cpu_monitor.is_dirty()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue