From f4b51a63ec085db62ea2c122ee6ba93eeef62594 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 21 Sep 2019 18:13:17 +0200 Subject: LibCore: Remove CTimer::create() overloads in favor of construct() --- Applications/PaintBrush/SprayTool.cpp | 2 +- Applications/SoundPlayer/main.cpp | 2 +- Applications/SystemMonitor/NetworkStatisticsWidget.cpp | 2 +- Applications/SystemMonitor/ProcessStacksWidget.cpp | 2 +- Applications/SystemMonitor/main.cpp | 2 +- Applications/Terminal/TerminalWidget.cpp | 4 ++-- Demos/WidgetGallery/main.cpp | 2 +- Games/Minesweeper/Field.cpp | 2 +- Libraries/LibCore/CTimer.h | 10 ---------- Libraries/LibGUI/GAbstractButton.cpp | 2 +- Libraries/LibGUI/GScrollBar.cpp | 2 +- Servers/WindowServer/WSCompositor.cpp | 4 ++-- Servers/WindowServer/WSMenuManager.cpp | 2 +- 13 files changed, 14 insertions(+), 24 deletions(-) diff --git a/Applications/PaintBrush/SprayTool.cpp b/Applications/PaintBrush/SprayTool.cpp index 1ebb3456b7..fb473fda0e 100644 --- a/Applications/PaintBrush/SprayTool.cpp +++ b/Applications/PaintBrush/SprayTool.cpp @@ -11,7 +11,7 @@ SprayTool::SprayTool() { - m_timer = CTimer::create(); + m_timer = CTimer::construct(); m_timer->on_timeout = [&]() { paint_it(); }; diff --git a/Applications/SoundPlayer/main.cpp b/Applications/SoundPlayer/main.cpp index f3f77ad6f1..e5a2c95188 100644 --- a/Applications/SoundPlayer/main.cpp +++ b/Applications/SoundPlayer/main.cpp @@ -52,7 +52,7 @@ int main(int argc, char** argv) auto next_sample_buffer = loader.get_more_samples(); - auto timer = CTimer::create(100, [&] { + auto timer = CTimer::construct(100, [&] { if (!next_sample_buffer) { sample_widget->set_buffer(nullptr); return; diff --git a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp index ae4573aa75..38e7b9a1bb 100644 --- a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp +++ b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp @@ -55,7 +55,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GWidget* parent) 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_update_timer = CTimer::create( + m_update_timer = CTimer::construct( 1000, [this] { update_models(); }, diff --git a/Applications/SystemMonitor/ProcessStacksWidget.cpp b/Applications/SystemMonitor/ProcessStacksWidget.cpp index d9f28322d7..c54ffba358 100644 --- a/Applications/SystemMonitor/ProcessStacksWidget.cpp +++ b/Applications/SystemMonitor/ProcessStacksWidget.cpp @@ -11,7 +11,7 @@ ProcessStacksWidget::ProcessStacksWidget(GWidget* parent) m_stacks_editor = GTextEditor::construct(GTextEditor::Type::MultiLine, this); m_stacks_editor->set_readonly(true); - m_timer = CTimer::create(1000, [this] { refresh(); }, this); + m_timer = CTimer::construct(1000, [this] { refresh(); }, this); } ProcessStacksWidget::~ProcessStacksWidget() diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp index 793a45cc41..1cf905d0a6 100644 --- a/Applications/SystemMonitor/main.cpp +++ b/Applications/SystemMonitor/main.cpp @@ -111,7 +111,7 @@ int main(int argc, char** argv) auto* process_table_view = new ProcessTableView(*cpu_graph, process_table_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(); memory_stats_widget->refresh(); }); diff --git a/Applications/Terminal/TerminalWidget.cpp b/Applications/Terminal/TerminalWidget.cpp index 67a8305958..4ab16c1520 100644 --- a/Applications/Terminal/TerminalWidget.cpp +++ b/Applications/Terminal/TerminalWidget.cpp @@ -25,8 +25,8 @@ TerminalWidget::TerminalWidget(int ptm_fd, RefPtr config) , m_notifier(CNotifier::construct(ptm_fd, CNotifier::Read)) , m_config(move(config)) { - m_cursor_blink_timer = CTimer::create(); - m_visual_beep_timer = CTimer::create(); + m_cursor_blink_timer = CTimer::construct(); + m_visual_beep_timer = CTimer::construct(); set_frame_shape(FrameShape::Container); set_frame_shadow(FrameShadow::Sunken); diff --git a/Demos/WidgetGallery/main.cpp b/Demos/WidgetGallery/main.cpp index fcbbf00ed2..788acf440e 100755 --- a/Demos/WidgetGallery/main.cpp +++ b/Demos/WidgetGallery/main.cpp @@ -44,7 +44,7 @@ int main(int argc, char** argv) button2->set_enabled(false); auto progress1 = GProgressBar::construct(main_widget); - auto timer = CTimer::create(100, [&] { + auto timer = CTimer::construct(100, [&] { progress1->set_value(progress1->value() + 1); if (progress1->value() == progress1->max()) progress1->set_value(progress1->min()); diff --git a/Games/Minesweeper/Field.cpp b/Games/Minesweeper/Field.cpp index 21870f55ef..10cdb9b115 100644 --- a/Games/Minesweeper/Field.cpp +++ b/Games/Minesweeper/Field.cpp @@ -101,7 +101,7 @@ Field::Field(GLabel& flag_label, GLabel& time_label, GButton& face_button, GWidg , m_on_size_changed(move(on_size_changed)) { srand(time(nullptr)); - m_timer = CTimer::create(); + m_timer = CTimer::construct(); m_timer->on_timeout = [this] { ++m_time_elapsed; m_time_label.set_text(String::format("%u.%u", m_time_elapsed / 10, m_time_elapsed % 10)); diff --git a/Libraries/LibCore/CTimer.h b/Libraries/LibCore/CTimer.h index 611dd37788..2df70ee5d3 100644 --- a/Libraries/LibCore/CTimer.h +++ b/Libraries/LibCore/CTimer.h @@ -7,16 +7,6 @@ class CTimer final : public CObject { C_OBJECT(CTimer) public: - static ObjectPtr create(CObject* parent = nullptr) - { - return new CTimer(parent); - } - - static ObjectPtr create(int interval, Function&& timeout_handler, CObject* parent = nullptr) - { - return new CTimer(interval, move(timeout_handler), parent); - } - virtual ~CTimer() override; void start(); diff --git a/Libraries/LibGUI/GAbstractButton.cpp b/Libraries/LibGUI/GAbstractButton.cpp index f0f3901f91..91b4e43aad 100644 --- a/Libraries/LibGUI/GAbstractButton.cpp +++ b/Libraries/LibGUI/GAbstractButton.cpp @@ -10,7 +10,7 @@ GAbstractButton::GAbstractButton(const StringView& text, GWidget* parent) : GWidget(parent) , m_text(text) { - m_auto_repeat_timer = CTimer::create(this); + m_auto_repeat_timer = CTimer::construct(this); m_auto_repeat_timer->on_timeout = [this] { click(); }; diff --git a/Libraries/LibGUI/GScrollBar.cpp b/Libraries/LibGUI/GScrollBar.cpp index dd57396306..6df7569dce 100644 --- a/Libraries/LibGUI/GScrollBar.cpp +++ b/Libraries/LibGUI/GScrollBar.cpp @@ -61,7 +61,7 @@ GScrollBar::GScrollBar(Orientation orientation, GWidget* parent) : GWidget(parent) , m_orientation(orientation) { - m_automatic_scrolling_timer = CTimer::create(this); + m_automatic_scrolling_timer = CTimer::construct(this); if (!s_up_arrow_bitmap) s_up_arrow_bitmap = &CharacterBitmap::create_from_ascii(s_up_arrow_bitmap_data, 9, 9).leak_ref(); if (!s_down_arrow_bitmap) diff --git a/Servers/WindowServer/WSCompositor.cpp b/Servers/WindowServer/WSCompositor.cpp index 3e78f80e0d..31b59ad412 100644 --- a/Servers/WindowServer/WSCompositor.cpp +++ b/Servers/WindowServer/WSCompositor.cpp @@ -32,8 +32,8 @@ WallpaperMode mode_to_enum(const String& name) WSCompositor::WSCompositor() { - m_compose_timer = CTimer::create(this); - m_immediate_compose_timer = CTimer::create(this); + m_compose_timer = CTimer::construct(this); + m_immediate_compose_timer = CTimer::construct(this); m_screen_can_set_buffer = WSScreen::the().can_set_buffer(); diff --git a/Servers/WindowServer/WSMenuManager.cpp b/Servers/WindowServer/WSMenuManager.cpp index cbdf2e84fc..a02362ccb2 100644 --- a/Servers/WindowServer/WSMenuManager.cpp +++ b/Servers/WindowServer/WSMenuManager.cpp @@ -10,7 +10,7 @@ WSMenuManager::WSMenuManager() { m_username = getlogin(); - m_timer = CTimer::create(300, [this] { + m_timer = CTimer::construct(300, [this] { static time_t last_update_time; time_t now = time(nullptr); if (now != last_update_time || m_cpu_monitor.is_dirty()) { -- cgit v1.2.3