浏览代码

LibCore: Remove CTimer::create() overloads in favor of construct()

Andreas Kling 5 年之前
父节点
当前提交
f4b51a63ec

+ 1 - 1
Applications/PaintBrush/SprayTool.cpp

@@ -11,7 +11,7 @@
 
 SprayTool::SprayTool()
 {
-    m_timer = CTimer::create();
+    m_timer = CTimer::construct();
     m_timer->on_timeout = [&]() {
         paint_it();
     };

+ 1 - 1
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;

+ 1 - 1
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();
         },

+ 1 - 1
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()

+ 1 - 1
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();
     });

+ 2 - 2
Applications/Terminal/TerminalWidget.cpp

@@ -25,8 +25,8 @@ TerminalWidget::TerminalWidget(int ptm_fd, RefPtr<CConfigFile> 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);

+ 1 - 1
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());

+ 1 - 1
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));

+ 0 - 10
Libraries/LibCore/CTimer.h

@@ -7,16 +7,6 @@
 class CTimer final : public CObject {
     C_OBJECT(CTimer)
 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;
 
     void start();

+ 1 - 1
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();
     };

+ 1 - 1
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)

+ 2 - 2
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();
 

+ 1 - 1
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()) {