summaryrefslogtreecommitdiff
path: root/Ladybird/TimerQt.h
blob: 2057cf38b4d9e69b38d623087c93e9fb651f8d59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibWeb/Platform/Timer.h>

class QTimer;

namespace Ladybird {

class TimerQt final : public Web::Platform::Timer {
public:
    static NonnullRefPtr<TimerQt> create();

    virtual ~TimerQt();

    virtual void start() override;
    virtual void start(int interval_ms) override;
    virtual void restart() override;
    virtual void restart(int interval_ms) override;
    virtual void stop() override;

    virtual void set_active(bool) override;

    virtual bool is_active() const override;
    virtual int interval() const override;
    virtual void set_interval(int interval_ms) override;

    virtual bool is_single_shot() const override;
    virtual void set_single_shot(bool) override;

private:
    TimerQt();

    QTimer* m_timer { nullptr };
};

}