mirror-chatterino2/src/common/NetworkTimer.hpp
pajlada 2ea3643100
Fix timer stuff (#580)
* Add and sort Network files to chatterino project file
2018-07-07 15:50:05 +02:00

36 lines
654 B
C++

#pragma once
#include <functional>
class QTimer;
namespace chatterino {
class NetworkWorker;
class NetworkTimer
{
QTimer *timer_ = nullptr;
bool started_{};
public:
int timeoutMS_ = -1;
NetworkTimer() = default;
~NetworkTimer() = default;
NetworkTimer(const NetworkTimer &other) = delete;
NetworkTimer &operator=(const NetworkTimer &other) = delete;
NetworkTimer(NetworkTimer &&other) = default;
NetworkTimer &operator=(NetworkTimer &&other) = default;
void start();
void onTimeout(NetworkWorker *worker, std::function<void()> cb) const;
bool isStarted() const;
};
} // namespace chatterino