| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | static const int INV_TIMER = -1; | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | QTimer::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:3241 | 3241 |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | QTimer::~QTimer() | - |
| 20 | { | - |
| 21 | if (id != INV_TIMER) evaluated: id != INV_TIMER| yes Evaluation Count:235 | yes Evaluation Count:3004 |
| 235-3004 |
| 22 | stop(); executed: stop();Execution Count:235 | 235 |
| 23 | } executed: }Execution Count:3239 | 3239 |
| 24 | void QTimer::start() | - |
| 25 | { | - |
| 26 | if (id != INV_TIMER) evaluated: id != INV_TIMER| yes Evaluation Count:10 | yes Evaluation Count:2745 |
| 10-2745 |
| 27 | stop(); executed: stop();Execution Count:10 | 10 |
| 28 | nulltimer = (!inter && single); evaluated: !inter| yes Evaluation Count:345 | yes Evaluation Count:2410 |
evaluated: single| yes Evaluation Count:341 | yes Evaluation Count:4 |
| 4-2410 |
| 29 | id = QObject::startTimer(inter, Qt::TimerType(type)); | - |
| 30 | } executed: }Execution Count:2755 | 2755 |
| 31 | void QTimer::start(int msec) | - |
| 32 | { | - |
| 33 | inter = msec; | - |
| 34 | start(); | - |
| 35 | } executed: }Execution Count:2637 | 2637 |
| 36 | void QTimer::stop() | - |
| 37 | { | - |
| 38 | if (id != INV_TIMER) { evaluated: id != INV_TIMER| yes Evaluation Count:2756 | yes Evaluation Count:1499 |
| 1499-2756 |
| 39 | QObject::killTimer(id); | - |
| 40 | id = INV_TIMER; | - |
| 41 | } executed: }Execution Count:2756 | 2756 |
| 42 | } executed: }Execution Count:4255 | 4255 |
| 43 | | - |
| 44 | | - |
| 45 | | - |
| 46 | | - |
| 47 | | - |
| 48 | void QTimer::timerEvent(QTimerEvent *e) | - |
| 49 | { | - |
| 50 | if (e->timerId() == id) { partially evaluated: e->timerId() == id| yes Evaluation Count:26551 | no Evaluation Count:0 |
| 0-26551 |
| 51 | if (single) evaluated: single| yes Evaluation Count:400 | yes Evaluation Count:26151 |
| 400-26151 |
| 52 | stop(); executed: stop();Execution Count:400 | 400 |
| 53 | timeout(QPrivateSignal()); | - |
| 54 | } executed: }Execution Count:26551 | 26551 |
| 55 | } executed: }Execution Count:26551 | 26551 |
| 56 | | - |
| 57 | class 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; | - |
| 61 | public: | - |
| 62 | ~QSingleShotTimer(); | - |
| 63 | QSingleShotTimer(int msec, Qt::TimerType timerType, const QObject *r, const char * m); | - |
| 64 | public: | - |
| 65 | void timeout(); | - |
| 66 | protected: | - |
| 67 | void timerEvent(QTimerEvent *); | - |
| 68 | }; | - |
| 69 | | - |
| 70 | QSingleShotTimer::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:1349 | 1349 |
| 76 | | - |
| 77 | QSingleShotTimer::~QSingleShotTimer() | - |
| 78 | { | - |
| 79 | if (timerId > 0) evaluated: timerId > 0| yes Evaluation Count:109 | yes Evaluation Count:1240 |
| 109-1240 |
| 80 | killTimer(timerId); executed: killTimer(timerId);Execution Count:109 | 109 |
| 81 | } executed: }Execution Count:1349 | 1349 |
| 82 | | - |
| 83 | void QSingleShotTimer::timerEvent(QTimerEvent *) | - |
| 84 | { | - |
| 85 | | - |
| 86 | | - |
| 87 | if (timerId > 0) partially evaluated: timerId > 0| yes Evaluation Count:1240 | no Evaluation Count:0 |
| 0-1240 |
| 88 | killTimer(timerId); executed: killTimer(timerId);Execution Count:1240 | 1240 |
| 89 | timerId = -1; | - |
| 90 | timeout(); | - |
| 91 | | - |
| 92 | | - |
| 93 | | - |
| 94 | | - |
| 95 | qDeleteInEventHandler(this); | - |
| 96 | } executed: }Execution Count:1240 | 1240 |
| 97 | void 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:2957 | 2957 |
| 104 | void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member) | - |
| 105 | { | - |
| 106 | if (receiver && member) { partially evaluated: receiver| yes Evaluation Count:2957 | no Evaluation Count:0 |
partially evaluated: member| yes Evaluation Count:2957 | no Evaluation Count:0 |
| 0-2957 |
| 107 | if (msec == 0) { evaluated: msec == 0| yes Evaluation Count:1608 | yes Evaluation Count:1349 |
| 1349-1608 |
| 108 | | - |
| 109 | const char* bracketPosition = strchr(member, '('); | - |
| 110 | if (!bracketPosition || !(member[0] >= '0' && member[0] <= '2')) { partially evaluated: !bracketPosition| no Evaluation Count:0 | yes Evaluation Count:1608 |
partially evaluated: member[0] >= '0'| yes Evaluation Count:1608 | no Evaluation Count:0 |
partially evaluated: member[0] <= '2'| yes Evaluation Count:1608 | no Evaluation Count:0 |
| 0-1608 |
| 111 | QMessageLogger("kernel/qtimer.cpp", 344, __PRETTY_FUNCTION__).warning("QTimer::singleShot: Invalid slot specification"); | - |
| 112 | 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:1608 | 1608 |
| 117 | } | - |
| 118 | (void) new QSingleShotTimer(msec, timerType, receiver, member); | - |
| 119 | } executed: }Execution Count:1349 | 1349 |
| 120 | } executed: }Execution Count:1349 | 1349 |
| 121 | void QTimer::setInterval(int msec) | - |
| 122 | { | - |
| 123 | inter = msec; | - |
| 124 | if (id != INV_TIMER) { partially evaluated: id != INV_TIMER| no Evaluation Count:0 | yes Evaluation Count:46 |
| 0-46 |
| 125 | QObject::killTimer(id); | - |
| 126 | id = QObject::startTimer(msec, Qt::TimerType(type)); | - |
| 127 | } | 0 |
| 128 | } executed: }Execution Count:46 | 46 |
| 129 | int QTimer::remainingTime() const | - |
| 130 | { | - |
| 131 | if (id != INV_TIMER) { partially evaluated: id != INV_TIMER| 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 | | - |
| | |