Line | |
---|
1 | // Includes, pacpus.
|
---|
2 | #include <PacpusTools/PeriodicWorker.h>
|
---|
3 |
|
---|
4 | // Includes, qt.
|
---|
5 | #include <QTimer>
|
---|
6 |
|
---|
7 | using namespace pacpus;
|
---|
8 |
|
---|
9 | PeriodicWorker::PeriodicWorker()
|
---|
10 | : AsyncWorkerBase()
|
---|
11 | , mHeartbeat(NULL)
|
---|
12 | {
|
---|
13 | mHeartbeat = new QTimer(this);
|
---|
14 | }
|
---|
15 |
|
---|
16 | PeriodicWorker::~PeriodicWorker()
|
---|
17 | {
|
---|
18 | }
|
---|
19 |
|
---|
20 | void
|
---|
21 | PeriodicWorker::startWork(int msec)
|
---|
22 | {
|
---|
23 | mHeartbeat->start(msec);
|
---|
24 | connect(mHeartbeat, SIGNAL(timeout()), this, SLOT(doWork()));
|
---|
25 |
|
---|
26 | this->start();
|
---|
27 | }
|
---|
28 |
|
---|
29 | void
|
---|
30 | PeriodicWorker::stopWork()
|
---|
31 | {
|
---|
32 | disconnect(mHeartbeat, SIGNAL(timeout()), this, SLOT(doWork()));
|
---|
33 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.