2001-08-25 03:00:19 +00:00
|
|
|
/**
|
2002-03-11 22:47:41 +00:00
|
|
|
* \file qt2/Timeout_pimpl.C
|
2001-08-25 03:00:19 +00:00
|
|
|
* Copyright 2001 LyX Team
|
|
|
|
* Read COPYING
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "Timeout_pimpl.h"
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
Timeout::Pimpl::Pimpl(Timeout * owner)
|
|
|
|
: owner_(owner), timeout_id(-1)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Timeout::Pimpl::timerEvent(QTimerEvent *)
|
|
|
|
{
|
|
|
|
owner_->emit();
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-25 03:00:19 +00:00
|
|
|
|
|
|
|
void Timeout::Pimpl::reset()
|
|
|
|
{
|
|
|
|
killTimers();
|
|
|
|
timeout_id = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 18:47:56 +00:00
|
|
|
bool Timeout::Pimpl::running() const
|
|
|
|
{
|
|
|
|
return timeout_id != -1;
|
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-25 03:00:19 +00:00
|
|
|
void Timeout::Pimpl::start()
|
|
|
|
{
|
2002-03-01 18:47:56 +00:00
|
|
|
if (running())
|
2001-08-25 03:00:19 +00:00
|
|
|
lyxerr << "Timeout::start: already running!" << endl;
|
|
|
|
timeout_id = startTimer(owner_->timeout_ms);
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-25 03:00:19 +00:00
|
|
|
|
|
|
|
void Timeout::Pimpl::stop()
|
|
|
|
{
|
2002-03-01 18:47:56 +00:00
|
|
|
if (running())
|
2001-08-25 03:00:19 +00:00
|
|
|
reset();
|
|
|
|
}
|