Remove ifdefs for supporting Mac OS <= 10.5

Qt5 requires Mac OS 10.6, so we can remove checks such as
if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6

Change-Id: Iea21727a277291148704ecf9677ed0b68c24920f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Tor Arne Vestbø 2013-02-16 14:56:50 +01:00 committed by The Qt Project
parent 468d010fdf
commit 0768920dbd
25 changed files with 12 additions and 157 deletions

View File

@ -83,11 +83,7 @@
#define QT_OPEN_LARGEFILE 0
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
#define QT_SOCKLEN_T socklen_t
#else
#define QT_SOCKLEN_T int
#endif
#define QT_SIGNAL_IGNORE (void (*)(int))1

View File

@ -85,11 +85,7 @@
#define QT_OPEN_LARGEFILE 0
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
#define QT_SOCKLEN_T socklen_t
#else
#define QT_SOCKLEN_T int
#endif
#define QT_SIGNAL_IGNORE (void (*)(int))1

View File

@ -178,7 +178,7 @@
# ifdef MAC_OS_X_VERSION_MIN_REQUIRED
# undef MAC_OS_X_VERSION_MIN_REQUIRED
# endif
# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4
# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6
# include <AvailabilityMacros.h>
# if !defined(MAC_OS_X_VERSION_10_3)
# define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1

View File

@ -272,8 +272,7 @@ void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer)
// Attributes
entryFlags |= QFileSystemMetaData::ExistsAttribute;
size_ = statBuffer.st_size;
#if defined (Q_OS_MAC) && !defined(Q_OS_IOS) \
&& MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
#if defined (Q_OS_MAC) && !defined(Q_OS_IOS)
if (statBuffer.st_flags & UF_HIDDEN) {
entryFlags |= QFileSystemMetaData::HiddenAttribute;
knownFlagsMask |= QFileSystemMetaData::HiddenAttribute;

View File

@ -360,12 +360,10 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
if (!data.hasFlags(QFileSystemMetaData::DirectoryType))
what |= QFileSystemMetaData::DirectoryType;
}
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (what & QFileSystemMetaData::HiddenAttribute) {
// Mac OS >= 10.5: st_flags & UF_HIDDEN
what |= QFileSystemMetaData::PosixStatFlags;
}
# endif // MAC_OS_X_VERSION_MAX_ALLOWED...
#endif // defined(Q_OS_MAC) && !defined(Q_OS_IOS)
if (what & QFileSystemMetaData::PosixStatFlags)

View File

@ -136,14 +136,4 @@ private:
QT_END_NAMESPACE
#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
#ifndef __LP64__
typedef float CGFloat;
typedef int NSInteger;
typedef unsigned int NSUInteger;
#define SRefCon SInt32
#define URefCon UInt32
#endif
#endif
#endif // QCORE_MAC_P_H

View File

@ -345,7 +345,6 @@ static QString macFormatCurrency(const QSystemLocale::CurrencyToStringArgument &
static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &str)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_6)
return QVariant();
@ -363,7 +362,6 @@ static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &
default:
break;
}
#endif
return QVariant();
}
#endif //QT_NO_SYSTEMLOCALE

View File

@ -231,7 +231,6 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
// PAC is enabled
CFStringRef cfPacLocation = (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString);
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
QCFType<CFDataRef> pacData;
QCFType<CFURLRef> pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL);
@ -275,9 +274,7 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
result << proxyFromDictionary(proxy);
}
return result;
} else
#endif
{
} else {
QString pacLocation = QCFString::toQString(cfPacLocation);
qWarning("Mac system proxy: PAC script at \"%s\" not handled", qPrintable(pacLocation));
}

View File

@ -176,17 +176,9 @@ init_context:
}
}
bool addExpiredCerts = true;
#if defined(Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_5)
//On Leopard SSL does not work if we add the expired certificates.
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_5)
addExpiredCerts = false;
#endif
// now add the expired certs
if (addExpiredCerts) {
foreach (const QSslCertificate &caCertificate, expiredCerts) {
q_X509_STORE_add_cert(sslContext->ctx->cert_store, reinterpret_cast<X509 *>(caCertificate.handle()));
}
foreach (const QSslCertificate &caCertificate, expiredCerts) {
q_X509_STORE_add_cert(sslContext->ctx->cert_store, reinterpret_cast<X509 *>(caCertificate.handle()));
}
if (QSslSocketPrivate::s_loadRootCertsOnDemand && allowRootCertOnDemandLoading) {

View File

@ -1504,17 +1504,9 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi
}
}
bool addExpiredCerts = true;
#if defined(Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_5)
//On Leopard SSL does not work if we add the expired certificates.
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_5)
addExpiredCerts = false;
#endif
// now add the expired certs
if (addExpiredCerts) {
foreach (const QSslCertificate &caCertificate, expiredCerts) {
q_X509_STORE_add_cert(certStore, reinterpret_cast<X509 *>(caCertificate.handle()));
}
foreach (const QSslCertificate &caCertificate, expiredCerts) {
q_X509_STORE_add_cert(certStore, reinterpret_cast<X509 *>(caCertificate.handle()));
}
QMutexLocker sslErrorListMutexLocker(&_q_sslErrorList()->mutex);

View File

@ -46,8 +46,6 @@
#include <private/qimage_p.h>
#if !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
QT_BEGIN_NAMESPACE
static float SYNTHETIC_ITALIC_SKEW = tanf(14 * acosf(0) / 90);
@ -650,6 +648,3 @@ bool QCoreTextFontEngine::supportsTransformation(const QTransform &transform) co
}
QT_END_NAMESPACE
#endif// !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)

View File

@ -52,8 +52,6 @@
#include <CoreGraphics/CoreGraphics.h>
#endif
#if !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
QT_BEGIN_NAMESPACE
class QRawFontPrivate;
@ -142,6 +140,4 @@ CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef);
QT_END_NAMESPACE
#endif// !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
#endif // QFONTENGINE_CORETEXT_P_H

View File

@ -93,19 +93,6 @@
@class QT_MANGLE_NAMESPACE(QCocoaMenuLoader);
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
@protocol NSApplicationDelegate <NSObject>
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames;
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender;
- (void)applicationDidBecomeActive:(NSNotification *)notification;
- (void)applicationDidResignActive:(NSNotification *)notification;
@end
#endif
@interface QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) : NSObject <NSApplicationDelegate> {
bool startedQuit;
NSMenu *dockMenu;

View File

@ -490,14 +490,12 @@ static bool IsMouseOrKeyEvent( NSEvent* event )
case NSOtherMouseUp:
case NSOtherMouseDragged:
#ifndef QT_NO_GESTURES
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
case NSEventTypeGesture: // touch events
case NSEventTypeMagnify:
case NSEventTypeSwipe:
case NSEventTypeRotate:
case NSEventTypeBeginGesture:
case NSEventTypeEndGesture:
#endif
#endif // QT_NO_GESTURES
result = true;
break;

View File

@ -77,11 +77,7 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
@class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate);
@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate)
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
: NSObject<NSOpenSavePanelDelegate>
#else
: NSObject
#endif
{
@public
NSOpenPanel *mOpenPanel;

View File

@ -475,11 +475,9 @@ CGColorSpaceRef qt_mac_genericColorSpace()
{
#if 0
if (!m_genericColorSpace) {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
} else
#endif
{
m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
}

View File

@ -83,7 +83,6 @@ void qt_cocoa_change_implementation(Class baseClass, SEL originalSel, Class prox
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5)
#endif
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
// The following code replaces the _implementation_ for the selector we want to hack
// (originalSel) with the implementation found in proxyClass. Then it creates
// a new 'backup' method inside baseClass containing the old, original,
@ -104,7 +103,6 @@ void qt_cocoa_change_implementation(Class baseClass, SEL originalSel, Class prox
Method backupMethod = class_getInstanceMethod(proxyClass, backupSel);
class_addMethod(baseClass, backupSel, originalImp, method_getTypeEncoding(backupMethod));
}
#endif
}
}
@ -114,11 +112,9 @@ void qt_cocoa_change_back_implementation(Class baseClass, SEL originalSel, SEL b
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5)
#endif
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
Method originalMethod = class_getInstanceMethod(baseClass, originalSel);
Method backupMethodInBaseClass = class_getInstanceMethod(baseClass, backupSel);
method_setImplementation(originalMethod, method_getImplementation(backupMethodInBaseClass));
#endif
}
}

View File

@ -42,8 +42,6 @@
#include "qmultitouch_mac_p.h"
#include "qcocoahelpers.h"
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
QT_BEGIN_NAMESPACE
QHash<qint64, QCocoaTouch*> QCocoaTouch::_currentTouches;
@ -214,6 +212,3 @@ QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch)
}
QT_END_NAMESPACE
#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6

View File

@ -61,8 +61,6 @@
#include <qhash.h>
#include <QtCore>
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
QT_BEGIN_NAMESPACE
class QCocoaTouch
@ -92,7 +90,5 @@ class QCocoaTouch
QT_END_NAMESPACE
#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
#endif // QMULTITOUCH_MAC_P_H

View File

@ -46,26 +46,6 @@
#include "qcocoawindow.h"
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
@protocol NSWindowDelegate <NSObject>
//- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize;
//- (void)windowDidMiniaturize:(NSNotification*)notification;
- (void)windowDidResize:(NSNotification *)notification;
- (void)windowWillClose:(NSNotification *)notification;
//- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)defaultFrame;
- (void)windowDidMove:(NSNotification *)notification;
//- (BOOL)windowShouldClose:(id)window;
//- (void)windowDidDeminiaturize:(NSNotification *)notification;
//- (void)windowDidBecomeMain:(NSNotification*)notification;
//- (void)windowDidResignMain:(NSNotification*)notification;
//- (void)windowDidBecomeKey:(NSNotification*)notification;
//- (void)windowDidResignKey:(NSNotification*)notification;
//- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu;
//- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard;
//- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
@end
#endif
@interface QNSWindowDelegate : NSObject <NSWindowDelegate>
{
QCocoaWindow *m_cocoaWindow;

View File

@ -90,14 +90,11 @@ void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig
if (rgn.isEmpty()) {
CGContextAddRect(hd, CGRectMake(0, 0, 0, 0));
} else {
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
QCFType<HIMutableShapeRef> shape = qt_mac_QRegionToHIMutableShape(rgn);
Q_ASSERT(!HIShapeIsEmpty(shape));
HIShapeReplacePathInCGContext(shape, hd);
} else
#endif
{
} else {
QVector<QRect> rects = rgn.rects();
const int count = rects.size();
for (int i = 0; i < count; i++) {
@ -338,11 +335,9 @@ CGColorSpaceRef QCoreGraphicsPaintEngine::macGenericColorSpace()
{
#if 0
if (!m_genericColorSpace) {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
} else
#endif
{
m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
}
@ -1185,7 +1180,6 @@ extern "C" {
void
QCoreGraphicsPaintEngine::updateCompositionMode(QPainter::CompositionMode mode)
{
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
int cg_mode = kCGBlendModeNormal;
switch (mode) {
@ -1267,11 +1261,9 @@ QCoreGraphicsPaintEngine::updateCompositionMode(QPainter::CompositionMode mode)
if (cg_mode > -1) {
CGContextSetBlendMode(d_func()->hd, CGBlendMode(cg_mode));
}
} else
#endif
// The standard porter duff ops.
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_3
} else if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_3
&& mode <= QPainter::CompositionMode_Xor) {
// The standard porter duff ops.
int cg_mode = kCGCompositeModeCopy;
switch (mode) {
case QPainter::CompositionMode_SourceOver:
@ -1317,7 +1309,6 @@ QCoreGraphicsPaintEngine::updateCompositionMode(QPainter::CompositionMode mode)
if (cg_mode > -1)
CGContextSetCompositeOperation(d_func()->hd, CGCompositeMode(cg_mode));
} else {
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
bool needPrivateAPI = false;
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
int cg_mode = kCGBlendModeNormal;
@ -1367,7 +1358,6 @@ QCoreGraphicsPaintEngine::updateCompositionMode(QPainter::CompositionMode mode)
else
CGContextSetCompositeOperation(d_func()->hd, CGCompositeMode(cg_mode));
}
#endif
}
}

View File

@ -190,23 +190,7 @@ QList<QVariant> QMacPrintEnginePrivate::supportedResolutions() const
if (PMSessionGetCurrentPrinter(session(), &printer) == noErr) {
PMResolution res;
OSStatus status = PMPrinterGetPrinterResolutionCount(printer, &resCount);
if (status == kPMNotImplemented) {
#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
// *Sigh* we have to use the non-indexed version.
if (PMPrinterGetPrinterResolution(printer, kPMMinSquareResolution, &res) == noErr)
resolutions.append(int(res.hRes));
if (PMPrinterGetPrinterResolution(printer, kPMMaxSquareResolution, &res) == noErr) {
QVariant var(int(res.hRes));
if (!resolutions.contains(var))
resolutions.append(var);
}
if (PMPrinterGetPrinterResolution(printer, kPMDefaultResolution, &res) == noErr) {
QVariant var(int(res.hRes));
if (!resolutions.contains(var))
resolutions.append(var);
}
#endif
} else if (status == noErr) {
if (status == noErr) {
// According to the docs, index start at 1.
for (UInt32 i = 1; i <= resCount; ++i) {
if (PMPrinterGetIndexedPrinterResolution(printer, i, &res) == noErr)

View File

@ -586,11 +586,9 @@ CGColorSpaceRef qt_mac_genericColorSpace()
{
#if 0
if (!m_genericColorSpace) {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
} else
#endif
{
m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
}
@ -4912,10 +4910,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
} else {
if (!(slider->subControls & SC_SliderHandle))
tdi.attributes &= ~kThemeTrackShowThumb;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (!(slider->subControls & SC_SliderGroove))
tdi.attributes |= kThemeTrackHideTrack;
#endif
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7

View File

@ -80,7 +80,7 @@ inline static bool verticalTabs(QTabBar::Shape shape)
void QTabBarPrivate::updateMacBorderMetrics()
{
#if (defined Q_WS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
#if defined(Q_WS_MAC)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
Q_Q(QTabBar);
::HIContentBorderMetrics metrics;

View File

@ -391,11 +391,6 @@ void tst_QScroller::scrollTo()
void tst_QScroller::scroll()
{
#if defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)
QSKIP("Mac OS X < 10.6 does not support QTouchEvents");
return;
#endif
#ifndef QT_NO_GESTURES
// -- good case. normal scroll
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
@ -438,11 +433,6 @@ void tst_QScroller::scroll()
void tst_QScroller::overshoot()
{
#if defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)
QSKIP("Mac OS X < 10.6 does not support QTouchEvents");
return;
#endif
#ifndef QT_NO_GESTURES
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
sw->scrollArea = QRectF(0, 0, 1000, 1000);