2003-02-22 18:01:16 +00:00
|
|
|
/**
|
|
|
|
* \file qtTimeout.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-02-22 18:01:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2003-09-29 10:50:51 +00:00
|
|
|
#include "qtTimeout.h"
|
2003-02-22 18:01:16 +00:00
|
|
|
|
2004-05-20 09:36:28 +00:00
|
|
|
#include "debug.h"
|
|
|
|
|
2003-02-22 18:01:16 +00:00
|
|
|
|
|
|
|
Timeout::Timeout(unsigned int msec, Type t)
|
|
|
|
: pimpl_(new qtTimeout(*this)), type(t), timeout_ms(msec)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
qtTimeout::qtTimeout(Timeout & owner)
|
|
|
|
: Timeout::Impl(owner), timeout_id(-1)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void qtTimeout::timerEvent(QTimerEvent *)
|
|
|
|
{
|
|
|
|
emit();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void qtTimeout::reset()
|
|
|
|
{
|
|
|
|
killTimers();
|
|
|
|
timeout_id = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool qtTimeout::running() const
|
|
|
|
{
|
|
|
|
return timeout_id != -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void qtTimeout::start()
|
|
|
|
{
|
|
|
|
if (running())
|
|
|
|
lyxerr << "Timeout::start: already running!" << std::endl;
|
|
|
|
timeout_id = startTimer(timeout_ms());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void qtTimeout::stop()
|
|
|
|
{
|
|
|
|
if (running())
|
|
|
|
reset();
|
|
|
|
}
|