diff options
author | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-12-16 15:55:12 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-12-17 17:14:34 +0000 |
commit | 420438b5d304f815b65510fa8678beb08bcc4fd2 (patch) | |
tree | 30e87ff53de8d827bc0f43c13054c5972c10dec1 /src/plugins/platforms/ios | |
parent | a1bb00becec04bfb4d775cd8056b6894f4eef198 (diff) |
iOS: Implement support for QApplication::beep()
Vibrates the device or plays an alert sound on devices
that do not support vibration.
The other implementations of beep() have been moved to
QPlatformIntegration as a proper API instead of having
them as invokables in QPlatformNativeInterface.
Change-Id: Ic597dbef04b46d49862b070e78ddfc0d763829a2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Kai Uwe Broulik <kde@privat.broulik.de>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r-- | src/plugins/platforms/ios/ios.pro | 2 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiosintegration.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiosintegration.mm | 9 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/plugins/platforms/ios/ios.pro b/src/plugins/platforms/ios/ios.pro index 236234628d..b1075d3c0f 100644 --- a/src/plugins/platforms/ios/ios.pro +++ b/src/plugins/platforms/ios/ios.pro @@ -6,7 +6,7 @@ PLUGIN_CLASS_NAME = QIOSIntegrationPlugin load(qt_plugin) QT += core-private gui-private platformsupport-private -LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AssetsLibrary +LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AssetsLibrary -framework AudioToolbox OBJECTIVE_SOURCES = \ plugin.mm \ diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index 7d23fe1d62..e670d83a8d 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -82,6 +82,8 @@ public: void addScreen(QPlatformScreen *screen) { screenAdded(screen); } void destroyScreen(QPlatformScreen *screen) { QPlatformIntegration::destroyScreen(screen); } + void beep() const Q_DECL_OVERRIDE; + static QIOSIntegration *instance(); // -- QPlatformNativeInterface -- diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 72c9286f86..37b3866299 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -53,6 +53,8 @@ #include <QtPlatformSupport/private/qmacmime_p.h> #include <QDir> +#import <AudioToolbox/AudioServices.h> + #include <QtDebug> QT_BEGIN_NAMESPACE @@ -266,6 +268,13 @@ QPlatformNativeInterface *QIOSIntegration::nativeInterface() const return const_cast<QIOSIntegration *>(this); } +void QIOSIntegration::beep() const +{ +#if !TARGET_IPHONE_SIMULATOR + AudioServicesPlayAlertSound(kSystemSoundID_Vibrate); +#endif +} + // --------------------------------------------------------- void *QIOSIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) |