diff options
author | Jake Petroules <jake.petroules@qt.io> | 2016-04-22 17:22:53 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2016-06-04 09:24:33 +0000 |
commit | 95ea1b1aa8d71889bce87c76bb1a996c0f2b58f4 (patch) | |
tree | 45babb4cd76784359227b27dab1e38a69dcaf2a8 /src/plugins | |
parent | 2f01e04d8fef22f3e3401aeffdd5972ed9ebcace (diff) |
Remove all code paths related to unsupported Apple platforms.
Now that the minimum deployment target (and thus SDK) is 10.9 for OS X
and 7.0 for iOS, all code paths affecting platform versions lower than
the aforementioned are removed.
Change-Id: Id985c7259c4ac069319d88f2c29c9559ae9e8641
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoahelpers.mm | 32 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm | 90 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 51 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiostextresponder.mm | 6 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiosviewcontroller.mm | 53 |
6 files changed, 23 insertions, 210 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index c91c67fe79..f63c4487af 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -334,38 +334,8 @@ QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup) // (and providing no public API to get the underlying color without this insanity) if (qt_mac_isSystemColorOrInstance(color, @"controlColor", @"NSGradientPatternColor") || qt_mac_isSystemColorOrInstance(color, @"windowBackgroundColor", @"NSGradientPatternColor")) { - static QColor newColor; - if (!newColor.isValid()) { -#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA) - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { - newColor = qt_mac_toQColor(color.CGColor); - } else -#endif - { - NSBitmapImageRep *offscreenRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil - pixelsWide:1 - pixelsHigh:1 - bitsPerSample:8 - samplesPerPixel:4 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSDeviceRGBColorSpace - bytesPerRow:4 - bitsPerPixel:32]; - [NSGraphicsContext saveGraphicsState]; - [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:offscreenRep]]; - NSEraseRect(NSMakeRect(0, 0, 1, 1)); - [color drawSwatchInRect:NSMakeRect(0, 0, 1, 1)]; - [NSGraphicsContext restoreGraphicsState]; - NSUInteger pixel[4]; - [offscreenRep getPixel:pixel atX:0 y:0]; - [offscreenRep release]; - newColor = QColor(pixel[0], pixel[1], pixel[2], pixel[3]); - } - } - qtBrush.setStyle(Qt::SolidPattern); - qtBrush.setColor(newColor); + qtBrush.setColor(qt_mac_toQColor(color.CGColor)); return qtBrush; } diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm index 0cbdc5d9c8..e8d8a473c3 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm @@ -91,11 +91,8 @@ QT_USE_NAMESPACE @class QT_MANGLE_NAMESPACE(QNSMenu); @class QT_MANGLE_NAMESPACE(QNSImageView); -@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 - <NSUserNotificationCenterDelegate> -#endif - { +@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject <NSUserNotificationCenterDelegate> +{ @public QCocoaSystemTrayIcon *systray; NSStatusItem *item; @@ -109,11 +106,8 @@ QT_USE_NAMESPACE -(QRectF)geometry; - (void)triggerSelector:(id)sender button:(Qt::MouseButton)mouseButton; - (void)doubleClickSelector:(id)sender; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 - (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification; - (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification; -#endif @end @interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView { @@ -142,19 +136,11 @@ class QSystemTrayIconSys public: QSystemTrayIconSys(QCocoaSystemTrayIcon *sys) { item = [[QNSStatusItem alloc] initWithSysTray:sys]; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { - [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:item]; - } -#endif + [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:item]; } ~QSystemTrayIconSys() { [[[item item] view] setHidden: YES]; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { - [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:nil]; - } -#endif + [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:nil]; [item release]; } QNSStatusItem *item; @@ -296,71 +282,15 @@ bool QCocoaSystemTrayIcon::supportsMessages() const void QCocoaSystemTrayIcon::showMessage(const QString &title, const QString &message, const QIcon& icon, MessageIcon, int) { + Q_UNUSED(icon); if (!m_sys) return; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { - NSUserNotification *notification = [[NSUserNotification alloc] init]; - notification.title = [NSString stringWithUTF8String:title.toUtf8().data()]; - notification.informativeText = [NSString stringWithUTF8String:message.toUtf8().data()]; - - [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification]; + NSUserNotification *notification = [[NSUserNotification alloc] init]; + notification.title = [NSString stringWithUTF8String:title.toUtf8().data()]; + notification.informativeText = [NSString stringWithUTF8String:message.toUtf8().data()]; - return; - } -#endif - -#ifdef QT_MAC_SYSTEMTRAY_USE_GROWL - // Make sure that we have Growl installed on the machine we are running on. - QCFType<CFURLRef> cfurl; - OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, - CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl); - if (status == kLSApplicationNotFoundErr) - return; - QCFType<CFBundleRef> bundle = CFBundleCreate(0, cfurl); - - if (CFStringCompare(CFBundleGetIdentifier(bundle), CFSTR("com.Growl.GrowlHelperApp"), - kCFCompareCaseInsensitive | kCFCompareBackwards) != kCFCompareEqualTo) - return; - QPixmap notificationIconPixmap = icon.pixmap(32, 32); - QTemporaryFile notificationIconFile; - QString notificationType(QLatin1String("Notification")), notificationIcon, notificationApp(qt_mac_applicationName()); - if (notificationApp.isEmpty()) - notificationApp = QLatin1String("Application"); - if (!notificationIconPixmap.isNull() && notificationIconFile.open()) { - QImageWriter writer(¬ificationIconFile, "PNG"); - if (writer.write(notificationIconPixmap.toImage())) - notificationIcon = QLatin1String("image from location \"file://") + notificationIconFile.fileName() + QLatin1String("\""); - } - const QString script(QLatin1String( - "tell application \"System Events\"\n" - "set isRunning to (count of (every process whose bundle identifier is \"com.Growl.GrowlHelperApp\")) > 0\n" - "end tell\n" - "if isRunning\n" - "tell application id \"com.Growl.GrowlHelperApp\"\n" - "-- Make a list of all the notification types (all)\n" - "set the allNotificationsList to {\"") + notificationType + QLatin1String("\"}\n" - - "-- Make a list of the notifications (enabled)\n" - "set the enabledNotificationsList to {\"") + notificationType + QLatin1String("\"}\n" - - "-- Register our script with growl.\n" - "register as application \"") + notificationApp + QLatin1String("\" all notifications allNotificationsList default notifications enabledNotificationsList\n" - - "-- Send a Notification...\n") + - QLatin1String("notify with name \"") + notificationType + - QLatin1String("\" title \"") + title + - QLatin1String("\" description \"") + message + - QLatin1String("\" application name \"") + notificationApp + - QLatin1String("\" ") + notificationIcon + - QLatin1String("\nend tell\nend if")); - qt_mac_execute_apple_script(script, 0); -#else - Q_UNUSED(icon); - Q_UNUSED(title); - Q_UNUSED(message); -#endif + [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification]; } QT_END_NAMESPACE @@ -499,7 +429,6 @@ QT_END_NAMESPACE emit systray->activated(QPlatformSystemTrayIcon::DoubleClick); } -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 - (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification { Q_UNUSED(center); Q_UNUSED(notification); @@ -511,7 +440,6 @@ QT_END_NAMESPACE Q_UNUSED(notification); emit systray->messageClicked(); } -#endif @end diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 00d65ea7f8..02ae64a58e 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -85,7 +85,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); bool m_resendKeyEvent; bool m_scrolling; bool m_updatingDrag; - bool m_exposedOnMoveToWindow; NSEvent *m_currentlyInterpretedKeyEvent; bool m_isMenuView; QSet<quint32> m_acceptedKeyDowns; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index fcfc805348..19688efdc7 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -39,8 +39,6 @@ #include <QtCore/qglobal.h> -#include <dlfcn.h> - #include "qnsview.h" #include "qcocoawindow.h" #include "qcocoahelpers.h" @@ -72,9 +70,6 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") static QTouchDevice *touchDevice = 0; -// ### HACK Remove once 10.8 is unsupported -static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; - static bool _q_dontOverrideCtrlLMB = false; @interface NSEvent (Qt_Compile_Leopard_DeviceDelta) @@ -134,10 +129,6 @@ static bool _q_dontOverrideCtrlLMB = false; + (void)initialize { - NSString **notificationNameVar = (NSString **)dlsym(RTLD_NEXT, "NSWindowDidChangeOcclusionStateNotification"); - if (notificationNameVar) - _q_NSWindowDidChangeOcclusionStateNotification = *notificationNameVar; - _q_dontOverrideCtrlLMB = qt_mac_resolveOption(false, "QT_MAC_DONT_OVERRIDE_CTRL_LMB"); } @@ -291,18 +282,6 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)viewDidMoveToWindow { m_backingStore = Q_NULLPTR; - m_isMenuView = [self.window.className isEqualToString:@"NSCarbonMenuWindow"]; - if (self.window) { - // This is the case of QWidgetAction's generated QWidget inserted in an NSMenu. - // 10.9 and newer get the NSWindowDidChangeOcclusionStateNotification - if (!_q_NSWindowDidChangeOcclusionStateNotification && m_isMenuView) { - m_exposedOnMoveToWindow = true; - m_platformWindow->exposeWindow(); - } - } else if (m_exposedOnMoveToWindow) { - m_exposedOnMoveToWindow = false; - m_platformWindow->obscureWindow(); - } } - (void)viewWillMoveToWindow:(NSWindow *)newWindow @@ -446,14 +425,7 @@ static bool _q_dontOverrideCtrlLMB = false; m_platformWindow->obscureWindow(); } else if ([notificationName isEqualToString: @"NSWindowDidOrderOnScreenAndFinishAnimatingNotification"]) { m_platformWindow->exposeWindow(); - } else if (_q_NSWindowDidChangeOcclusionStateNotification - && [notificationName isEqualToString:_q_NSWindowDidChangeOcclusionStateNotification]) { -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 -// ### HACK Remove the enum declaration, the warning disabling and the cast further down once 10.8 is unsupported -QT_WARNING_PUSH -QT_WARNING_DISABLE_CLANG("-Wobjc-method-access") - enum { NSWindowOcclusionStateVisible = 1UL << 1 }; -#endif + } else if ([notificationName isEqualToString:NSWindowDidChangeOcclusionStateNotification]) { // Several unit tests expect paint and/or expose events for windows that are // sometimes (unpredictably) occluded and some unit tests depend on QWindow::isExposed - // don't send Expose/Obscure events when running under QTestLib. @@ -466,9 +438,6 @@ QT_WARNING_DISABLE_CLANG("-Wobjc-method-access") m_platformWindow->obscureWindow(); } } -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 -QT_WARNING_POP -#endif } else if (notificationName == NSWindowDidChangeScreenNotification) { if (m_window) { NSUInteger screenIndex = [[NSScreen screens] indexOfObject:self.window.screen]; @@ -1389,7 +1358,6 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) [event magnification], windowPoint, screenPoint); } -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 - (void)smartMagnifyWithEvent:(NSEvent *)event { static bool zoomIn = true; @@ -1402,7 +1370,6 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) zoomIn ? 1.0f : 0.0f, windowPoint, screenPoint); zoomIn = !zoomIn; } -#endif - (void)rotateWithEvent:(NSEvent *)event { @@ -1518,16 +1485,12 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) NSEventPhase phase = [theEvent phase]; Qt::ScrollPhase ph = Qt::ScrollUpdate; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 - if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { - // On 10.8 and above, MayBegin is likely to happen. We treat it the same as an actual begin. - if (phase == NSEventPhaseMayBegin) { - m_scrolling = true; - ph = Qt::ScrollBegin; - } - } -#endif - if (phase == NSEventPhaseBegan) { + + // MayBegin is likely to happen. We treat it the same as an actual begin. + if (phase == NSEventPhaseMayBegin) { + m_scrolling = true; + ph = Qt::ScrollBegin; + } else if (phase == NSEventPhaseBegan) { // If MayBegin did not happen, Began is the actual beginning. if (!m_scrolling) ph = Qt::ScrollBegin; diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index ecc8d1ab1c..7255c84907 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -679,11 +679,7 @@ if (markedTextFormat.isEmpty()) { // There seems to be no way to query how the preedit text // should be drawn. So we need to hard-code the color. - QSysInfo::MacVersion iosVersion = QSysInfo::MacintoshVersion; - if (iosVersion < QSysInfo::MV_IOS_7_0) - markedTextFormat.setBackground(QColor(235, 239, 247)); - else - markedTextFormat.setBackground(QColor(206, 221, 238)); + markedTextFormat.setBackground(QColor(206, 221, 238)); } QList<QInputMethodEvent::Attribute> attrs; diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 77b0716cab..643192797a 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -234,25 +234,6 @@ if (self = [self init]) { m_screen = screen; -#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_7_0) - QSysInfo::MacVersion iosVersion = QSysInfo::MacintoshVersion; - - // We prefer to keep the root viewcontroller in fullscreen layout, so that - // we don't have to compensate for the viewcontroller position. This also - // gives us the same behavior on iOS 5/6 as on iOS 7, where full screen layout - // is the only way. - if (iosVersion < QSysInfo::MV_IOS_7_0) - self.wantsFullScreenLayout = YES; - - // Use translucent statusbar by default on iOS6 iPhones (unless the user changed - // the default in the Info.plist), so that windows placed under the stausbar are - // still visible, just like on iOS7. - if (screen->uiScreen() == [UIScreen mainScreen] - && iosVersion >= QSysInfo::MV_IOS_6_0 && iosVersion < QSysInfo::MV_IOS_7_0 - && [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone - && [UIApplication sharedApplication].statusBarStyle == UIStatusBarStyleDefault) - [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; -#endif self.changingOrientation = NO; #ifndef Q_OS_TVOS @@ -316,7 +297,6 @@ #endif } -#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0) - (NSUInteger)supportedInterfaceOrientations { // As documented by Apple in the iOS 6.0 release notes, setStatusBarOrientation:animated: @@ -327,15 +307,6 @@ // supportedInterfaceOrientations says, which states that the method should not return 0. return [self shouldAutorotate] ? UIInterfaceOrientationMaskAll : 0; } -#endif - -#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0) -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation -{ - Q_UNUSED(interfaceOrientation); - return [self shouldAutorotate]; -} -#endif - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration { @@ -454,30 +425,16 @@ if (focusWindow->flags() & Qt::MaximizeUsingFullscreenGeometryHint) self.preferredStatusBarStyle = UIStatusBarStyleDefault; else - self.preferredStatusBarStyle = QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0 ? - UIStatusBarStyleLightContent : UIStatusBarStyleBlackTranslucent; - - if (self.preferredStatusBarStyle != oldStatusBarStyle) { - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) - [self setNeedsStatusBarAppearanceUpdate]; - else - [uiApplication setStatusBarStyle:self.preferredStatusBarStyle]; - } + self.preferredStatusBarStyle = UIStatusBarStyleLightContent; + + if (self.preferredStatusBarStyle != oldStatusBarStyle) + [self setNeedsStatusBarAppearanceUpdate]; bool currentStatusBarVisibility = self.prefersStatusBarHidden; self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen; if (self.prefersStatusBarHidden != currentStatusBarVisibility) { -#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0) - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) { - [self setNeedsStatusBarAppearanceUpdate]; - } else -#endif - { - [uiApplication setStatusBarHidden:self.prefersStatusBarHidden - withAnimation:self.preferredStatusBarUpdateAnimation]; - } - + [self setNeedsStatusBarAppearanceUpdate]; [self.view setNeedsLayout]; } |