Skip to content

Commit

Permalink
LibCore: Remove CTimer::create() overloads in favor of construct()
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Sep 21, 2019
1 parent 9e00651 commit f4b51a6
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Applications/PaintBrush/SprayTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

SprayTool::SprayTool()
{
m_timer = CTimer::create();
m_timer = CTimer::construct();
m_timer->on_timeout = [&]() {
paint_it();
};
Expand Down
2 changes: 1 addition & 1 deletion Applications/SoundPlayer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Applications/SystemMonitor/NetworkStatisticsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
Expand Down
2 changes: 1 addition & 1 deletion Applications/SystemMonitor/ProcessStacksWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion Applications/SystemMonitor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
4 changes: 2 additions & 2 deletions Applications/Terminal/TerminalWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Demos/WidgetGallery/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion Games/Minesweeper/Field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
10 changes: 0 additions & 10 deletions Libraries/LibCore/CTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Libraries/LibGUI/GAbstractButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down
2 changes: 1 addition & 1 deletion Libraries/LibGUI/GScrollBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Servers/WindowServer/WSCompositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion Servers/WindowServer/WSMenuManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit f4b51a6

Please sign in to comment.