summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2013-02-15 11:25:39 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-27 23:56:10 +0100
commitaa5528b050472d1d1097e2665fb346232cbfa7e5 (patch)
treee7c0b081141a808465b60077165adb2e60cd7bed /src/plugins/platforms/ios
parent0c1ae5f8660941fed55c468487635c9a74846f7a (diff)
iOS: Implement socket notifiers.
Create the QCFSocketNotifier class in platform support which contains shared socket notifier support for the Cocoa and iOS plugins. Remove the old code from the Cocoa plugin. The Cocoa code had one QCocoaEventDispatcher-specific call: maybeCancelWaitForMoreEvents. Create a forwarding function that is passed to QCFSocketNotifier. Change-Id: Ibf9bd4745ba4f577a55f13d0cc00f5ae04447405 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.h3
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm10
2 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.h b/src/plugins/platforms/ios/qioseventdispatcher.h
index 88d5127855..53a75618ce 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.h
+++ b/src/plugins/platforms/ios/qioseventdispatcher.h
@@ -78,6 +78,7 @@
#include <QtCore/qabstracteventdispatcher.h>
#include <QtCore/private/qtimerinfo_unix_p.h>
+#include <QtPlatformSupport/private/qcfsocketnotifier_p.h>
#include <CoreFoundation/CoreFoundation.h>
QT_BEGIN_NAMESPACE
@@ -116,6 +117,8 @@ private:
QTimerInfoList m_timerInfoList;
CFRunLoopTimerRef m_runLoopTimerRef;
+ QCFSocketNotifier m_cfSocketNotifier;
+
void processPostedEvents();
void maybeStartCFRunLoopTimer();
void maybeStopCFRunLoopTimer();
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm
index f6f60387d4..e9bf039047 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.mm
+++ b/src/plugins/platforms/ios/qioseventdispatcher.mm
@@ -155,6 +155,8 @@ QIOSEventDispatcher::QIOSEventDispatcher(QObject *parent)
, m_interrupted(false)
, m_runLoopTimerRef(0)
{
+ m_cfSocketNotifier.setHostEventDispatcher(this);
+
CFRunLoopRef mainRunLoop = CFRunLoopGetMain();
CFRunLoopSourceContext context;
bzero(&context, sizeof(CFRunLoopSourceContext));
@@ -184,6 +186,8 @@ QIOSEventDispatcher::~QIOSEventDispatcher()
maybeStopCFRunLoopTimer();
CFRunLoopRemoveSource(CFRunLoopGetMain(), m_blockingTimerRunLoopSource, kCFRunLoopCommonModes);
CFRelease(m_blockingTimerRunLoopSource);
+
+ m_cfSocketNotifier.removeSocketNotifiers();
}
bool QIOSEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
@@ -215,14 +219,12 @@ bool QIOSEventDispatcher::hasPendingEvents()
void QIOSEventDispatcher::registerSocketNotifier(QSocketNotifier *notifier)
{
- qDebug() << __FUNCTION__ << "not implemented";
- Q_UNUSED(notifier);
+ m_cfSocketNotifier.registerSocketNotifier(notifier);
}
void QIOSEventDispatcher::unregisterSocketNotifier(QSocketNotifier *notifier)
{
- qDebug() << __FUNCTION__ << "not implemented";
- Q_UNUSED(notifier);
+ m_cfSocketNotifier.unregisterSocketNotifier(notifier);
}
void QIOSEventDispatcher::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *obj)