kernel/qtimer.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3static const int INV_TIMER = -1; -
4 -
5 -
6 -
7 -
8 -
9QTimer::QTimer(QObject *parent) -
10 : QObject(parent), id(INV_TIMER), inter(0), del(0), single(0), nulltimer(0), type(Qt::CoarseTimer) -
11{ -
12}
executed: }
Execution Count:3122
3122
13 -
14 -
15 -
16 -
17 -
18 -
19QTimer::~QTimer() -
20{ -
21 if (id != INV_TIMER)
evaluated: id != INV_TIMER
TRUEFALSE
yes
Evaluation Count:218
yes
Evaluation Count:2899
218-2899
22 stop();
executed: stop();
Execution Count:218
218
23}
executed: }
Execution Count:3117
3117
24void QTimer::start() -
25{ -
26 if (id != INV_TIMER)
evaluated: id != INV_TIMER
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2672
10-2672
27 stop();
executed: stop();
Execution Count:10
10
28 nulltimer = (!inter && single);
evaluated: !inter
TRUEFALSE
yes
Evaluation Count:304
yes
Evaluation Count:2378
evaluated: single
TRUEFALSE
yes
Evaluation Count:300
yes
Evaluation Count:4
4-2378
29 id = QObject::startTimer(inter, Qt::TimerType(type)); -
30}
executed: }
Execution Count:2682
2682
31void QTimer::start(int msec) -
32{ -
33 inter = msec; -
34 start(); -
35}
executed: }
Execution Count:2567
2567
36void QTimer::stop() -
37{ -
38 if (id != INV_TIMER) {
evaluated: id != INV_TIMER
TRUEFALSE
yes
Evaluation Count:2682
yes
Evaluation Count:1430
1430-2682
39 QObject::killTimer(id); -
40 id = INV_TIMER; -
41 }
executed: }
Execution Count:2682
2682
42}
executed: }
Execution Count:4112
4112
43 -
44 -
45 -
46 -
47 -
48void QTimer::timerEvent(QTimerEvent *e) -
49{ -
50 if (e->timerId() == id) {
partially evaluated: e->timerId() == id
TRUEFALSE
yes
Evaluation Count:25706
no
Evaluation Count:0
0-25706
51 if (single)
evaluated: single
TRUEFALSE
yes
Evaluation Count:373
yes
Evaluation Count:25333
373-25333
52 stop();
executed: stop();
Execution Count:373
373
53 timeout(QPrivateSignal()); -
54 }
executed: }
Execution Count:25706
25706
55}
executed: }
Execution Count:25706
25706
56 -
57class QSingleShotTimer : public QObject -
58{ -
59 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); struct QPrivateSignal {}; -
60 int timerId; -
61public: -
62 ~QSingleShotTimer(); -
63 QSingleShotTimer(int msec, Qt::TimerType timerType, const QObject *r, const char * m); -
64public: -
65 void timeout(); -
66protected: -
67 void timerEvent(QTimerEvent *); -
68}; -
69 -
70QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member) -
71 : QObject(QAbstractEventDispatcher::instance()) -
72{ -
73 connect(this, "2""timeout()", receiver, member); -
74 timerId = startTimer(msec, timerType); -
75}
executed: }
Execution Count:1159
1159
76 -
77QSingleShotTimer::~QSingleShotTimer() -
78{ -
79 if (timerId > 0)
evaluated: timerId > 0
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:1065
94-1065
80 killTimer(timerId);
executed: killTimer(timerId);
Execution Count:94
94
81}
executed: }
Execution Count:1159
1159
82 -
83void QSingleShotTimer::timerEvent(QTimerEvent *) -
84{ -
85 -
86 -
87 if (timerId > 0)
partially evaluated: timerId > 0
TRUEFALSE
yes
Evaluation Count:1065
no
Evaluation Count:0
0-1065
88 killTimer(timerId);
executed: killTimer(timerId);
Execution Count:1065
1065
89 timerId = -1; -
90 timeout(); -
91 -
92 -
93 -
94 -
95 qDeleteInEventHandler(this); -
96}
executed: }
Execution Count:1065
1065
97void QTimer::singleShot(int msec, const QObject *receiver, const char *member) -
98{ -
99 -
100 -
101 -
102 singleShot(msec, msec >= 2000 ? Qt::CoarseTimer : Qt::PreciseTimer, receiver, member); -
103}
executed: }
Execution Count:2580
2580
104void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member) -
105{ -
106 if (receiver && member) {
partially evaluated: receiver
TRUEFALSE
yes
Evaluation Count:2580
no
Evaluation Count:0
partially evaluated: member
TRUEFALSE
yes
Evaluation Count:2580
no
Evaluation Count:0
0-2580
107 if (msec == 0) {
evaluated: msec == 0
TRUEFALSE
yes
Evaluation Count:1421
yes
Evaluation Count:1159
1159-1421
108 -
109 const char* bracketPosition = strchr(member, '('); -
110 if (!bracketPosition || !(member[0] >= '0' && member[0] <= '2')) {
partially evaluated: !bracketPosition
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1421
partially evaluated: member[0] >= '0'
TRUEFALSE
yes
Evaluation Count:1421
no
Evaluation Count:0
partially evaluated: member[0] <= '2'
TRUEFALSE
yes
Evaluation Count:1421
no
Evaluation Count:0
0-1421
111 QMessageLogger("kernel/qtimer.cpp", 344, __PRETTY_FUNCTION__).warning("QTimer::singleShot: Invalid slot specification"); -
112 return;
never executed: return;
0
113 } -
114 QByteArray methodName(member+1, bracketPosition - 1 - member); -
115 QMetaObject::invokeMethod(const_cast<QObject *>(receiver), methodName.constData(), Qt::QueuedConnection); -
116 return;
executed: return;
Execution Count:1421
1421
117 } -
118 (void) new QSingleShotTimer(msec, timerType, receiver, member); -
119 }
executed: }
Execution Count:1159
1159
120}
executed: }
Execution Count:1159
1159
121void QTimer::setInterval(int msec) -
122{ -
123 inter = msec; -
124 if (id != INV_TIMER) {
partially evaluated: id != INV_TIMER
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
0-46
125 QObject::killTimer(id); -
126 id = QObject::startTimer(msec, Qt::TimerType(type)); -
127 }
never executed: }
0
128}
executed: }
Execution Count:46
46
129int QTimer::remainingTime() const -
130{ -
131 if (id != INV_TIMER) {
partially evaluated: id != INV_TIMER
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
132 return QAbstractEventDispatcher::instance()->remainingTime(id);
executed: return QAbstractEventDispatcher::instance()->remainingTime(id);
Execution Count:1
1
133 } -
134 -
135 return -1;
never executed: return -1;
0
136} -
137 -
138 -
139 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial