]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/Timeout_pimpl.C
dont use pragma impementation and interface anymore
[lyx.git] / src / frontends / qt2 / Timeout_pimpl.C
1 /**
2  * \file qt2/Timeout_pimpl.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13
14 #include "Timeout_pimpl.h"
15 #include "debug.h"
16
17 using std::endl;
18
19 Timeout::Pimpl::Pimpl(Timeout * owner)
20         : owner_(owner), timeout_id(-1)
21 {
22 }
23
24
25 void Timeout::Pimpl::timerEvent(QTimerEvent *)
26 {
27         owner_->emit();
28 }
29
30
31 void Timeout::Pimpl::reset()
32 {
33         killTimers();
34         timeout_id = -1;
35 }
36
37
38 bool Timeout::Pimpl::running() const
39 {
40         return timeout_id != -1;
41 }
42
43
44 void Timeout::Pimpl::start()
45 {
46         if (running())
47                 lyxerr << "Timeout::start: already running!" << endl;
48         timeout_id = startTimer(owner_->timeout_ms);
49 }
50
51
52 void Timeout::Pimpl::stop()
53 {
54         if (running())
55                 reset();
56 }