2014-09-25 01:03:18 +06:00
|
|
|
/*
|
|
|
|
* qca_safetimer.h - Qt Cryptographic Architecture
|
|
|
|
* Copyright (C) 2014 Ivan Romanov <drizt@land.ru>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
* 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QCA_SAFETIMER_H
|
|
|
|
#define QCA_SAFETIMER_H
|
|
|
|
|
2014-09-27 01:06:37 +06:00
|
|
|
#include "qca_export.h"
|
2014-09-25 01:03:18 +06:00
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
class QEvent;
|
|
|
|
class QTimerEvent;
|
|
|
|
|
|
|
|
namespace QCA {
|
|
|
|
|
2014-09-27 01:06:37 +06:00
|
|
|
class QCA_EXPORT SafeTimer : public QObject
|
2014-09-25 01:03:18 +06:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-01-20 13:37:51 +01:00
|
|
|
SafeTimer(QObject *parent = nullptr);
|
2020-02-09 01:21:32 +01:00
|
|
|
~SafeTimer() override;
|
2014-09-25 01:03:18 +06:00
|
|
|
|
|
|
|
int interval() const;
|
|
|
|
bool isActive() const;
|
|
|
|
bool isSingleShot() const;
|
|
|
|
void setInterval(int msec);
|
|
|
|
void setSingleShot(bool singleShot);
|
|
|
|
int timerId() const;
|
|
|
|
|
2015-09-17 16:14:24 +02:00
|
|
|
public Q_SLOTS:
|
2014-09-25 01:03:18 +06:00
|
|
|
void start(int msec);
|
|
|
|
void start();
|
|
|
|
void stop();
|
|
|
|
|
2015-09-17 16:14:24 +02:00
|
|
|
Q_SIGNALS:
|
2014-09-25 01:03:18 +06:00
|
|
|
void timeout();
|
|
|
|
|
|
|
|
protected:
|
2020-01-19 16:28:44 +01:00
|
|
|
bool event(QEvent *event) override;
|
|
|
|
void timerEvent(QTimerEvent *event) override;
|
2014-09-25 01:03:18 +06:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Functions is used internally. Outer world mustn't have access them.
|
|
|
|
void startTimer()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void killTimer(int)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
class Private;
|
|
|
|
Private *d;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // QCA_SAFETIMER_H
|