]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/Timeout_pimpl.C
Some string(widget->text()) fixes. Weirdness
[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 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "Timeout_pimpl.h"
18 #include "debug.h"
19
20 using std::endl;
21
22 Timeout::Pimpl::Pimpl(Timeout * owner)
23         : owner_(owner), timeout_id(-1)
24 {
25 }
26
27
28 void Timeout::Pimpl::timerEvent(QTimerEvent *)
29 {
30         owner_->emit();
31 }
32
33
34 void Timeout::Pimpl::reset()
35 {
36         killTimers();
37         timeout_id = -1;
38 }
39
40
41 bool Timeout::Pimpl::running() const
42 {
43         return timeout_id != -1;
44 }
45
46
47 void Timeout::Pimpl::start()
48 {
49         if (running())
50                 lyxerr << "Timeout::start: already running!" << endl;
51         timeout_id = startTimer(owner_->timeout_ms);
52 }
53
54
55 void Timeout::Pimpl::stop()
56 {
57         if (running())
58                 reset();
59 }