| 125 | } |
| 126 | |
| 127 | void TimerIdInfo::update(const TimerId &id, QObject *receiver) |
| 128 | { |
| 129 | QObject *object = receiver ? receiver : id.address(); |
| 130 | |
| 131 | type = id.type(); |
| 132 | state = InvalidState; |
| 133 | |
| 134 | // The timer became invalid |
| 135 | if (!object || (lastReceiverAddress == object && !lastReceiverObject)) { |
| 136 | type = TimerId::InvalidType; |
| 137 | return; |
| 138 | } |
| 139 | |
| 140 | interval = 0; |
| 141 | |
| 142 | switch (id.type()) { |
| 143 | case TimerId::InvalidType: { |
| 144 | Q_UNREACHABLE(); |
| 145 | break; |
| 146 | } |
| 147 | |
| 148 | case TimerId::QQmlTimerType: { |
| 149 | timerId = -1; |
| 150 | interval = object->property("interval").toInt(); |
| 151 | lastReceiverAddress = id.address(); |
| 152 | lastReceiverObject = object; |
| 153 | objectName = Util::displayString(object); |
| 154 | |
| 155 | if (!object->property("running").toBool()) |
| 156 | state = InactiveState; |
| 157 | else if (!object->property("repeat").toBool()) |
| 158 | state = SingleShotState; |
| 159 | else |
| 160 | state = RepeatState; |
| 161 | |
| 162 | break; |
| 163 | } |
| 164 | |
| 165 | case TimerId::QTimerType: { |
| 166 | const QTimer *const timer = qobject_cast<QTimer *>(object); |
| 167 | timerId = timer->timerId(); |
| 168 | interval = timer->interval(); |
| 169 | lastReceiverAddress = id.address(); |
| 170 | lastReceiverObject = object; |
| 171 | objectName = Util::displayString(object); |
| 172 | |
| 173 | if (!timer->isActive()) |
| 174 | state = InactiveState; |
| 175 | else if (timer->isSingleShot()) |
| 176 | state = SingleShotState; |
| 177 | else |
| 178 | state = RepeatState; |
| 179 | |
| 180 | break; |
| 181 | } |
| 182 | |
| 183 | case TimerId::QObjectType: { |
| 184 | timerId = id.timerId(); |