QXRD
0.11.16
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
qxrd
source
qxrdresponsetimer.cpp
Go to the documentation of this file.
1
#include "
qxrdresponsetimer.h
"
2
#include <stdlib.h>
3
#include "
qxrdapplication.h
"
4
5
QxrdResponseTimer::QxrdResponseTimer
(
int
interval,
int
allowance,
QcepObject
*parent) :
6
QObject(parent),
7
m_ResponseInterval(interval),
8
m_ResponseAllowance(allowance)
9
{
10
connect(&
m_ResponseTimer
, &QTimer::timeout,
this
, &
QxrdResponseTimer::onTimeout
);
11
12
m_ResponseTime
.start();
13
m_ResponseTimer
.start(
m_ResponseInterval
);
14
}
15
16
void
QxrdResponseTimer::onTimeout
()
17
{
18
int
elapsedTime =
m_ResponseTime
.restart();
19
20
if
(
g_Application
&& abs(elapsedTime-
m_ResponseInterval
) >
m_ResponseAllowance
) {
21
g_Application
->
printMessage
(tr(
"Excessive response time %1"
).arg(elapsedTime-
m_ResponseInterval
));
22
}
23
}
qxrdapplication.h
QxrdResponseTimer::m_ResponseTime
QTime m_ResponseTime
Definition:
qxrdresponsetimer.h:21
QxrdResponseTimer::m_ResponseTimer
QTimer m_ResponseTimer
Definition:
qxrdresponsetimer.h:20
QxrdResponseTimer::m_ResponseInterval
int m_ResponseInterval
Definition:
qxrdresponsetimer.h:18
QcepObject
Definition:
qcepobject.h:10
QcepApplication::printMessage
virtual void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())=0
qxrdresponsetimer.h
QxrdResponseTimer::onTimeout
void onTimeout()
Definition:
qxrdresponsetimer.cpp:16
g_Application
QcepApplication * g_Application
Definition:
qcepapplication.cpp:3
QxrdResponseTimer::QxrdResponseTimer
QxrdResponseTimer(int interval, int allowance, QcepObject *parent)
Definition:
qxrdresponsetimer.cpp:5
QxrdResponseTimer::m_ResponseAllowance
int m_ResponseAllowance
Definition:
qxrdresponsetimer.h:19
Generated by
1.8.10