summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2012-11-06 14:52:22 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-27 23:55:37 +0100
commitac8d906a3a61b3dd43aaf546e5f83e25d117631c (patch)
treea1e2e0a6075f4d60b2d86e402e54a864814babb2 /src
parent458382f35b62c98a283bb08770029f21827b9ae6 (diff)
iOS: support killing timers
Implement the remaining timer functions in the event dispatcher Change-Id: Ie323962c898a2ee95ea60a8ca63b93cbd4544fd1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm54
1 files changed, 42 insertions, 12 deletions
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm
index 64f853233d..a7f01a33a9 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.mm
+++ b/src/plugins/platforms/ios/qioseventdispatcher.mm
@@ -245,30 +245,60 @@ void QIOSEventDispatcher::registerTimer(int timerId, int interval, Qt::TimerType
bool QIOSEventDispatcher::unregisterTimer(int timerId)
{
- qDebug() << __FUNCTION__ << "not implemented";
- Q_UNUSED(timerId);
- return false;
+#ifndef QT_NO_DEBUG
+ if (timerId < 1) {
+ qWarning("QIOSEventDispatcher::unregisterTimer: invalid argument");
+ return false;
+ } else if (thread() != QThread::currentThread()) {
+ qWarning("QObject::killTimer: timers cannot be stopped from another thread");
+ return false;
+ }
+#endif
+
+ bool returnValue = m_timerInfoList.unregisterTimer(timerId);
+ m_timerInfoList.isEmpty() ? maybeStopCFRunLoopTimer() : maybeStartCFRunLoopTimer();
+ return returnValue;
}
bool QIOSEventDispatcher::unregisterTimers(QObject *object)
{
- qDebug() << __FUNCTION__ << "not implemented";
- Q_UNUSED(object);
- return false;
+#ifndef QT_NO_DEBUG
+ if (!object) {
+ qWarning("QIOSEventDispatcher::unregisterTimers: invalid argument");
+ return false;
+ } else if (object->thread() != thread() || thread() != QThread::currentThread()) {
+ qWarning("QObject::killTimers: timers cannot be stopped from another thread");
+ return false;
+ }
+#endif
+
+ bool returnValue = m_timerInfoList.unregisterTimers(object);
+ m_timerInfoList.isEmpty() ? maybeStopCFRunLoopTimer() : maybeStartCFRunLoopTimer();
+ return returnValue;
}
QList<QAbstractEventDispatcher::TimerInfo> QIOSEventDispatcher::registeredTimers(QObject *object) const
{
- qDebug() << __FUNCTION__ << "not implemented";
- Q_UNUSED(object);
- return QList<TimerInfo>();
+#ifndef QT_NO_DEBUG
+ if (!object) {
+ qWarning("QIOSEventDispatcher:registeredTimers: invalid argument");
+ return QList<TimerInfo>();
+ }
+#endif
+
+ return m_timerInfoList.registeredTimers(object);
}
int QIOSEventDispatcher::remainingTime(int timerId)
{
- qDebug() << __FUNCTION__ << "not implemented";
- Q_UNUSED(timerId);
- return 0;
+#ifndef QT_NO_DEBUG
+ if (timerId < 1) {
+ qWarning("QIOSEventDispatcher::remainingTime: invalid argument");
+ return -1;
+ }
+#endif
+
+ return m_timerInfoList.timerRemainingTime(timerId);
}
void QIOSEventDispatcher::wakeUp()