Apple: Fix a few deprecation warnings after bumping deployment targets
- kIOMasterPortDefault -> kIOMainPortDefault - Use UTType instead of Carbon Core functions/constants - NSWorkspace iconForFileType -> iconForContentType - Removed obsoleted kUTTypeInkText pasteboard type There are still a few more, but these will be fixed in follow ups. Change-Id: Ibbca226d578b4ba64bd9c8c5d0addc1870114a20 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>bb10
parent
d311af4963
commit
2a2a301557
|
|
@ -674,6 +674,12 @@ qt_internal_extend_target(Core CONDITION UNIX
|
|||
kernel/qtimerinfo_unix.cpp kernel/qtimerinfo_unix_p.h
|
||||
thread/qthread_unix.cpp
|
||||
)
|
||||
if(APPLE)
|
||||
set_source_files_properties(io/qfilesystemengine_unix.cpp PROPERTIES LANGUAGE OBJCXX)
|
||||
qt_internal_extend_target(Core CONDITION
|
||||
PUBLIC_LIBRARIES ${FWUniformTypeIdentifiers}
|
||||
)
|
||||
endif()
|
||||
|
||||
qt_internal_extend_target(Core CONDITION UNIX AND NOT WASM
|
||||
SOURCES
|
||||
|
|
|
|||
|
|
@ -992,8 +992,7 @@ QByteArray QSysInfo::machineUniqueId()
|
|||
{
|
||||
#if defined(Q_OS_DARWIN) && __has_include(<IOKit/IOKitLib.h>)
|
||||
char uuid[UuidStringLen + 1];
|
||||
static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault
|
||||
io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice"));
|
||||
io_service_t service = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
|
||||
QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
|
||||
CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman);
|
||||
return QByteArray(uuid);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@
|
|||
#if defined(Q_OS_DARWIN)
|
||||
# include <QtCore/private/qcore_mac_p.h>
|
||||
# include <CoreFoundation/CFBundle.h>
|
||||
# include <UniformTypeIdentifiers/UTType.h>
|
||||
# include <UniformTypeIdentifiers/UTCoreTypes.h>
|
||||
# include <Foundation/Foundation.h>
|
||||
# include <sys/clonefile.h>
|
||||
# include <copyfile.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
|
|
@ -49,15 +54,6 @@
|
|||
#include <MobileCoreServices/MobileCoreServices.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
# include <sys/clonefile.h>
|
||||
# include <copyfile.h>
|
||||
// We cannot include <Foundation/Foundation.h> (it's an Objective-C header), but
|
||||
// we need these declarations:
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
|
||||
extern "C" NSString *NSTemporaryDirectory();
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
# include <sys/ioctl.h>
|
||||
# include <sys/sendfile.h>
|
||||
|
|
@ -127,10 +123,9 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e
|
|||
QString suffix = info.suffix();
|
||||
|
||||
if (suffix.length() > 0) {
|
||||
// First step: is the extension known ?
|
||||
QCFType<CFStringRef> extensionRef = suffix.toCFString();
|
||||
QCFType<CFStringRef> uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL);
|
||||
if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle))
|
||||
// First step: is it a bundle?
|
||||
const auto *utType = [UTType typeWithFilenameExtension:suffix.toNSString()];
|
||||
if ([utType conformsToType:UTTypeBundle])
|
||||
return true;
|
||||
|
||||
// Second step: check if an application knows the package type
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ std::optional<uint32_t> qt_mac_sipConfiguration()
|
|||
return config;
|
||||
#endif
|
||||
|
||||
QIOType<io_registry_entry_t> nvram = IORegistryEntryFromPath(kIOMasterPortDefault, "IODeviceTree:/options");
|
||||
QIOType<io_registry_entry_t> nvram = IORegistryEntryFromPath(kIOMainPortDefault, "IODeviceTree:/options");
|
||||
if (!nvram) {
|
||||
qWarning("Failed to locate NVRAM entry in IO registry");
|
||||
return {};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <ImageIO/ImageIO.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <UniformTypeIdentifiers/UTCoreTypes.h>
|
||||
|
||||
#include <QtCore/qsystemdetection.h>
|
||||
#include <QtCore/qurl.h>
|
||||
|
|
@ -779,7 +780,7 @@ QList<QByteArray> QMacMimeTiff::convertFromMime(const QString &mime,
|
|||
|
||||
QCFType<CFMutableDataRef> data = CFDataCreateMutable(0, 0);
|
||||
QCFType<CGImageDestinationRef> imageDestination = CGImageDestinationCreateWithData(data,
|
||||
kUTTypeTIFF, 1, 0);
|
||||
(CFStringRef)UTTypeTIFF.identifier, 1, 0);
|
||||
|
||||
if (!imageDestination)
|
||||
return QList<QByteArray>();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#include <UniformTypeIdentifiers/UTCoreTypes.h>
|
||||
|
||||
#include "qcocoadrag.h"
|
||||
#include "qmacclipboard.h"
|
||||
|
|
@ -161,8 +162,7 @@ bool QCocoaDrag::maybeDragMultipleItems()
|
|||
for (NSPasteboardItem *item in dragBoard.pasteboardItems) {
|
||||
bool isUrl = false;
|
||||
for (NSPasteboardType type in item.types) {
|
||||
using NSStringRef = NSString *;
|
||||
if ([type isEqualToString:NSStringRef(kUTTypeFileURL)]) {
|
||||
if ([type isEqualToString:UTTypeFileURL.identifier]) {
|
||||
isUrl = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include <QtGui/private/qfontengine_coretext_p.h>
|
||||
|
||||
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||
#include <UniformTypeIdentifiers/UTCoreTypes.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
|
|
@ -437,8 +438,8 @@ void QCocoaIntegration::focusWindowChanged(QWindow *focusWindow)
|
|||
return;
|
||||
|
||||
static bool hasDefaultApplicationIcon = [](){
|
||||
NSImage *genericApplicationIcon = [[NSWorkspace sharedWorkspace]
|
||||
iconForFileType:NSFileTypeForHFSTypeCode(kGenericApplicationIcon)];
|
||||
NSImage *genericApplicationIcon = [NSWorkspace.sharedWorkspace
|
||||
iconForContentType:UTTypeApplicationBundle];
|
||||
NSImage *applicationIcon = [NSImage imageNamed:NSImageNameApplicationIcon];
|
||||
|
||||
NSRect rect = NSMakeRect(0, 0, 32, 32);
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ QCocoaScreen::~QCocoaScreen()
|
|||
static QString displayName(CGDirectDisplayID displayID)
|
||||
{
|
||||
QIOType<io_iterator_t> iterator;
|
||||
if (IOServiceGetMatchingServices(kIOMasterPortDefault,
|
||||
if (IOServiceGetMatchingServices(kIOMainPortDefault,
|
||||
IOServiceMatching("IODisplayConnect"), &iterator))
|
||||
return QString();
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <AppKit/AppKit.h>
|
||||
#include <MetalKit/MetalKit.h>
|
||||
#include <UniformTypeIdentifiers/UTCoreTypes.h>
|
||||
|
||||
#include "qnsview.h"
|
||||
#include "qcocoawindow.h"
|
||||
|
|
@ -411,7 +412,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMenuHelper);
|
|||
|
||||
- (QCocoaWindow*)platformWindow
|
||||
{
|
||||
return m_platformWindow.data();
|
||||
return m_platformWindow.data();;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
NSPasteboardTypeRTF, NSPasteboardTypeTabularText, NSPasteboardTypeFont,
|
||||
NSPasteboardTypeRuler, NSFileContentsPboardType,
|
||||
NSPasteboardTypeRTFD , NSPasteboardTypeHTML,
|
||||
NSPasteboardTypeURL, NSPasteboardTypePDF, (NSString *)kUTTypeVCard,
|
||||
(NSString *)kPasteboardTypeFileURLPromise, (NSString *)kUTTypeInkText,
|
||||
NSPasteboardTypeURL, NSPasteboardTypePDF, UTTypeVCard.identifier,
|
||||
(NSString *)kPasteboardTypeFileURLPromise,
|
||||
NSPasteboardTypeMultipleTextSelection, mimeTypeGeneric]];
|
||||
|
||||
// Add custom types supported by the application
|
||||
|
|
|
|||
|
|
@ -120,6 +120,12 @@ qt_internal_extend_target(Bootstrap CONDITION UNIX
|
|||
../../corelib/io/qfsfileengine_unix.cpp
|
||||
../../corelib/kernel/qcore_unix.cpp
|
||||
)
|
||||
if(APPLE)
|
||||
set_source_files_properties(../../corelib/io/qfilesystemengine_unix.cpp PROPERTIES LANGUAGE OBJCXX)
|
||||
qt_internal_extend_target(Bootstrap CONDITION
|
||||
PUBLIC_LIBRARIES ${FWUniformTypeIdentifiers}
|
||||
)
|
||||
endif()
|
||||
|
||||
qt_internal_extend_target(Bootstrap CONDITION WIN32
|
||||
SOURCES
|
||||
|
|
|
|||
Loading…
Reference in New Issue