tdesktop/Telegram/SourceFiles/core/single_timer.h
John Preston dd81f5d59f Replace base::lambda with shorter term.
base::lambda -> Fn (type alias for std::function).
base::lambda_once -> FnMut (type alias for base::unique_function).
base::lambda_guarded -> crl::guard.
base::lambda_call_type_t -> crl::deduced_call_type.
2018-06-04 18:38:27 +03:00

35 lines
725 B
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "core/basic_types.h"
class SingleTimer : public QTimer { // single shot timer with check
Q_OBJECT
public:
SingleTimer(QObject *parent = nullptr);
void setSingleShot(bool); // is not available
void start(); // is not available
void setTimeoutHandler(Fn<void()> handler);
public slots:
void start(int msec);
void startIfNotActive(int msec);
private slots:
void adjust();
void onTimeout();
private:
TimeMs _finishing = 0;
Fn<void()> _handler;
};