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>
This commit is contained in:
parent
2f01e04d8f
commit
95ea1b1aa8
@ -198,7 +198,7 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
|
|||||||
const FSEventStreamEventFlags eventFlags[],
|
const FSEventStreamEventFlags eventFlags[],
|
||||||
const FSEventStreamEventId eventIds[])
|
const FSEventStreamEventId eventIds[])
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_OSX) && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_6
|
#if defined(Q_OS_OSX)
|
||||||
Q_UNUSED(streamRef);
|
Q_UNUSED(streamRef);
|
||||||
|
|
||||||
bool needsRestart = false;
|
bool needsRestart = false;
|
||||||
@ -256,12 +256,6 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
|
|||||||
if (needsRestart)
|
if (needsRestart)
|
||||||
emit scheduleStreamRestart();
|
emit scheduleStreamRestart();
|
||||||
#else
|
#else
|
||||||
// This is a work-around for moc: when we put the version check at the top of the header file,
|
|
||||||
// moc will still see the Q_OBJECT macro and generate a meta-object when compiling for 10.6,
|
|
||||||
// which obviously won't link.
|
|
||||||
//
|
|
||||||
// So the trick is to still compile this class on 10.6, but never instantiate it.
|
|
||||||
|
|
||||||
Q_UNUSED(streamRef);
|
Q_UNUSED(streamRef);
|
||||||
Q_UNUSED(numEvents);
|
Q_UNUSED(numEvents);
|
||||||
Q_UNUSED(eventPaths);
|
Q_UNUSED(eventPaths);
|
||||||
|
@ -541,31 +541,7 @@ void QMacSettingsPrivate::sync()
|
|||||||
domains[i].userName, hostNames[j]);
|
domains[i].userName, hostNames[j]);
|
||||||
// only report failures for the primary file (the one we write to)
|
// only report failures for the primary file (the one we write to)
|
||||||
if (!ok && i == 0 && hostNames[j] == hostName && status == QSettings::NoError) {
|
if (!ok && i == 0 && hostNames[j] == hostName && status == QSettings::NoError) {
|
||||||
#if 1
|
setStatus(QSettings::AccessError);
|
||||||
if (QSysInfo::macVersion() < QSysInfo::MV_10_7) {
|
|
||||||
// work around what seems to be a bug in CFPreferences:
|
|
||||||
// don't report an error if there are no preferences for the application
|
|
||||||
QCFType<CFArrayRef> appIds = CFPreferencesCopyApplicationList(domains[i].userName,
|
|
||||||
hostNames[j]);
|
|
||||||
|
|
||||||
// iterate through all the applications and see if we're there
|
|
||||||
CFIndex size = CFArrayGetCount(appIds);
|
|
||||||
for (CFIndex k = 0; k < size; ++k) {
|
|
||||||
const void *cfvalue = CFArrayGetValueAtIndex(appIds, k);
|
|
||||||
if (CFGetTypeID(cfvalue) == CFStringGetTypeID()) {
|
|
||||||
if (CFStringCompare(static_cast<CFStringRef>(cfvalue),
|
|
||||||
domains[i].applicationOrSuiteId,
|
|
||||||
kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
|
||||||
setStatus(QSettings::AccessError);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
setStatus(QSettings::AccessError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,9 +171,6 @@ bool QLibraryPrivate::load_sys()
|
|||||||
}
|
}
|
||||||
#if !defined(Q_OS_CYGWIN)
|
#if !defined(Q_OS_CYGWIN)
|
||||||
else {
|
else {
|
||||||
#if defined(Q_OS_MAC)
|
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
|
|
||||||
#endif
|
|
||||||
dlFlags |= RTLD_LOCAL;
|
dlFlags |= RTLD_LOCAL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -390,9 +390,6 @@ static QString macFormatCurrency(const QSystemLocale::CurrencyToStringArgument &
|
|||||||
|
|
||||||
static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &str)
|
static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &str)
|
||||||
{
|
{
|
||||||
if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_6)
|
|
||||||
return QVariant();
|
|
||||||
|
|
||||||
QString begin, end;
|
QString begin, end;
|
||||||
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
|
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -119,10 +119,8 @@ typedef char GLchar;
|
|||||||
#else // non-ES2 platforms
|
#else // non-ES2 platforms
|
||||||
# if defined(Q_OS_MAC)
|
# if defined(Q_OS_MAC)
|
||||||
# include <OpenGL/gl.h>
|
# include <OpenGL/gl.h>
|
||||||
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
|
||||||
# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
|
# include <OpenGL/gl3.h>
|
||||||
# include <OpenGL/gl3.h>
|
|
||||||
# endif
|
|
||||||
# include <OpenGL/glext.h>
|
# include <OpenGL/glext.h>
|
||||||
# else
|
# else
|
||||||
# define GL_GLEXT_LEGACY // Prevents GL/gl.h from #including system glext.h
|
# define GL_GLEXT_LEGACY // Prevents GL/gl.h from #including system glext.h
|
||||||
@ -131,16 +129,11 @@ typedef char GLchar;
|
|||||||
# endif // Q_OS_MAC
|
# endif // Q_OS_MAC
|
||||||
#endif // QT_OPENGL_ES_2
|
#endif // QT_OPENGL_ES_2
|
||||||
|
|
||||||
// Desktops, apart from Mac OS X prior to 10.7 can support OpenGL 3.
|
// Desktops can support OpenGL 4.
|
||||||
// Desktops, apart from Mac OS X prior to 10.9 can support OpenGL 4.
|
|
||||||
#if !defined(QT_OPENGL_ES_2)
|
#if !defined(QT_OPENGL_ES_2)
|
||||||
# if !defined(Q_OS_MAC) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
|
#define QT_OPENGL_3
|
||||||
# define QT_OPENGL_3
|
#define QT_OPENGL_3_2
|
||||||
# define QT_OPENGL_3_2
|
#define QT_OPENGL_4
|
||||||
# endif
|
|
||||||
# if !defined(Q_OS_MAC) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
|
|
||||||
# define QT_OPENGL_4
|
|
||||||
# endif
|
|
||||||
# if !defined(Q_OS_MAC)
|
# if !defined(Q_OS_MAC)
|
||||||
# define QT_OPENGL_4_3
|
# define QT_OPENGL_4_3
|
||||||
# endif
|
# endif
|
||||||
|
@ -1292,9 +1292,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
|
|||||||
|
|
||||||
#ifdef Q_OS_DARWIN
|
#ifdef Q_OS_DARWIN
|
||||||
if (actualFontEngine->type() == QFontEngine::Mac) {
|
if (actualFontEngine->type() == QFontEngine::Mac) {
|
||||||
// CTRunGetPosition has a bug which applies matrix on 10.6, so we disable
|
if (actualFontEngine->fontDef.stretch != 100) {
|
||||||
// scaling the advances for this particular version
|
|
||||||
if (QSysInfo::MacintoshVersion != QSysInfo::MV_10_6 && actualFontEngine->fontDef.stretch != 100) {
|
|
||||||
QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
|
QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
|
||||||
for (uint i = 0; i < num_glyphs; ++i)
|
for (uint i = 0; i < num_glyphs; ++i)
|
||||||
g.advances[i] *= stretch;
|
g.advances[i] *= stretch;
|
||||||
|
@ -99,9 +99,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithQNetworkReplyNSURLConnectionImplPrivate:(QNetworkReplyNSURLConnectionImplPrivate *)a_replyPrivate ;
|
- (id)initWithQNetworkReplyNSURLConnectionImplPrivate:(QNetworkReplyNSURLConnectionImplPrivate *)a_replyPrivate ;
|
||||||
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_3_0)
|
|
||||||
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
|
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
|
||||||
#endif
|
|
||||||
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError*)error;
|
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError*)error;
|
||||||
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse*)response;
|
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse*)response;
|
||||||
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData*)data;
|
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData*)data;
|
||||||
@ -209,7 +207,6 @@ void QNetworkReplyNSURLConnectionImpl::readyReadOutgoingData()
|
|||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_3_0)
|
|
||||||
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
|
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
|
||||||
{
|
{
|
||||||
Q_UNUSED(connection)
|
Q_UNUSED(connection)
|
||||||
@ -236,7 +233,6 @@ void QNetworkReplyNSURLConnectionImpl::readyReadOutgoingData()
|
|||||||
|
|
||||||
[challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge];
|
[challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
- (void)connection:(NSURLConnection*)connection didFailWithError:(NSError*)error
|
- (void)connection:(NSURLConnection*)connection didFailWithError:(NSError*)error
|
||||||
{
|
{
|
||||||
|
@ -234,60 +234,55 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
|
|||||||
QCFType<CFStringRef> cfPacLocation = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, pacLocationSetting, NULL, NULL,
|
QCFType<CFStringRef> cfPacLocation = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, pacLocationSetting, NULL, NULL,
|
||||||
kCFStringEncodingUTF8);
|
kCFStringEncodingUTF8);
|
||||||
|
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
|
QCFType<CFDataRef> pacData;
|
||||||
QCFType<CFDataRef> pacData;
|
QCFType<CFURLRef> pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL);
|
||||||
QCFType<CFURLRef> pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL);
|
if (!pacUrl) {
|
||||||
if (!pacUrl) {
|
qWarning("Invalid PAC URL \"%s\"", qPrintable(QCFString::toQString(cfPacLocation)));
|
||||||
qWarning("Invalid PAC URL \"%s\"", qPrintable(QCFString::toQString(cfPacLocation)));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
SInt32 errorCode;
|
|
||||||
if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, pacUrl, &pacData, NULL, NULL, &errorCode)) {
|
|
||||||
QString pacLocation = QCFString::toQString(cfPacLocation);
|
|
||||||
qWarning("Unable to get the PAC script at \"%s\" (%s)", qPrintable(pacLocation), cfurlErrorDescription(errorCode));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (!pacData) {
|
|
||||||
qWarning("\"%s\" returned an empty PAC script", qPrintable(QCFString::toQString(cfPacLocation)));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
QCFType<CFStringRef> pacScript = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, pacData, kCFStringEncodingISOLatin1);
|
|
||||||
if (!pacScript) {
|
|
||||||
// This should never happen, but the documentation says it may return NULL if there was a problem creating the object.
|
|
||||||
QString pacLocation = QCFString::toQString(cfPacLocation);
|
|
||||||
qWarning("Unable to read the PAC script at \"%s\"", qPrintable(pacLocation));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray encodedURL = query.url().toEncoded(); // converted to UTF-8
|
|
||||||
if (encodedURL.isEmpty()) {
|
|
||||||
return result; // Invalid URL, abort
|
|
||||||
}
|
|
||||||
|
|
||||||
QCFType<CFURLRef> targetURL = CFURLCreateWithBytes(kCFAllocatorDefault, (UInt8*)encodedURL.data(), encodedURL.size(), kCFStringEncodingUTF8, NULL);
|
|
||||||
if (!targetURL) {
|
|
||||||
return result; // URL creation problem, abort
|
|
||||||
}
|
|
||||||
|
|
||||||
QCFType<CFErrorRef> pacError;
|
|
||||||
QCFType<CFArrayRef> proxies = CFNetworkCopyProxiesForAutoConfigurationScript(pacScript, targetURL, &pacError);
|
|
||||||
if (!proxies) {
|
|
||||||
QString pacLocation = QCFString::toQString(cfPacLocation);
|
|
||||||
QCFType<CFStringRef> pacErrorDescription = CFErrorCopyDescription(pacError);
|
|
||||||
qWarning("Execution of PAC script at \"%s\" failed: %s", qPrintable(pacLocation), qPrintable(QCFString::toQString(pacErrorDescription)));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
CFIndex size = CFArrayGetCount(proxies);
|
|
||||||
for (CFIndex i = 0; i < size; ++i) {
|
|
||||||
CFDictionaryRef proxy = (CFDictionaryRef)CFArrayGetValueAtIndex(proxies, i);
|
|
||||||
result << proxyFromDictionary(proxy);
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
} else {
|
|
||||||
QString pacLocation = QCFString::toQString(cfPacLocation);
|
|
||||||
qWarning("Mac system proxy: PAC script at \"%s\" not handled", qPrintable(pacLocation));
|
|
||||||
}
|
}
|
||||||
|
SInt32 errorCode;
|
||||||
|
if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, pacUrl, &pacData, NULL, NULL, &errorCode)) {
|
||||||
|
QString pacLocation = QCFString::toQString(cfPacLocation);
|
||||||
|
qWarning("Unable to get the PAC script at \"%s\" (%s)", qPrintable(pacLocation), cfurlErrorDescription(errorCode));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (!pacData) {
|
||||||
|
qWarning("\"%s\" returned an empty PAC script", qPrintable(QCFString::toQString(cfPacLocation)));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
QCFType<CFStringRef> pacScript = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, pacData, kCFStringEncodingISOLatin1);
|
||||||
|
if (!pacScript) {
|
||||||
|
// This should never happen, but the documentation says it may return NULL if there was a problem creating the object.
|
||||||
|
QString pacLocation = QCFString::toQString(cfPacLocation);
|
||||||
|
qWarning("Unable to read the PAC script at \"%s\"", qPrintable(pacLocation));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray encodedURL = query.url().toEncoded(); // converted to UTF-8
|
||||||
|
if (encodedURL.isEmpty()) {
|
||||||
|
return result; // Invalid URL, abort
|
||||||
|
}
|
||||||
|
|
||||||
|
QCFType<CFURLRef> targetURL = CFURLCreateWithBytes(kCFAllocatorDefault, (UInt8*)encodedURL.data(), encodedURL.size(), kCFStringEncodingUTF8, NULL);
|
||||||
|
if (!targetURL) {
|
||||||
|
return result; // URL creation problem, abort
|
||||||
|
}
|
||||||
|
|
||||||
|
QCFType<CFErrorRef> pacError;
|
||||||
|
QCFType<CFArrayRef> proxies = CFNetworkCopyProxiesForAutoConfigurationScript(pacScript, targetURL, &pacError);
|
||||||
|
if (!proxies) {
|
||||||
|
QString pacLocation = QCFString::toQString(cfPacLocation);
|
||||||
|
QCFType<CFStringRef> pacErrorDescription = CFErrorCopyDescription(pacError);
|
||||||
|
qWarning("Execution of PAC script at \"%s\" failed: %s", qPrintable(pacLocation), qPrintable(QCFString::toQString(pacErrorDescription)));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFIndex size = CFArrayGetCount(proxies);
|
||||||
|
for (CFIndex i = 0; i < size; ++i) {
|
||||||
|
CFDictionaryRef proxy = (CFDictionaryRef)CFArrayGetValueAtIndex(proxies, i);
|
||||||
|
result << proxyFromDictionary(proxy);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,57 +68,18 @@ QT_BEGIN_NAMESPACE
|
|||||||
static SSLContextRef qt_createSecureTransportContext(QSslSocket::SslMode mode)
|
static SSLContextRef qt_createSecureTransportContext(QSslSocket::SslMode mode)
|
||||||
{
|
{
|
||||||
const bool isServer = mode == QSslSocket::SslServerMode;
|
const bool isServer = mode == QSslSocket::SslServerMode;
|
||||||
SSLContextRef context = Q_NULLPTR;
|
|
||||||
|
|
||||||
#ifndef Q_OS_OSX
|
|
||||||
const SSLProtocolSide side = isServer ? kSSLServerSide : kSSLClientSide;
|
const SSLProtocolSide side = isServer ? kSSLServerSide : kSSLClientSide;
|
||||||
// We never use kSSLDatagramType, so it's kSSLStreamType unconditionally.
|
// We never use kSSLDatagramType, so it's kSSLStreamType unconditionally.
|
||||||
context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType);
|
SSLContextRef context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType);
|
||||||
if (!context)
|
if (!context)
|
||||||
qCWarning(lcSsl) << "SSLCreateContext failed";
|
qCWarning(lcSsl) << "SSLCreateContext failed";
|
||||||
#else // Q_OS_OSX
|
|
||||||
|
|
||||||
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA)
|
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
|
|
||||||
const SSLProtocolSide side = isServer ? kSSLServerSide : kSSLClientSide;
|
|
||||||
// We never use kSSLDatagramType, so it's kSSLStreamType unconditionally.
|
|
||||||
context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType);
|
|
||||||
if (!context)
|
|
||||||
qCWarning(lcSsl) << "SSLCreateContext failed";
|
|
||||||
} else {
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
const OSStatus errCode = SSLNewContext(isServer, &context);
|
|
||||||
if (errCode != noErr || !context)
|
|
||||||
qCWarning(lcSsl) << "SSLNewContext failed with error:" << errCode;
|
|
||||||
}
|
|
||||||
#endif // !Q_OS_OSX
|
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qt_releaseSecureTransportContext(SSLContextRef context)
|
static void qt_releaseSecureTransportContext(SSLContextRef context)
|
||||||
{
|
{
|
||||||
if (!context)
|
if (context)
|
||||||
return;
|
|
||||||
|
|
||||||
#ifndef Q_OS_OSX
|
|
||||||
CFRelease(context);
|
|
||||||
#else
|
|
||||||
|
|
||||||
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA)
|
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
|
|
||||||
CFRelease(context);
|
CFRelease(context);
|
||||||
} else {
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
#endif // QT_MAC_PLATFORM_...
|
|
||||||
const OSStatus errCode = SSLDisposeContext(context);
|
|
||||||
if (errCode != noErr)
|
|
||||||
qCWarning(lcSsl) << "SSLDisposeContext failed with error:" << errCode;
|
|
||||||
}
|
|
||||||
#endif // !Q_OS_OSX
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool qt_setSessionProtocol(SSLContextRef context, const QSslConfigurationPrivate &configuration,
|
static bool qt_setSessionProtocol(SSLContextRef context, const QSslConfigurationPrivate &configuration,
|
||||||
@ -132,7 +93,6 @@ static bool qt_setSessionProtocol(SSLContextRef context, const QSslConfiguration
|
|||||||
|
|
||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
|
|
||||||
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_5_0)
|
|
||||||
if (configuration.protocol == QSsl::SslV3) {
|
if (configuration.protocol == QSsl::SslV3) {
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
#ifdef QSSLSOCKET_DEBUG
|
||||||
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3";
|
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3";
|
||||||
@ -210,117 +170,10 @@ static bool qt_setSessionProtocol(SSLContextRef context, const QSslConfiguration
|
|||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return err == noErr;
|
return err == noErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_OSX
|
|
||||||
|
|
||||||
static bool qt_setSessionProtocolOSX(SSLContextRef context, const QSslConfigurationPrivate &configuration,
|
|
||||||
QTcpSocket *plainSocket)
|
|
||||||
{
|
|
||||||
// This function works with (now) deprecated API that does not even exist on
|
|
||||||
// iOS but is the only API we have on OS X below 10.8
|
|
||||||
|
|
||||||
// Without SSLSetProtocolVersionMin/Max functions it's quite difficult
|
|
||||||
// to have the required result:
|
|
||||||
// If we use SSLSetProtocolVersion - any constant except the ones with 'Only' suffix -
|
|
||||||
// allows a negotiation and we can not set the lower limit.
|
|
||||||
// SSLSetProtocolVersionEnabled supports only a limited subset of constants, if you believe their docs:
|
|
||||||
// kSSLProtocol2
|
|
||||||
// kSSLProtocol3
|
|
||||||
// kTLSProtocol1
|
|
||||||
// kSSLProtocolAll
|
|
||||||
// Here we can only have a look into the SecureTransport's code and hope that what we see there
|
|
||||||
// and what we have on 10.7 is similar:
|
|
||||||
// SSLSetProtocoLVersionEnabled actually accepts other constants also,
|
|
||||||
// called twice with two different protocols it sets a range,
|
|
||||||
// called once with a protocol (when all protocols were disabled)
|
|
||||||
// - only this protocol is enabled (without a lower limit negotiation).
|
|
||||||
|
|
||||||
Q_ASSERT(context);
|
|
||||||
|
|
||||||
#ifndef QSSLSOCKET_DEBUG
|
|
||||||
Q_UNUSED(plainSocket)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OSStatus err = noErr;
|
|
||||||
|
|
||||||
// First, disable ALL:
|
|
||||||
if (SSLSetProtocolVersionEnabled(context, kSSLProtocolAll, false) != noErr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (configuration.protocol == QSsl::SslV3) {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3";
|
|
||||||
#endif
|
|
||||||
err = SSLSetProtocolVersion(context, kSSLProtocol3Only);
|
|
||||||
} else if (configuration.protocol == QSsl::TlsV1_0) {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.0";
|
|
||||||
#endif
|
|
||||||
err = SSLSetProtocolVersion(context, kTLSProtocol1Only);
|
|
||||||
} else if (configuration.protocol == QSsl::TlsV1_1) {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1";
|
|
||||||
#endif
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol11, true);
|
|
||||||
} else if (configuration.protocol == QSsl::TlsV1_2) {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
|
|
||||||
#endif
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
|
|
||||||
} else if (configuration.protocol == QSsl::AnyProtocol) {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qCDebug(lcSsl) << plainSocket << "requesting : any";
|
|
||||||
#endif
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kSSLProtocolAll, true);
|
|
||||||
} else if (configuration.protocol == QSsl::TlsV1SslV3) {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3 - TLSv1.2";
|
|
||||||
#endif
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
|
|
||||||
if (err == noErr)
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kSSLProtocol3, true);
|
|
||||||
} else if (configuration.protocol == QSsl::SecureProtocols) {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
|
|
||||||
#endif
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
|
|
||||||
if (err == noErr)
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol1, true);
|
|
||||||
} else if (configuration.protocol == QSsl::TlsV1_0OrLater) {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
|
|
||||||
#endif
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
|
|
||||||
if (err == noErr)
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol1, true);
|
|
||||||
} else if (configuration.protocol == QSsl::TlsV1_1OrLater) {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1 - TLSv1.2";
|
|
||||||
#endif
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
|
|
||||||
if (err == noErr)
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol11, true);
|
|
||||||
} else if (configuration.protocol == QSsl::TlsV1_2OrLater) {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
|
|
||||||
#endif
|
|
||||||
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
|
|
||||||
} else {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qCDebug(lcSsl) << plainSocket << "no protocol version found in the configuration";
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return err == noErr;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // Q_OS_OSX
|
|
||||||
|
|
||||||
QSecureTransportContext::QSecureTransportContext(SSLContextRef c)
|
QSecureTransportContext::QSecureTransportContext(SSLContextRef c)
|
||||||
: context(c)
|
: context(c)
|
||||||
{
|
{
|
||||||
@ -959,21 +812,6 @@ bool QSslSocketBackendPrivate::initSslContext()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_OSX
|
|
||||||
if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_8) {
|
|
||||||
// Starting from OS X 10.8 SSLSetSessionOption with kSSLSessionOptionBreakOnServerAuth/
|
|
||||||
// kSSLSessionOptionBreakOnClientAuth disables automatic certificate validation.
|
|
||||||
// But for OS X versions below 10.8 we have to do it explicitly:
|
|
||||||
const OSStatus err = SSLSetEnableCertVerify(context, false);
|
|
||||||
if (err != noErr) {
|
|
||||||
destroySslContext();
|
|
||||||
setErrorAndEmit(QSslSocket::SslInternalError,
|
|
||||||
QStringLiteral("SSLSetEnableCertVerify failed: %1").arg(err));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mode == QSslSocket::SslClientMode) {
|
if (mode == QSslSocket::SslClientMode) {
|
||||||
// enable Server Name Indication (SNI)
|
// enable Server Name Indication (SNI)
|
||||||
QString tlsHostName(verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName);
|
QString tlsHostName(verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName);
|
||||||
@ -1128,20 +966,7 @@ bool QSslSocketBackendPrivate::setSessionProtocol()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_OSX
|
|
||||||
return qt_setSessionProtocol(context, configuration, plainSocket);
|
return qt_setSessionProtocol(context, configuration, plainSocket);
|
||||||
#else
|
|
||||||
|
|
||||||
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA)
|
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
|
|
||||||
return qt_setSessionProtocol(context, configuration, plainSocket);
|
|
||||||
} else {
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
return qt_setSessionProtocolOSX(context, configuration, plainSocket);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QSslSocketBackendPrivate::canIgnoreTrustVerificationFailure() const
|
bool QSslSocketBackendPrivate::canIgnoreTrustVerificationFailure() const
|
||||||
|
@ -78,22 +78,15 @@ void *qcgl_createNSOpenGLPixelFormat(const QSurfaceFormat &format)
|
|||||||
if (format.swapBehavior() != QSurfaceFormat::SingleBuffer)
|
if (format.swapBehavior() != QSurfaceFormat::SingleBuffer)
|
||||||
attrs.append(NSOpenGLPFADoubleBuffer);
|
attrs.append(NSOpenGLPFADoubleBuffer);
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
if (format.profile() == QSurfaceFormat::CoreProfile
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
|
&& ((format.majorVersion() == 3 && format.minorVersion() >= 2)
|
||||||
if (format.profile() == QSurfaceFormat::CoreProfile
|
|| format.majorVersion() > 3)) {
|
||||||
&& ((format.majorVersion() == 3 && format.minorVersion() >= 2)
|
attrs << NSOpenGLPFAOpenGLProfile;
|
||||||
|| format.majorVersion() > 3)) {
|
attrs << NSOpenGLProfileVersion3_2Core;
|
||||||
attrs << NSOpenGLPFAOpenGLProfile;
|
} else {
|
||||||
attrs << NSOpenGLProfileVersion3_2Core;
|
attrs << NSOpenGLPFAOpenGLProfile;
|
||||||
} else {
|
attrs << NSOpenGLProfileVersionLegacy;
|
||||||
attrs << NSOpenGLPFAOpenGLProfile;
|
|
||||||
attrs << NSOpenGLProfileVersionLegacy;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (format.profile() == QSurfaceFormat::CoreProfile)
|
|
||||||
qWarning("Mac OSX >= 10.7 is needed for OpenGL Core Profile support");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (format.depthBufferSize() > 0)
|
if (format.depthBufferSize() > 0)
|
||||||
attrs << NSOpenGLPFADepthSize << format.depthBufferSize();
|
attrs << NSOpenGLPFADepthSize << format.depthBufferSize();
|
||||||
|
@ -522,11 +522,6 @@ QString QMacPasteboardMimeRtfText::mimeFor(QString flav)
|
|||||||
|
|
||||||
bool QMacPasteboardMimeRtfText::canConvert(const QString &mime, QString flav)
|
bool QMacPasteboardMimeRtfText::canConvert(const QString &mime, QString flav)
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_IOS)
|
|
||||||
if (QSysInfo::MacintoshVersion < QSysInfo::MV_IOS_7_0)
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return mime == mimeFor(flav);
|
return mime == mimeFor(flav);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,46 +517,37 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
|
|||||||
static QHash<QString, QStringList> fallbackLists;
|
static QHash<QString, QStringList> fallbackLists;
|
||||||
|
|
||||||
if (!family.isEmpty()) {
|
if (!family.isEmpty()) {
|
||||||
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_6_0)
|
QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||||
// CTFontCopyDefaultCascadeListForLanguages is available in the SDK
|
CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, QCFString(family));
|
||||||
#if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_8, __IPHONE_6_0)
|
if (QCFType<CTFontDescriptorRef> fontDescriptor = CTFontDescriptorCreateWithAttributes(attributes)) {
|
||||||
// But we have to feature check at runtime
|
if (QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(fontDescriptor, 12.0, 0)) {
|
||||||
if (&CTFontCopyDefaultCascadeListForLanguages)
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
#endif
|
NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"];
|
||||||
{
|
|
||||||
QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
|
||||||
CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, QCFString(family));
|
|
||||||
if (QCFType<CTFontDescriptorRef> fontDescriptor = CTFontDescriptorCreateWithAttributes(attributes)) {
|
|
||||||
if (QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(fontDescriptor, 12.0, 0)) {
|
|
||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
||||||
NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"];
|
|
||||||
|
|
||||||
QCFType<CFArrayRef> cascadeList = (CFArrayRef) CTFontCopyDefaultCascadeListForLanguages(font, (CFArrayRef) languages);
|
QCFType<CFArrayRef> cascadeList = (CFArrayRef) CTFontCopyDefaultCascadeListForLanguages(font, (CFArrayRef) languages);
|
||||||
if (cascadeList) {
|
if (cascadeList) {
|
||||||
QStringList fallbackList;
|
QStringList fallbackList;
|
||||||
const int numCascades = CFArrayGetCount(cascadeList);
|
const int numCascades = CFArrayGetCount(cascadeList);
|
||||||
for (int i = 0; i < numCascades; ++i) {
|
for (int i = 0; i < numCascades; ++i) {
|
||||||
CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i);
|
CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i);
|
||||||
QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute);
|
QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute);
|
||||||
fallbackList.append(QCFString::toQString(fallbackFamilyName));
|
fallbackList.append(QCFString::toQString(fallbackFamilyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_OSX)
|
#if defined(Q_OS_OSX)
|
||||||
// Since we are only returning a list of default fonts for the current language, we do not
|
// Since we are only returning a list of default fonts for the current language, we do not
|
||||||
// cover all unicode completely. This was especially an issue for some of the common script
|
// cover all unicode completely. This was especially an issue for some of the common script
|
||||||
// symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk
|
// symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk
|
||||||
// of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most
|
// of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most
|
||||||
// of Unicode 2.1.
|
// of Unicode 2.1.
|
||||||
if (!fallbackList.contains(QStringLiteral("Arial Unicode MS")))
|
if (!fallbackList.contains(QStringLiteral("Arial Unicode MS")))
|
||||||
fallbackList.append(QStringLiteral("Arial Unicode MS"));
|
fallbackList.append(QStringLiteral("Arial Unicode MS"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return fallbackList;
|
return fallbackList;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We were not able to find a fallback for the specific family,
|
// We were not able to find a fallback for the specific family,
|
||||||
@ -620,7 +611,6 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
|
|||||||
return fallbackLists[styleLookupKey.arg(styleHint)];
|
return fallbackLists[styleLookupKey.arg(styleHint)];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_CORETEXT
|
|
||||||
static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fileName = QString())
|
static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fileName = QString())
|
||||||
{
|
{
|
||||||
CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
|
CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
|
||||||
@ -653,104 +643,41 @@ static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fi
|
|||||||
CFArrayAppendValue(array, descriptor);
|
CFArrayAppendValue(array, descriptor);
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
|
QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
|
||||||
{
|
{
|
||||||
QCFType<CFArrayRef> fonts;
|
QCFType<CFArrayRef> fonts;
|
||||||
QStringList families;
|
QStringList families;
|
||||||
|
|
||||||
#if HAVE_CORETEXT
|
CFErrorRef error = 0;
|
||||||
if (&CTFontManagerRegisterGraphicsFont) {
|
if (!fontData.isEmpty()) {
|
||||||
CFErrorRef error = 0;
|
QByteArray* fontDataCopy = new QByteArray(fontData);
|
||||||
if (!fontData.isEmpty()) {
|
QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(fontDataCopy,
|
||||||
QByteArray* fontDataCopy = new QByteArray(fontData);
|
fontDataCopy->constData(), fontDataCopy->size(), releaseFontData);
|
||||||
QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(fontDataCopy,
|
QCFType<CGFontRef> cgFont = CGFontCreateWithDataProvider(dataProvider);
|
||||||
fontDataCopy->constData(), fontDataCopy->size(), releaseFontData);
|
if (cgFont) {
|
||||||
QCFType<CGFontRef> cgFont = CGFontCreateWithDataProvider(dataProvider);
|
if (CTFontManagerRegisterGraphicsFont(cgFont, &error)) {
|
||||||
if (cgFont) {
|
QCFType<CTFontRef> font = CTFontCreateWithGraphicsFont(cgFont, 0.0, NULL, NULL);
|
||||||
if (CTFontManagerRegisterGraphicsFont(cgFont, &error)) {
|
fonts = createDescriptorArrayForFont(font
|
||||||
QCFType<CTFontRef> font = CTFontCreateWithGraphicsFont(cgFont, 0.0, NULL, NULL);
|
|
||||||
fonts = createDescriptorArrayForFont(font
|
|
||||||
#ifndef QT_NO_FREETYPE
|
#ifndef QT_NO_FREETYPE
|
||||||
, m_useFreeType ? fileName : QString()
|
, m_useFreeType ? fileName : QString()
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
m_applicationFonts.append(QVariant::fromValue(QCFType<CGFontRef>::constructFromGet(cgFont)));
|
m_applicationFonts.append(QVariant::fromValue(QCFType<CGFontRef>::constructFromGet(cgFont)));
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
QCFType<CFURLRef> fontURL = CFURLCreateWithFileSystemPath(NULL, QCFString(fileName), kCFURLPOSIXPathStyle, false);
|
|
||||||
if (CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error)) {
|
|
||||||
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_6, __IPHONE_7_0)
|
|
||||||
if (&CTFontManagerCreateFontDescriptorsFromURL)
|
|
||||||
fonts = CTFontManagerCreateFontDescriptorsFromURL(fontURL);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// We're limited to a single font per file, unless we dive into the font tables
|
|
||||||
QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 1,
|
|
||||||
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
|
||||||
CFDictionaryAddValue(attributes, kCTFontURLAttribute, fontURL);
|
|
||||||
QCFType<CTFontDescriptorRef> descriptor = CTFontDescriptorCreateWithAttributes(attributes);
|
|
||||||
QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(descriptor, 0.0, NULL);
|
|
||||||
fonts = createDescriptorArrayForFont(font);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_applicationFonts.append(QVariant::fromValue(QCFType<CFURLRef>::constructFromGet(fontURL)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
if (error) {
|
QCFType<CFURLRef> fontURL = CFURLCreateWithFileSystemPath(NULL, QCFString(fileName), kCFURLPOSIXPathStyle, false);
|
||||||
NSLog(@"Unable to register font: %@", error);
|
if (CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error)) {
|
||||||
CFRelease(error);
|
fonts = CTFontManagerCreateFontDescriptorsFromURL(fontURL);
|
||||||
|
m_applicationFonts.append(QVariant::fromValue(QCFType<CFURLRef>::constructFromGet(fontURL)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if HAVE_CORETEXT && HAVE_ATS
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
#if HAVE_ATS
|
|
||||||
{
|
|
||||||
ATSFontContainerRef fontContainer;
|
|
||||||
OSStatus e;
|
|
||||||
|
|
||||||
if (!fontData.isEmpty()) {
|
if (error) {
|
||||||
e = ATSFontActivateFromMemory((void *) fontData.constData(), fontData.size(),
|
NSLog(@"Unable to register font: %@", error);
|
||||||
kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
|
CFRelease(error);
|
||||||
kATSOptionFlagsDefault, &fontContainer);
|
|
||||||
} else {
|
|
||||||
FSRef ref;
|
|
||||||
if (FSPathMakeRef(reinterpret_cast<const UInt8 *>(fileName.toUtf8().constData()),
|
|
||||||
&ref, 0) != noErr)
|
|
||||||
return QStringList();
|
|
||||||
e = ATSFontActivateFromFileReference(&ref, kATSFontContextLocal, kATSFontFormatUnspecified, 0,
|
|
||||||
kATSOptionFlagsDefault, &fontContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e == noErr) {
|
|
||||||
ItemCount fontCount = 0;
|
|
||||||
e = ATSFontFindFromContainer(fontContainer, kATSOptionFlagsDefault, 0, 0, &fontCount);
|
|
||||||
if (e != noErr)
|
|
||||||
return QStringList();
|
|
||||||
|
|
||||||
QVarLengthArray<ATSFontRef> containedFonts(fontCount);
|
|
||||||
e = ATSFontFindFromContainer(fontContainer, kATSOptionFlagsDefault, fontCount, containedFonts.data(), &fontCount);
|
|
||||||
if (e != noErr)
|
|
||||||
return QStringList();
|
|
||||||
|
|
||||||
CFMutableArrayRef fontsArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
|
|
||||||
for (int i = 0; i < containedFonts.size(); ++i) {
|
|
||||||
QCFType<CTFontRef> font = CTFontCreateWithPlatformFont(containedFonts[i], 12.0, NULL, NULL);
|
|
||||||
CFArrayAppendValue(fontsArray, QCFType<CTFontDescriptorRef>(CTFontCopyFontDescriptor(font)));
|
|
||||||
}
|
|
||||||
|
|
||||||
fonts = fontsArray;
|
|
||||||
|
|
||||||
m_applicationFonts.append(QVariant::fromValue(fontContainer));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fonts) {
|
if (fonts) {
|
||||||
const int numFonts = CFArrayGetCount(fonts);
|
const int numFonts = CFArrayGetCount(fonts);
|
||||||
@ -848,38 +775,36 @@ static CTFontUIFontType fontTypeFromTheme(QPlatformTheme::Font f)
|
|||||||
static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f)
|
static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f)
|
||||||
{
|
{
|
||||||
#if defined(QT_PLATFORM_UIKIT)
|
#if defined(QT_PLATFORM_UIKIT)
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) {
|
// Use Dynamic Type to resolve theme fonts if possible, to get
|
||||||
// Use Dynamic Type to resolve theme fonts if possible, to get
|
// correct font sizes and style based on user configuration.
|
||||||
// correct font sizes and style based on user configuration.
|
NSString *textStyle = 0;
|
||||||
NSString *textStyle = 0;
|
switch (f) {
|
||||||
switch (f) {
|
case QPlatformTheme::TitleBarFont:
|
||||||
case QPlatformTheme::TitleBarFont:
|
case QPlatformTheme::HeaderViewFont:
|
||||||
case QPlatformTheme::HeaderViewFont:
|
textStyle = UIFontTextStyleHeadline;
|
||||||
textStyle = UIFontTextStyleHeadline;
|
break;
|
||||||
break;
|
case QPlatformTheme::MdiSubWindowTitleFont:
|
||||||
case QPlatformTheme::MdiSubWindowTitleFont:
|
textStyle = UIFontTextStyleSubheadline;
|
||||||
textStyle = UIFontTextStyleSubheadline;
|
break;
|
||||||
break;
|
case QPlatformTheme::TipLabelFont:
|
||||||
case QPlatformTheme::TipLabelFont:
|
case QPlatformTheme::SmallFont:
|
||||||
case QPlatformTheme::SmallFont:
|
textStyle = UIFontTextStyleFootnote;
|
||||||
textStyle = UIFontTextStyleFootnote;
|
break;
|
||||||
break;
|
case QPlatformTheme::MiniFont:
|
||||||
case QPlatformTheme::MiniFont:
|
textStyle = UIFontTextStyleCaption2;
|
||||||
textStyle = UIFontTextStyleCaption2;
|
break;
|
||||||
break;
|
case QPlatformTheme::FixedFont:
|
||||||
case QPlatformTheme::FixedFont:
|
// Fall back to regular code path, as iOS doesn't provide
|
||||||
// Fall back to regular code path, as iOS doesn't provide
|
// an appropriate text style for this theme font.
|
||||||
// an appropriate text style for this theme font.
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
textStyle = UIFontTextStyleBody;
|
||||||
textStyle = UIFontTextStyleBody;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (textStyle) {
|
if (textStyle) {
|
||||||
UIFontDescriptor *desc = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle];
|
UIFontDescriptor *desc = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle];
|
||||||
return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc));
|
return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif // Q_OS_IOS, Q_OS_TVOS
|
#endif // Q_OS_IOS, Q_OS_TVOS
|
||||||
|
|
||||||
@ -948,31 +873,15 @@ void QCoreTextFontDatabase::removeApplicationFonts()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (const QVariant &font, m_applicationFonts) {
|
foreach (const QVariant &font, m_applicationFonts) {
|
||||||
#if HAVE_CORETEXT
|
CFErrorRef error;
|
||||||
if (&CTFontManagerUnregisterGraphicsFont && &CTFontManagerUnregisterFontsForURL) {
|
if (font.canConvert(qMetaTypeId<QCFType<CGFontRef> >())) {
|
||||||
CFErrorRef error;
|
CTFontManagerUnregisterGraphicsFont(font.value<QCFType<CGFontRef> >(), &error);
|
||||||
if (font.canConvert(qMetaTypeId<QCFType<CGFontRef> >())) {
|
} else if (font.canConvert(qMetaTypeId<QCFType<CFURLRef> >())) {
|
||||||
CTFontManagerUnregisterGraphicsFont(font.value<QCFType<CGFontRef> >(), &error);
|
CTFontManagerUnregisterFontsForURL(font.value<QCFType<CFURLRef> >(), kCTFontManagerScopeProcess, &error);
|
||||||
} else if (font.canConvert(qMetaTypeId<QCFType<CFURLRef> >())) {
|
|
||||||
CTFontManagerUnregisterFontsForURL(font.value<QCFType<CFURLRef> >(), kCTFontManagerScopeProcess, &error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if HAVE_CORETEXT && HAVE_ATS
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
#if HAVE_ATS
|
|
||||||
if (font.canConvert(qMetaTypeId<ATSFontContainerRef>())) {
|
|
||||||
ATSFontDeactivate(font.value<ATSFontContainerRef>(), 0, kATSOptionFlagsDoNotNotify);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_applicationFonts.clear();
|
m_applicationFonts.clear();
|
||||||
|
|
||||||
#if HAVE_ATS
|
|
||||||
ATSFontNotify(kATSFontNotifyActionFontsChanged, 0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_FREETYPE
|
#ifndef QT_NO_FREETYPE
|
||||||
|
@ -52,8 +52,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <qglobal.h>
|
#include <qglobal.h>
|
||||||
#define HAVE_CORETEXT QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_4_1)
|
|
||||||
#define HAVE_ATS QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_5, __IPHONE_NA)
|
|
||||||
|
|
||||||
#include <qpa/qplatformfontdatabase.h>
|
#include <qpa/qplatformfontdatabase.h>
|
||||||
#include <qpa/qplatformtheme.h>
|
#include <qpa/qplatformtheme.h>
|
||||||
@ -66,13 +64,8 @@
|
|||||||
#include <CoreGraphics/CoreGraphics.h>
|
#include <CoreGraphics/CoreGraphics.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_CORETEXT
|
|
||||||
Q_DECLARE_METATYPE(QCFType<CGFontRef>);
|
Q_DECLARE_METATYPE(QCFType<CGFontRef>);
|
||||||
Q_DECLARE_METATYPE(QCFType<CFURLRef>);
|
Q_DECLARE_METATYPE(QCFType<CFURLRef>);
|
||||||
#endif
|
|
||||||
#if HAVE_ATS
|
|
||||||
Q_DECLARE_METATYPE(ATSFontContainerRef);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
@ -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)
|
// (and providing no public API to get the underlying color without this insanity)
|
||||||
if (qt_mac_isSystemColorOrInstance(color, @"controlColor", @"NSGradientPatternColor") ||
|
if (qt_mac_isSystemColorOrInstance(color, @"controlColor", @"NSGradientPatternColor") ||
|
||||||
qt_mac_isSystemColorOrInstance(color, @"windowBackgroundColor", @"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.setStyle(Qt::SolidPattern);
|
||||||
qtBrush.setColor(newColor);
|
qtBrush.setColor(qt_mac_toQColor(color.CGColor));
|
||||||
return qtBrush;
|
return qtBrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,11 +91,8 @@ QT_USE_NAMESPACE
|
|||||||
@class QT_MANGLE_NAMESPACE(QNSMenu);
|
@class QT_MANGLE_NAMESPACE(QNSMenu);
|
||||||
@class QT_MANGLE_NAMESPACE(QNSImageView);
|
@class QT_MANGLE_NAMESPACE(QNSImageView);
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject
|
@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject <NSUserNotificationCenterDelegate>
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
|
{
|
||||||
<NSUserNotificationCenterDelegate>
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
@public
|
@public
|
||||||
QCocoaSystemTrayIcon *systray;
|
QCocoaSystemTrayIcon *systray;
|
||||||
NSStatusItem *item;
|
NSStatusItem *item;
|
||||||
@ -109,11 +106,8 @@ QT_USE_NAMESPACE
|
|||||||
-(QRectF)geometry;
|
-(QRectF)geometry;
|
||||||
- (void)triggerSelector:(id)sender button:(Qt::MouseButton)mouseButton;
|
- (void)triggerSelector:(id)sender button:(Qt::MouseButton)mouseButton;
|
||||||
- (void)doubleClickSelector:(id)sender;
|
- (void)doubleClickSelector:(id)sender;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
|
|
||||||
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification;
|
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification;
|
||||||
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification;
|
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification;
|
||||||
#endif
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView {
|
@interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView {
|
||||||
@ -142,19 +136,11 @@ class QSystemTrayIconSys
|
|||||||
public:
|
public:
|
||||||
QSystemTrayIconSys(QCocoaSystemTrayIcon *sys) {
|
QSystemTrayIconSys(QCocoaSystemTrayIcon *sys) {
|
||||||
item = [[QNSStatusItem alloc] initWithSysTray:sys];
|
item = [[QNSStatusItem alloc] initWithSysTray:sys];
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
|
[[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:item];
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
|
|
||||||
[[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:item];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
~QSystemTrayIconSys() {
|
~QSystemTrayIconSys() {
|
||||||
[[[item item] view] setHidden: YES];
|
[[[item item] view] setHidden: YES];
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
|
[[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:nil];
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
|
|
||||||
[[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:nil];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
[item release];
|
[item release];
|
||||||
}
|
}
|
||||||
QNSStatusItem *item;
|
QNSStatusItem *item;
|
||||||
@ -296,71 +282,15 @@ bool QCocoaSystemTrayIcon::supportsMessages() const
|
|||||||
void QCocoaSystemTrayIcon::showMessage(const QString &title, const QString &message,
|
void QCocoaSystemTrayIcon::showMessage(const QString &title, const QString &message,
|
||||||
const QIcon& icon, MessageIcon, int)
|
const QIcon& icon, MessageIcon, int)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(icon);
|
||||||
if (!m_sys)
|
if (!m_sys)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
|
NSUserNotification *notification = [[NSUserNotification alloc] init];
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
|
notification.title = [NSString stringWithUTF8String:title.toUtf8().data()];
|
||||||
NSUserNotification *notification = [[NSUserNotification alloc] init];
|
notification.informativeText = [NSString stringWithUTF8String:message.toUtf8().data()];
|
||||||
notification.title = [NSString stringWithUTF8String:title.toUtf8().data()];
|
|
||||||
notification.informativeText = [NSString stringWithUTF8String:message.toUtf8().data()];
|
|
||||||
|
|
||||||
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
|
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
@ -499,7 +429,6 @@ QT_END_NAMESPACE
|
|||||||
emit systray->activated(QPlatformSystemTrayIcon::DoubleClick);
|
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 {
|
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification {
|
||||||
Q_UNUSED(center);
|
Q_UNUSED(center);
|
||||||
Q_UNUSED(notification);
|
Q_UNUSED(notification);
|
||||||
@ -511,7 +440,6 @@ QT_END_NAMESPACE
|
|||||||
Q_UNUSED(notification);
|
Q_UNUSED(notification);
|
||||||
emit systray->messageClicked();
|
emit systray->messageClicked();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -85,7 +85,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
|
|||||||
bool m_resendKeyEvent;
|
bool m_resendKeyEvent;
|
||||||
bool m_scrolling;
|
bool m_scrolling;
|
||||||
bool m_updatingDrag;
|
bool m_updatingDrag;
|
||||||
bool m_exposedOnMoveToWindow;
|
|
||||||
NSEvent *m_currentlyInterpretedKeyEvent;
|
NSEvent *m_currentlyInterpretedKeyEvent;
|
||||||
bool m_isMenuView;
|
bool m_isMenuView;
|
||||||
QSet<quint32> m_acceptedKeyDowns;
|
QSet<quint32> m_acceptedKeyDowns;
|
||||||
|
@ -39,8 +39,6 @@
|
|||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
|
|
||||||
#include <dlfcn.h>
|
|
||||||
|
|
||||||
#include "qnsview.h"
|
#include "qnsview.h"
|
||||||
#include "qcocoawindow.h"
|
#include "qcocoawindow.h"
|
||||||
#include "qcocoahelpers.h"
|
#include "qcocoahelpers.h"
|
||||||
@ -72,9 +70,6 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
|
|||||||
|
|
||||||
static QTouchDevice *touchDevice = 0;
|
static QTouchDevice *touchDevice = 0;
|
||||||
|
|
||||||
// ### HACK Remove once 10.8 is unsupported
|
|
||||||
static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
|
|
||||||
|
|
||||||
static bool _q_dontOverrideCtrlLMB = false;
|
static bool _q_dontOverrideCtrlLMB = false;
|
||||||
|
|
||||||
@interface NSEvent (Qt_Compile_Leopard_DeviceDelta)
|
@interface NSEvent (Qt_Compile_Leopard_DeviceDelta)
|
||||||
@ -134,10 +129,6 @@ static bool _q_dontOverrideCtrlLMB = false;
|
|||||||
|
|
||||||
+ (void)initialize
|
+ (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");
|
_q_dontOverrideCtrlLMB = qt_mac_resolveOption(false, "QT_MAC_DONT_OVERRIDE_CTRL_LMB");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,18 +282,6 @@ static bool _q_dontOverrideCtrlLMB = false;
|
|||||||
- (void)viewDidMoveToWindow
|
- (void)viewDidMoveToWindow
|
||||||
{
|
{
|
||||||
m_backingStore = Q_NULLPTR;
|
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
|
- (void)viewWillMoveToWindow:(NSWindow *)newWindow
|
||||||
@ -446,14 +425,7 @@ static bool _q_dontOverrideCtrlLMB = false;
|
|||||||
m_platformWindow->obscureWindow();
|
m_platformWindow->obscureWindow();
|
||||||
} else if ([notificationName isEqualToString: @"NSWindowDidOrderOnScreenAndFinishAnimatingNotification"]) {
|
} else if ([notificationName isEqualToString: @"NSWindowDidOrderOnScreenAndFinishAnimatingNotification"]) {
|
||||||
m_platformWindow->exposeWindow();
|
m_platformWindow->exposeWindow();
|
||||||
} else if (_q_NSWindowDidChangeOcclusionStateNotification
|
} else if ([notificationName isEqualToString: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
|
|
||||||
// Several unit tests expect paint and/or expose events for windows that are
|
// Several unit tests expect paint and/or expose events for windows that are
|
||||||
// sometimes (unpredictably) occluded and some unit tests depend on QWindow::isExposed -
|
// sometimes (unpredictably) occluded and some unit tests depend on QWindow::isExposed -
|
||||||
// don't send Expose/Obscure events when running under QTestLib.
|
// don't send Expose/Obscure events when running under QTestLib.
|
||||||
@ -466,9 +438,6 @@ QT_WARNING_DISABLE_CLANG("-Wobjc-method-access")
|
|||||||
m_platformWindow->obscureWindow();
|
m_platformWindow->obscureWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
|
|
||||||
QT_WARNING_POP
|
|
||||||
#endif
|
|
||||||
} else if (notificationName == NSWindowDidChangeScreenNotification) {
|
} else if (notificationName == NSWindowDidChangeScreenNotification) {
|
||||||
if (m_window) {
|
if (m_window) {
|
||||||
NSUInteger screenIndex = [[NSScreen screens] indexOfObject:self.window.screen];
|
NSUInteger screenIndex = [[NSScreen screens] indexOfObject:self.window.screen];
|
||||||
@ -1389,7 +1358,6 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
|||||||
[event magnification], windowPoint, screenPoint);
|
[event magnification], windowPoint, screenPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
|
|
||||||
- (void)smartMagnifyWithEvent:(NSEvent *)event
|
- (void)smartMagnifyWithEvent:(NSEvent *)event
|
||||||
{
|
{
|
||||||
static bool zoomIn = true;
|
static bool zoomIn = true;
|
||||||
@ -1402,7 +1370,6 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
|||||||
zoomIn ? 1.0f : 0.0f, windowPoint, screenPoint);
|
zoomIn ? 1.0f : 0.0f, windowPoint, screenPoint);
|
||||||
zoomIn = !zoomIn;
|
zoomIn = !zoomIn;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
- (void)rotateWithEvent:(NSEvent *)event
|
- (void)rotateWithEvent:(NSEvent *)event
|
||||||
{
|
{
|
||||||
@ -1518,16 +1485,12 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
|||||||
|
|
||||||
NSEventPhase phase = [theEvent phase];
|
NSEventPhase phase = [theEvent phase];
|
||||||
Qt::ScrollPhase ph = Qt::ScrollUpdate;
|
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) {
|
// MayBegin is likely to happen. We treat it the same as an actual begin.
|
||||||
// On 10.8 and above, MayBegin is likely to happen. We treat it the same as an actual begin.
|
if (phase == NSEventPhaseMayBegin) {
|
||||||
if (phase == NSEventPhaseMayBegin) {
|
m_scrolling = true;
|
||||||
m_scrolling = true;
|
ph = Qt::ScrollBegin;
|
||||||
ph = Qt::ScrollBegin;
|
} else if (phase == NSEventPhaseBegan) {
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (phase == NSEventPhaseBegan) {
|
|
||||||
// If MayBegin did not happen, Began is the actual beginning.
|
// If MayBegin did not happen, Began is the actual beginning.
|
||||||
if (!m_scrolling)
|
if (!m_scrolling)
|
||||||
ph = Qt::ScrollBegin;
|
ph = Qt::ScrollBegin;
|
||||||
|
@ -679,11 +679,7 @@
|
|||||||
if (markedTextFormat.isEmpty()) {
|
if (markedTextFormat.isEmpty()) {
|
||||||
// There seems to be no way to query how the preedit text
|
// There seems to be no way to query how the preedit text
|
||||||
// should be drawn. So we need to hard-code the color.
|
// should be drawn. So we need to hard-code the color.
|
||||||
QSysInfo::MacVersion iosVersion = QSysInfo::MacintoshVersion;
|
markedTextFormat.setBackground(QColor(206, 221, 238));
|
||||||
if (iosVersion < QSysInfo::MV_IOS_7_0)
|
|
||||||
markedTextFormat.setBackground(QColor(235, 239, 247));
|
|
||||||
else
|
|
||||||
markedTextFormat.setBackground(QColor(206, 221, 238));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QInputMethodEvent::Attribute> attrs;
|
QList<QInputMethodEvent::Attribute> attrs;
|
||||||
|
@ -234,25 +234,6 @@
|
|||||||
if (self = [self init]) {
|
if (self = [self init]) {
|
||||||
m_screen = screen;
|
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;
|
self.changingOrientation = NO;
|
||||||
#ifndef Q_OS_TVOS
|
#ifndef Q_OS_TVOS
|
||||||
@ -316,7 +297,6 @@
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0)
|
|
||||||
- (NSUInteger)supportedInterfaceOrientations
|
- (NSUInteger)supportedInterfaceOrientations
|
||||||
{
|
{
|
||||||
// As documented by Apple in the iOS 6.0 release notes, setStatusBarOrientation:animated:
|
// 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.
|
// supportedInterfaceOrientations says, which states that the method should not return 0.
|
||||||
return [self shouldAutorotate] ? UIInterfaceOrientationMaskAll : 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
|
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration
|
||||||
{
|
{
|
||||||
@ -454,30 +425,16 @@
|
|||||||
if (focusWindow->flags() & Qt::MaximizeUsingFullscreenGeometryHint)
|
if (focusWindow->flags() & Qt::MaximizeUsingFullscreenGeometryHint)
|
||||||
self.preferredStatusBarStyle = UIStatusBarStyleDefault;
|
self.preferredStatusBarStyle = UIStatusBarStyleDefault;
|
||||||
else
|
else
|
||||||
self.preferredStatusBarStyle = QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0 ?
|
self.preferredStatusBarStyle = UIStatusBarStyleLightContent;
|
||||||
UIStatusBarStyleLightContent : UIStatusBarStyleBlackTranslucent;
|
|
||||||
|
|
||||||
if (self.preferredStatusBarStyle != oldStatusBarStyle) {
|
if (self.preferredStatusBarStyle != oldStatusBarStyle)
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0)
|
[self setNeedsStatusBarAppearanceUpdate];
|
||||||
[self setNeedsStatusBarAppearanceUpdate];
|
|
||||||
else
|
|
||||||
[uiApplication setStatusBarStyle:self.preferredStatusBarStyle];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool currentStatusBarVisibility = self.prefersStatusBarHidden;
|
bool currentStatusBarVisibility = self.prefersStatusBarHidden;
|
||||||
self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen;
|
self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen;
|
||||||
|
|
||||||
if (self.prefersStatusBarHidden != currentStatusBarVisibility) {
|
if (self.prefersStatusBarHidden != currentStatusBarVisibility) {
|
||||||
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
|
[self setNeedsStatusBarAppearanceUpdate];
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) {
|
|
||||||
[self setNeedsStatusBarAppearanceUpdate];
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
[uiApplication setStatusBarHidden:self.prefersStatusBarHidden
|
|
||||||
withAnimation:self.preferredStatusBarUpdateAnimation];
|
|
||||||
}
|
|
||||||
|
|
||||||
[self.view setNeedsLayout];
|
[self.view setNeedsLayout];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1400,7 +1400,7 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem
|
|||||||
bdi->adornment = kThemeAdornmentFocus;
|
bdi->adornment = kThemeAdornmentFocus;
|
||||||
if (combo->activeSubControls & QStyle::SC_ComboBoxArrow)
|
if (combo->activeSubControls & QStyle::SC_ComboBoxArrow)
|
||||||
bdi->state = kThemeStatePressed;
|
bdi->state = kThemeStatePressed;
|
||||||
else if (tds == kThemeStateInactive && QSysInfo::MacintoshVersion <= QSysInfo::MV_10_9)
|
else if (tds == kThemeStateInactive && QSysInfo::MacintoshVersion < QSysInfo::MV_10_10)
|
||||||
bdi->state = kThemeStateActive;
|
bdi->state = kThemeStateActive;
|
||||||
else
|
else
|
||||||
bdi->state = tds;
|
bdi->state = tds;
|
||||||
@ -1719,7 +1719,7 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti
|
|||||||
|| slider->tickPosition == QSlider::TicksBothSides;
|
|| slider->tickPosition == QSlider::TicksBothSides;
|
||||||
|
|
||||||
tdi->bounds = qt_hirectForQRect(slider->rect);
|
tdi->bounds = qt_hirectForQRect(slider->rect);
|
||||||
if (isScrollbar || QSysInfo::MacintoshVersion <= QSysInfo::MV_10_9) {
|
if (isScrollbar || QSysInfo::MacintoshVersion < QSysInfo::MV_10_10) {
|
||||||
tdi->min = slider->minimum;
|
tdi->min = slider->minimum;
|
||||||
tdi->max = slider->maximum;
|
tdi->max = slider->maximum;
|
||||||
tdi->value = slider->sliderPosition;
|
tdi->value = slider->sliderPosition;
|
||||||
@ -4020,7 +4020,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
|
|||||||
bool hasIcon = !btn.icon.isNull();
|
bool hasIcon = !btn.icon.isNull();
|
||||||
bool hasText = !btn.text.isEmpty();
|
bool hasText = !btn.text.isEmpty();
|
||||||
|
|
||||||
if (!hasMenu && QSysInfo::QSysInfo::MacintoshVersion > QSysInfo::MV_10_9) {
|
if (!hasMenu && QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_10) {
|
||||||
if (tds == kThemeStatePressed
|
if (tds == kThemeStatePressed
|
||||||
|| (tds == kThemeStateActive
|
|| (tds == kThemeStateActive
|
||||||
&& ((btn.features & QStyleOptionButton::DefaultButton && !d->autoDefaultButton)
|
&& ((btn.features & QStyleOptionButton::DefaultButton && !d->autoDefaultButton)
|
||||||
@ -4125,8 +4125,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
|
|||||||
QStyleOptionComboBox comboCopy = *cb;
|
QStyleOptionComboBox comboCopy = *cb;
|
||||||
comboCopy.direction = Qt::LeftToRight;
|
comboCopy.direction = Qt::LeftToRight;
|
||||||
if (opt->state & QStyle::State_Small)
|
if (opt->state & QStyle::State_Small)
|
||||||
comboCopy.rect.translate(0, w ? (QSysInfo::macVersion() > QSysInfo::MV_10_8 ? 0 : -1) :
|
comboCopy.rect.translate(0, w ? 0 : (QSysInfo::macVersion() >= QSysInfo::MV_10_10 ? 0 : -2)); // Supports Qt Quick Controls
|
||||||
(QSysInfo::macVersion() > QSysInfo::MV_10_9 ? 0 : -2)); // Supports Qt Quick Controls
|
|
||||||
else if (QSysInfo::macVersion() == QSysInfo::MV_10_9)
|
else if (QSysInfo::macVersion() == QSysInfo::MV_10_9)
|
||||||
comboCopy.rect.translate(0, 1);
|
comboCopy.rect.translate(0, 1);
|
||||||
QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w);
|
QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w);
|
||||||
@ -5465,7 +5464,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
|
|||||||
opacity = anim->currentValue();
|
opacity = anim->currentValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldExpand = (opt->activeSubControls || wasActive) && QSysInfo::macVersion() >= QSysInfo::MV_10_8;
|
shouldExpand = (opt->activeSubControls || wasActive);
|
||||||
if (shouldExpand) {
|
if (shouldExpand) {
|
||||||
if (!anim && !oldActiveControls) {
|
if (!anim && !oldActiveControls) {
|
||||||
// Start expand animation only once and when entering
|
// Start expand animation only once and when entering
|
||||||
@ -5964,7 +5963,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
|
|||||||
drawToolbarButtonArrow(tb->rect, tds, cg);
|
drawToolbarButtonArrow(tb->rect, tds, cg);
|
||||||
}
|
}
|
||||||
if (tb->state & State_On) {
|
if (tb->state & State_On) {
|
||||||
if (QSysInfo::MacintoshVersion > QSysInfo::MV_MAVERICKS) {
|
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_10) {
|
||||||
QWindow *window = 0;
|
QWindow *window = 0;
|
||||||
if (widget && widget->window())
|
if (widget && widget->window())
|
||||||
window = widget->window()->windowHandle();
|
window = widget->window()->windowHandle();
|
||||||
@ -6326,7 +6325,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
|
|||||||
switch (sc) {
|
switch (sc) {
|
||||||
case SC_ComboBoxEditField:{
|
case SC_ComboBoxEditField:{
|
||||||
ret = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi);
|
ret = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi);
|
||||||
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_9)
|
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_10)
|
||||||
ret.setHeight(ret.height() - 1);
|
ret.setHeight(ret.height() - 1);
|
||||||
break; }
|
break; }
|
||||||
case SC_ComboBoxArrow:{
|
case SC_ComboBoxArrow:{
|
||||||
|
@ -493,9 +493,6 @@ void QAbstractScrollAreaPrivate::layoutChildren()
|
|||||||
horizontalScrollBarRect.adjust(vsbExt, 0, 0, 0);
|
horizontalScrollBarRect.adjust(vsbExt, 0, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
if (!hasCornerWidget && htransient)
|
if (!hasCornerWidget && htransient)
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
if (QSysInfo::macVersion() >= QSysInfo::MV_10_8)
|
|
||||||
#endif
|
|
||||||
horizontalScrollBarRect.adjust(0, 0, cornerOffset.x(), 0);
|
horizontalScrollBarRect.adjust(0, 0, cornerOffset.x(), 0);
|
||||||
scrollBarContainers[Qt::Horizontal]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, horizontalScrollBarRect));
|
scrollBarContainers[Qt::Horizontal]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, horizontalScrollBarRect));
|
||||||
scrollBarContainers[Qt::Horizontal]->raise();
|
scrollBarContainers[Qt::Horizontal]->raise();
|
||||||
@ -504,9 +501,6 @@ void QAbstractScrollAreaPrivate::layoutChildren()
|
|||||||
if (needv) {
|
if (needv) {
|
||||||
QRect verticalScrollBarRect (QPoint(cornerPoint.x(), controlsRect.top() + hHeaderBottom), QPoint(controlsRect.right(), cornerPoint.y() - 1));
|
QRect verticalScrollBarRect (QPoint(cornerPoint.x(), controlsRect.top() + hHeaderBottom), QPoint(controlsRect.right(), cornerPoint.y() - 1));
|
||||||
if (!hasCornerWidget && vtransient)
|
if (!hasCornerWidget && vtransient)
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
if (QSysInfo::macVersion() >= QSysInfo::MV_10_8)
|
|
||||||
#endif
|
|
||||||
verticalScrollBarRect.adjust(0, 0, 0, cornerOffset.y());
|
verticalScrollBarRect.adjust(0, 0, 0, cornerOffset.y());
|
||||||
scrollBarContainers[Qt::Vertical]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, verticalScrollBarRect));
|
scrollBarContainers[Qt::Vertical]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, verticalScrollBarRect));
|
||||||
scrollBarContainers[Qt::Vertical]->raise();
|
scrollBarContainers[Qt::Vertical]->raise();
|
||||||
|
@ -749,9 +749,6 @@ bool QStatusBar::event(QEvent *e)
|
|||||||
#ifndef Q_DEAD_CODE_FROM_QT4_MAC
|
#ifndef Q_DEAD_CODE_FROM_QT4_MAC
|
||||||
return QWidget::event(e);
|
return QWidget::event(e);
|
||||||
#else
|
#else
|
||||||
if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4)
|
|
||||||
return QWidget::event(e);
|
|
||||||
|
|
||||||
// Enable drag-click only if the status bar is the status bar for a
|
// Enable drag-click only if the status bar is the status bar for a
|
||||||
// QMainWindow with a unifed toolbar.
|
// QMainWindow with a unifed toolbar.
|
||||||
if (parent() == 0 || qobject_cast<QMainWindow *>(parent()) == 0 ||
|
if (parent() == 0 || qobject_cast<QMainWindow *>(parent()) == 0 ||
|
||||||
|
@ -987,15 +987,7 @@ void tst_QDir::canonicalPath_data()
|
|||||||
QTest::newRow("nonexistant") << "testd" << QString();
|
QTest::newRow("nonexistant") << "testd" << QString();
|
||||||
|
|
||||||
QTest::newRow("rootPath") << QDir::rootPath() << QDir::rootPath();
|
QTest::newRow("rootPath") << QDir::rootPath() << QDir::rootPath();
|
||||||
|
QTest::newRow("rootPath + ./") << QDir::rootPath().append("./") << QDir::rootPath();
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
// On Mac OS X 10.5 and earlier, canonicalPath depends on cleanPath which
|
|
||||||
// is itself very broken and fundamentally wrong on "/./" which, this would
|
|
||||||
// exercise
|
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6)
|
|
||||||
#endif
|
|
||||||
QTest::newRow("rootPath + ./") << QDir::rootPath().append("./") << QDir::rootPath();
|
|
||||||
|
|
||||||
QTest::newRow("rootPath + ../.. ") << QDir::rootPath().append("../..") << QDir::rootPath();
|
QTest::newRow("rootPath + ../.. ") << QDir::rootPath().append("../..") << QDir::rootPath();
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
QTest::newRow("drive:\\") << QDir::toNativeSeparators(QDir::rootPath()) << QDir::rootPath();
|
QTest::newRow("drive:\\") << QDir::toNativeSeparators(QDir::rootPath()) << QDir::rootPath();
|
||||||
@ -1994,13 +1986,7 @@ void tst_QDir::isRoot_data()
|
|||||||
QTest::newRow(QString("./ appended " + test).toLatin1()) << test << false;
|
QTest::newRow(QString("./ appended " + test).toLatin1()) << test << false;
|
||||||
|
|
||||||
test = QDir(QDir::rootPath().append("./")).canonicalPath();
|
test = QDir(QDir::rootPath().append("./")).canonicalPath();
|
||||||
#ifdef Q_OS_MAC
|
QTest::newRow(QString("canonicalPath " + test).toLatin1()) << test << true;
|
||||||
// On Mac OS X 10.5 and earlier, canonicalPath depends on cleanPath which
|
|
||||||
// is itself very broken and fundamentally wrong on "/./", which this would
|
|
||||||
// exercise
|
|
||||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6)
|
|
||||||
#endif
|
|
||||||
QTest::newRow(QString("canonicalPath " + test).toLatin1()) << test << true;
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
test = QDir::rootPath().left(2);
|
test = QDir::rootPath().left(2);
|
||||||
|
@ -2856,27 +2856,19 @@ void tst_QSettings::isWritable()
|
|||||||
|
|
||||||
if (s1.contains("foo")) {
|
if (s1.contains("foo")) {
|
||||||
#if defined(Q_OS_MACX)
|
#if defined(Q_OS_MACX)
|
||||||
if (QSysInfo::macVersion() >= QSysInfo::MV_10_9) {
|
QVERIFY(s1.isWritable());
|
||||||
QVERIFY(s1.isWritable());
|
if (format == QSettings::NativeFormat) {
|
||||||
if (format == QSettings::NativeFormat) {
|
|
||||||
QVERIFY(!s2.isWritable());
|
|
||||||
QVERIFY(!s3.isWritable());
|
|
||||||
} else {
|
|
||||||
QVERIFY(s2.isWritable());
|
|
||||||
QVERIFY(s3.isWritable());
|
|
||||||
}
|
|
||||||
} else if (QSysInfo::macVersion() >= QSysInfo::MV_10_7 &&
|
|
||||||
format == QSettings::NativeFormat) {
|
|
||||||
QVERIFY(!s1.isWritable());
|
|
||||||
QVERIFY(!s2.isWritable());
|
QVERIFY(!s2.isWritable());
|
||||||
QVERIFY(!s3.isWritable());
|
QVERIFY(!s3.isWritable());
|
||||||
} else
|
} else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
QVERIFY(s1.isWritable());
|
|
||||||
QVERIFY(s2.isWritable());
|
QVERIFY(s2.isWritable());
|
||||||
QVERIFY(s3.isWritable());
|
QVERIFY(s3.isWritable());
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
QVERIFY(s1.isWritable());
|
||||||
|
QVERIFY(s2.isWritable());
|
||||||
|
QVERIFY(s3.isWritable());
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
QVERIFY(!s1.isWritable());
|
QVERIFY(!s1.isWritable());
|
||||||
QVERIFY(!s2.isWritable());
|
QVERIFY(!s2.isWritable());
|
||||||
|
@ -223,10 +223,6 @@ void tst_QLibrary::unload_data()
|
|||||||
QString appDir = QCoreApplication::applicationDirPath();
|
QString appDir = QCoreApplication::applicationDirPath();
|
||||||
|
|
||||||
QTest::newRow( "mylib" ) << appDir + "/mylib" << true;
|
QTest::newRow( "mylib" ) << appDir + "/mylib" << true;
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_3)
|
|
||||||
QEXPECT_FAIL("mylib", "dlcompat cannot unload libraries", Continue);
|
|
||||||
#endif
|
|
||||||
QTest::newRow( "ok01" ) << appDir + "/nolib" << false;
|
QTest::newRow( "ok01" ) << appDir + "/nolib" << false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7895,10 +7895,6 @@ void tst_QNetworkReply::backgroundRequestInterruption()
|
|||||||
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), original);
|
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), original);
|
||||||
|
|
||||||
QVERIFY(reply->isFinished());
|
QVERIFY(reply->isFinished());
|
||||||
#ifdef Q_OS_OSX
|
|
||||||
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8)
|
|
||||||
QEXPECT_FAIL("ftp, bg, nobg", "See QTBUG-32435", Abort);
|
|
||||||
#endif
|
|
||||||
QCOMPARE(reply->error(), error);
|
QCOMPARE(reply->error(), error);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -5086,10 +5086,6 @@ public:
|
|||||||
|
|
||||||
void tst_QGraphicsItem::paint()
|
void tst_QGraphicsItem::paint()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_MACX
|
|
||||||
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_7)
|
|
||||||
QSKIP("QTBUG-31454 - Unstable auto-test");
|
|
||||||
#endif
|
|
||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
|
|
||||||
PaintTester paintTester;
|
PaintTester paintTester;
|
||||||
@ -6574,12 +6570,6 @@ public:
|
|||||||
|
|
||||||
void tst_QGraphicsItem::ensureUpdateOnTextItem()
|
void tst_QGraphicsItem::ensureUpdateOnTextItem()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_7) {
|
|
||||||
QSKIP("This test is unstable on 10.7 in CI");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
QGraphicsView view(&scene);
|
QGraphicsView view(&scene);
|
||||||
view.show();
|
view.show();
|
||||||
|
@ -1209,7 +1209,7 @@ void tst_QMenuBar::task256322_highlight()
|
|||||||
QTRY_VERIFY(!menu2.isVisible());
|
QTRY_VERIFY(!menu2.isVisible());
|
||||||
QVERIFY(!menu.isVisible());
|
QVERIFY(!menu.isVisible());
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
if ((QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) && (win.menuBar()->activeAction() != nothing))
|
if (win.menuBar()->activeAction() != nothing)
|
||||||
QEXPECT_FAIL("", "QTBUG-30565: Unstable test", Continue);
|
QEXPECT_FAIL("", "QTBUG-30565: Unstable test", Continue);
|
||||||
#endif
|
#endif
|
||||||
QTRY_COMPARE(win.menuBar()->activeAction(), nothing);
|
QTRY_COMPARE(win.menuBar()->activeAction(), nothing);
|
||||||
|
@ -80,6 +80,7 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
|
|||||||
CASE_VERSION(MV_10_8);
|
CASE_VERSION(MV_10_8);
|
||||||
CASE_VERSION(MV_10_9);
|
CASE_VERSION(MV_10_9);
|
||||||
CASE_VERSION(MV_10_10);
|
CASE_VERSION(MV_10_10);
|
||||||
|
CASE_VERSION(MV_10_11);
|
||||||
|
|
||||||
CASE_VERSION(MV_IOS_4_3);
|
CASE_VERSION(MV_IOS_4_3);
|
||||||
CASE_VERSION(MV_IOS_5_0);
|
CASE_VERSION(MV_IOS_5_0);
|
||||||
@ -89,6 +90,11 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
|
|||||||
CASE_VERSION(MV_IOS_7_0);
|
CASE_VERSION(MV_IOS_7_0);
|
||||||
CASE_VERSION(MV_IOS_7_1);
|
CASE_VERSION(MV_IOS_7_1);
|
||||||
CASE_VERSION(MV_IOS_8_0);
|
CASE_VERSION(MV_IOS_8_0);
|
||||||
|
CASE_VERSION(MV_IOS_8_1);
|
||||||
|
CASE_VERSION(MV_IOS_8_2);
|
||||||
|
CASE_VERSION(MV_IOS_8_3);
|
||||||
|
CASE_VERSION(MV_IOS_8_4);
|
||||||
|
CASE_VERSION(MV_IOS_9_0);
|
||||||
case QSysInfo::MV_IOS: // shouldn't happen:
|
case QSysInfo::MV_IOS: // shouldn't happen:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user