summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/.prev_CMakeLists.txt3
-rw-r--r--src/plugins/platforms/cocoa/CMakeLists.txt3
-rw-r--r--src/plugins/platforms/cocoa/cocoa.pro6
-rw-r--r--src/plugins/platforms/cocoa/messages.cpp115
-rw-r--r--src/plugins/platforms/cocoa/messages.h69
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm21
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h5
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.h12
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm61
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoansmenu.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaprintdevice.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaprintdevice.mm8
-rw-r--r--src/plugins/platforms/cocoa/qcocoaprintersupport.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaprintersupport.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoasessionmanager.cpp2
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm2
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.mm16
-rw-r--r--src/plugins/platforms/cocoa/qmacdefines_mac.h129
-rw-r--r--src/plugins/platforms/cocoa/qmultitouch_mac.mm2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h2
-rw-r--r--src/plugins/platforms/cocoa/qnsview_menus.mm10
-rw-r--r--src/plugins/platforms/cocoa/qnswindow.h2
-rw-r--r--src/plugins/platforms/cocoa/qpaintengine_mac.mm3
-rw-r--r--src/plugins/platforms/cocoa/qpaintengine_mac_p.h14
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm8
-rw-r--r--src/plugins/platforms/cocoa/qt_attribution.json2
-rw-r--r--src/plugins/platforms/cocoa/qt_mac_p.h127
41 files changed, 157 insertions, 513 deletions
diff --git a/src/plugins/platforms/cocoa/.prev_CMakeLists.txt b/src/plugins/platforms/cocoa/.prev_CMakeLists.txt
index 1491340b65..4963891fc0 100644
--- a/src/plugins/platforms/cocoa/.prev_CMakeLists.txt
+++ b/src/plugins/platforms/cocoa/.prev_CMakeLists.txt
@@ -9,7 +9,6 @@ qt_add_plugin(QCocoaIntegrationPlugin
TYPE platforms
SOURCES
main.mm
- messages.cpp messages.h
qcocoaapplication.h qcocoaapplication.mm
qcocoaapplicationdelegate.h qcocoaapplicationdelegate.mm
qcocoabackingstore.h qcocoabackingstore.mm
@@ -41,6 +40,8 @@ qt_add_plugin(QCocoaIntegrationPlugin
qnsview.h qnsview.mm
qnswindow.h qnswindow.mm
qnswindowdelegate.h qnswindowdelegate.mm
+ DEFINES
+ QT_NO_FOREACH
PUBLIC_LIBRARIES
${FWAppKit}
${FWCarbon}
diff --git a/src/plugins/platforms/cocoa/CMakeLists.txt b/src/plugins/platforms/cocoa/CMakeLists.txt
index 9e8b162aec..4ed23c4367 100644
--- a/src/plugins/platforms/cocoa/CMakeLists.txt
+++ b/src/plugins/platforms/cocoa/CMakeLists.txt
@@ -13,7 +13,6 @@ qt_add_plugin(QCocoaIntegrationPlugin
TYPE platforms
SOURCES
main.mm
- messages.cpp messages.h
qcocoaapplication.h qcocoaapplication.mm
qcocoaapplicationdelegate.h qcocoaapplicationdelegate.mm
qcocoabackingstore.h qcocoabackingstore.mm
@@ -45,6 +44,8 @@ qt_add_plugin(QCocoaIntegrationPlugin
qnsview.h qnsview.mm
qnswindow.h qnswindow.mm
qnswindowdelegate.h qnswindowdelegate.mm
+ DEFINES
+ QT_NO_FOREACH
PUBLIC_LIBRARIES
${FWAppKit}
${FWCarbon}
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
index 953346c56e..1d1089a634 100644
--- a/src/plugins/platforms/cocoa/cocoa.pro
+++ b/src/plugins/platforms/cocoa/cocoa.pro
@@ -31,8 +31,7 @@ SOURCES += main.mm \
qcocoaintrospection.mm \
qcocoakeymapper.mm \
qcocoamimetypes.mm \
- qiosurfacegraphicsbuffer.mm \
- messages.cpp
+ qiosurfacegraphicsbuffer.mm
HEADERS += qcocoaintegration.h \
qcocoascreen.h \
@@ -63,7 +62,6 @@ HEADERS += qcocoaintegration.h \
qcocoasystemtrayicon.h \
qcocoaintrospection.h \
qcocoakeymapper.h \
- messages.h \
qiosurfacegraphicsbuffer.h \
qcocoamimetypes.h
@@ -94,6 +92,8 @@ RESOURCES += qcocoaresources.qrc
LIBS += -framework AppKit -framework CoreServices -framework Carbon -framework IOKit -framework QuartzCore -framework CoreVideo -framework Metal -framework IOSurface -lcups
+DEFINES += QT_NO_FOREACH
+
QT += \
core-private gui-private \
clipboard_support-private theme_support-private \
diff --git a/src/plugins/platforms/cocoa/messages.cpp b/src/plugins/platforms/cocoa/messages.cpp
deleted file mode 100644
index 06e3dd454e..0000000000
--- a/src/plugins/platforms/cocoa/messages.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "messages.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qregularexpression.h>
-
-// Translatable messages should go into this .cpp file for them to be picked up by lupdate.
-
-QT_BEGIN_NAMESPACE
-
-QString msgAboutQt()
-{
- return QCoreApplication::translate("QCocoaMenuItem", "About Qt");
-}
-
-static const char *application_menu_strings[] =
-{
- QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","About %1"),
- QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Preferences..."),
- QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Services"),
- QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide %1"),
- QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide Others"),
- QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Show All"),
- QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Quit %1")
-};
-
-QString qt_mac_applicationmenu_string(int type)
-{
- QString menuString = QString::fromLatin1(application_menu_strings[type]);
- const QString translated = QCoreApplication::translate("QMenuBar", application_menu_strings[type]);
- if (translated != menuString) {
- return translated;
- } else {
- return QCoreApplication::translate("MAC_APPLICATION_MENU", application_menu_strings[type]);
- }
-}
-
-QPlatformMenuItem::MenuRole detectMenuRole(const QString &caption)
-{
- QString captionNoAmpersand(caption);
- captionNoAmpersand.remove(QLatin1Char('&'));
- const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About");
- if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive)
- || captionNoAmpersand.endsWith(aboutString, Qt::CaseInsensitive)) {
- static const QRegularExpression qtRegExp(QLatin1String("qt$"), QRegularExpression::CaseInsensitiveOption);
- if (captionNoAmpersand.contains(qtRegExp))
- return QPlatformMenuItem::AboutQtRole;
- return QPlatformMenuItem::AboutRole;
- }
- if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive)
- || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive)
- || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive)
- || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive)
- || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) {
- return QPlatformMenuItem::PreferencesRole;
- }
- if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Quit"), Qt::CaseInsensitive)
- || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Exit"), Qt::CaseInsensitive)) {
- return QPlatformMenuItem::QuitRole;
- }
- if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Cut"), Qt::CaseInsensitive))
- return QPlatformMenuItem::CutRole;
- if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Copy"), Qt::CaseInsensitive))
- return QPlatformMenuItem::CopyRole;
- if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Paste"), Qt::CaseInsensitive))
- return QPlatformMenuItem::PasteRole;
- if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Select All"), Qt::CaseInsensitive))
- return QPlatformMenuItem::SelectAllRole;
- return QPlatformMenuItem::NoRole;
-}
-
-QString msgDialogButtonDiscard()
-{
- return QCoreApplication::translate("QCocoaTheme", "Don't Save");
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/messages.h b/src/plugins/platforms/cocoa/messages.h
deleted file mode 100644
index 3a9eaf604e..0000000000
--- a/src/plugins/platforms/cocoa/messages.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MESSAGES_H
-#define MESSAGES_H
-
-#include <QString>
-#include <qpa/qplatformmenu.h>
-
-QT_BEGIN_NAMESPACE
-
-enum {
- AboutAppMenuItem = 0,
- PreferencesAppMenuItem,
- ServicesAppMenuItem,
- HideAppMenuItem,
- HideOthersAppMenuItem,
- ShowAllAppMenuItem,
- QuitAppMenuItem
-};
-
-
-QString msgAboutQt();
-
-QString qt_mac_applicationmenu_string(int type);
-
-QPlatformMenuItem::MenuRole detectMenuRole(const QString &caption);
-
-QString msgDialogButtonDiscard();
-
-QT_END_NAMESPACE
-
-#endif // MESSAGES_H
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
index 141ce6bf1a..f74afb8440 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
@@ -41,7 +41,7 @@
#include <QtCore/qglobal.h>
-#include "qt_mac_p.h"
+#include <QtCore/private/qcore_mac_p.h>
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 3560c9d9b5..ad40c6b0cb 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -41,7 +41,8 @@
#include "qcocoahelpers.h"
#include "qcocoawindow.h"
#include "qcocoascreen.h"
-#include "private/qaccessiblecache_p.h"
+
+#include <QtGui/private/qaccessiblecache_p.h>
#include <QtAccessibilitySupport/private/qaccessiblebridgeutils_p.h>
#include <QtGui/qaccessible.h>
@@ -547,7 +548,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
return nsActions;
const QStringList &supportedActionNames = QAccessibleBridgeUtils::effectiveActionNames(iface);
- foreach (const QString &qtAction, supportedActionNames) {
+ for (const QString &qtAction : supportedActionNames) {
NSString *nsAction = QCocoaAccessible::getTranslatedAction(qtAction);
if (nsAction)
[nsActions addObject : nsAction];
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.h b/src/plugins/platforms/cocoa/qcocoaapplication.h
index 15530d8281..4314a01ca1 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplication.h
+++ b/src/plugins/platforms/cocoa/qcocoaapplication.h
@@ -83,8 +83,8 @@
// We mean it.
//
-#include "qglobal.h"
-#include "private/qcore_mac_p.h"
+#include <qglobal.h>
+#include <QtCore/private/qcore_mac_p.h>
#import <AppKit/AppKit.h>
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 3fb9e83d35..e8d789275c 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -87,7 +87,6 @@
#include <qurl.h>
#include <qdebug.h>
#include <qguiapplication.h>
-#include "qt_mac_p.h"
#include <qpa/qwindowsysteminterface.h>
#include <qwindowdefs.h>
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 102f00a25d..c734be09b6 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -43,6 +43,7 @@
#include "qcocoahelpers.h"
#include <QtCore/qmath.h>
+#include <QtGui/qpainter.h>
#include <QuartzCore/CATransaction.h>
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index 94b9e62eab..338a5516d9 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -73,18 +73,21 @@
#include "qcocoaeventdispatcher.h"
#include "qcocoawindow.h"
-
#include "qcocoahelpers.h"
-#include "qguiapplication.h"
-#include "qevent.h"
-#include "qmutex.h"
-#include "qsocketnotifier.h"
+
+#include <QtGui/qevent.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/private/qguiapplication_p.h>
+
+#include <QtCore/qmutex.h>
+#include <QtCore/qscopeguard.h>
+#include <QtCore/qsocketnotifier.h>
+#include <QtCore/private/qthread_p.h>
+
#include <qpa/qplatformwindow.h>
#include <qpa/qplatformnativeinterface.h>
-#include "private/qthread_p.h"
-#include "private/qguiapplication_p.h"
-#include <qdebug.h>
-#include <qscopeguard.h>
+
+#include <QtCore/qdebug.h>
#include <AppKit/AppKit.h>
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index 8b76e45616..15e83db48f 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -48,7 +48,6 @@
#include <qguiapplication.h>
#include <private/qguiapplication_p.h>
-#include "qt_mac_p.h"
#include "qcocoahelpers.h"
#include "qcocoaeventdispatcher.h"
#include <qbuffer.h>
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index 1a718975d1..d0e105987a 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -50,9 +50,12 @@
//
// We mean it.
//
-#include "qt_mac_p.h"
+
+#include <AppKit/AppKit.h>
+
#include <private/qguiapplication_p.h>
#include <QtCore/qoperatingsystemversion.h>
+#include <QtCore/qloggingcategory.h>
#include <QtGui/qpalette.h>
#include <QtGui/qscreen.h>
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 1fb250317d..f273fa9d75 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -120,7 +120,7 @@ class QFontEngineFT;
static QCocoaIntegration::Options parseOptions(const QStringList &paramList)
{
QCocoaIntegration::Options options;
- foreach (const QString &param, paramList) {
+ for (const QString &param : paramList) {
#ifndef QT_NO_FREETYPE
if (param == QLatin1String("fontengine=freetype"))
options |= QCocoaIntegration::UseFreeTypeFontEngine;
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm
index 363defdd28..a2a8535547 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm
@@ -191,7 +191,7 @@ void QCocoaMenuBar::syncMenu_helper(QPlatformMenu *menu, bool menubarUpdate)
QMacAutoReleasePool pool;
QCocoaMenu *cocoaMenu = static_cast<QCocoaMenu *>(menu);
- Q_FOREACH (QCocoaMenuItem *item, cocoaMenu->items())
+ for (QCocoaMenuItem *item : cocoaMenu->items())
cocoaMenu->syncMenuItem_helper(item, menubarUpdate);
BOOL shouldHide = YES;
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.h b/src/plugins/platforms/cocoa/qcocoamenuitem.h
index c842b08d52..029d29be9d 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.h
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.h
@@ -53,6 +53,18 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
QT_BEGIN_NAMESPACE
+enum {
+ AboutAppMenuItem = 0,
+ PreferencesAppMenuItem,
+ ServicesAppMenuItem,
+ HideAppMenuItem,
+ HideOthersAppMenuItem,
+ ShowAllAppMenuItem,
+ QuitAppMenuItem
+};
+
+QString qt_mac_applicationmenu_string(int type);
+
class QCocoaMenu;
class QCocoaMenuObject
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index cba2babb8d..c117ce6a84 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -45,17 +45,38 @@
#include "qcocoansmenu.h"
#include "qcocoamenu.h"
#include "qcocoamenubar.h"
-#include "messages.h"
#include "qcocoahelpers.h"
-#include "qt_mac_p.h"
#include "qcocoaapplication.h" // for custom application category
#include "qcocoamenuloader.h"
#include <QtGui/private/qcoregraphics_p.h>
+#include <QtCore/qregularexpression.h>
#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
+static const char *application_menu_strings[] =
+{
+ QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","About %1"),
+ QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Preferences..."),
+ QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Services"),
+ QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide %1"),
+ QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide Others"),
+ QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Show All"),
+ QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Quit %1")
+};
+
+QString qt_mac_applicationmenu_string(int type)
+{
+ QString menuString = QString::fromLatin1(application_menu_strings[type]);
+ const QString translated = QCoreApplication::translate("QMenuBar", application_menu_strings[type]);
+ if (translated != menuString) {
+ return translated;
+ } else {
+ return QCoreApplication::translate("MAC_APPLICATION_MENU", application_menu_strings[type]);
+ }
+}
+
static quint32 constructModifierMask(quint32 accel_key)
{
quint32 ret = 0;
@@ -225,6 +246,40 @@ void QCocoaMenuItem::setNativeContents(WId item)
m_itemView.needsDisplay = YES;
}
+static QPlatformMenuItem::MenuRole detectMenuRole(const QString &caption)
+{
+ QString captionNoAmpersand(caption);
+ captionNoAmpersand.remove(QLatin1Char('&'));
+ const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About");
+ if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive)
+ || captionNoAmpersand.endsWith(aboutString, Qt::CaseInsensitive)) {
+ static const QRegularExpression qtRegExp(QLatin1String("qt$"), QRegularExpression::CaseInsensitiveOption);
+ if (captionNoAmpersand.contains(qtRegExp))
+ return QPlatformMenuItem::AboutQtRole;
+ return QPlatformMenuItem::AboutRole;
+ }
+ if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive)
+ || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive)
+ || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive)
+ || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive)
+ || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) {
+ return QPlatformMenuItem::PreferencesRole;
+ }
+ if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Quit"), Qt::CaseInsensitive)
+ || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Exit"), Qt::CaseInsensitive)) {
+ return QPlatformMenuItem::QuitRole;
+ }
+ if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Cut"), Qt::CaseInsensitive))
+ return QPlatformMenuItem::CutRole;
+ if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Copy"), Qt::CaseInsensitive))
+ return QPlatformMenuItem::CopyRole;
+ if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Paste"), Qt::CaseInsensitive))
+ return QPlatformMenuItem::PasteRole;
+ if (!captionNoAmpersand.compare(QCoreApplication::translate("QCocoaMenuItem", "Select All"), Qt::CaseInsensitive))
+ return QPlatformMenuItem::SelectAllRole;
+ return QPlatformMenuItem::NoRole;
+}
+
NSMenuItem *QCocoaMenuItem::sync()
{
if (m_isSeparator != m_native.separatorItem) {
@@ -353,7 +408,7 @@ QString QCocoaMenuItem::mergeText()
return qt_mac_applicationmenu_string(AboutAppMenuItem).arg(qt_mac_applicationName());
} else if (m_native== [loader aboutQtMenuItem]) {
if (m_text == QString("About Qt"))
- return msgAboutQt();
+ return QCoreApplication::translate("QCocoaMenuItem", "About Qt");
else
return m_text;
} else if (m_native == [loader preferencesMenuItem]) {
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
index d384078e91..a7c17fc177 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
@@ -39,7 +39,6 @@
#include "qcocoamenuloader.h"
-#include "messages.h"
#include "qcocoahelpers.h"
#include "qcocoansmenu.h"
#include "qcocoamenubar.h"
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index 450329f569..90e124b790 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -50,13 +50,13 @@
#include <qwindow.h>
#include <qpixmap.h>
#include <qpa/qplatformwindow.h>
-#include "qsurfaceformat.h"
+#include <QtGui/qsurfaceformat.h>
#ifndef QT_NO_OPENGL
#include <qpa/qplatformopenglcontext.h>
-#include "qopenglcontext.h"
+#include <QtGui/qopenglcontext.h>
#include "qcocoaglcontext.h"
#endif
-#include "qguiapplication.h"
+#include <QtGui/qguiapplication.h>
#include <qdebug.h>
#if !defined(QT_NO_WIDGETS) && defined(QT_PRINTSUPPORT_LIB)
diff --git a/src/plugins/platforms/cocoa/qcocoansmenu.h b/src/plugins/platforms/cocoa/qcocoansmenu.h
index 0c77e2f1aa..bd0334e061 100644
--- a/src/plugins/platforms/cocoa/qcocoansmenu.h
+++ b/src/plugins/platforms/cocoa/qcocoansmenu.h
@@ -53,7 +53,7 @@
#import <AppKit/AppKit.h>
-#include <qcocoahelpers.h>
+#include "qcocoahelpers.h"
QT_FORWARD_DECLARE_CLASS(QCocoaMenu);
QT_FORWARD_DECLARE_CLASS(QCocoaMenuItem);
diff --git a/src/plugins/platforms/cocoa/qcocoaprintdevice.h b/src/plugins/platforms/cocoa/qcocoaprintdevice.h
index d267343b0e..59a521e0b5 100644
--- a/src/plugins/platforms/cocoa/qcocoaprintdevice.h
+++ b/src/plugins/platforms/cocoa/qcocoaprintdevice.h
@@ -55,8 +55,6 @@
#ifndef QT_NO_PRINTER
-#include "qt_mac_p.h"
-
#include <cups/ppd.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaprintdevice.mm b/src/plugins/platforms/cocoa/qcocoaprintdevice.mm
index 7605dc9d1a..ab304d9c04 100644
--- a/src/plugins/platforms/cocoa/qcocoaprintdevice.mm
+++ b/src/plugins/platforms/cocoa/qcocoaprintdevice.mm
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <ApplicationServices/ApplicationServices.h>
+
#include "qcocoaprintdevice.h"
#if QT_CONFIG(mimetype)
@@ -44,6 +46,8 @@
#endif
#include <qdebug.h>
+#include <QtCore/private/qcore_mac_p.h>
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_PRINTER
@@ -117,7 +121,7 @@ QCocoaPrintDevice::~QCocoaPrintDevice()
{
if (m_ppd)
ppdClose(m_ppd);
- foreach (PMPaper paper, m_macPapers)
+ for (PMPaper paper : m_macPapers)
PMRelease(paper);
// Releasing the session appears to also release the printer
if (m_session)
@@ -171,7 +175,7 @@ QPageSize QCocoaPrintDevice::createPageSize(const PMPaper &paper) const
void QCocoaPrintDevice::loadPageSizes() const
{
m_pageSizes.clear();
- foreach (PMPaper paper, m_macPapers)
+ for (PMPaper paper : m_macPapers)
PMRelease(paper);
m_macPapers.clear();
m_printableMargins.clear();
diff --git a/src/plugins/platforms/cocoa/qcocoaprintersupport.h b/src/plugins/platforms/cocoa/qcocoaprintersupport.h
index 40a638207a..b1a9541c03 100644
--- a/src/plugins/platforms/cocoa/qcocoaprintersupport.h
+++ b/src/plugins/platforms/cocoa/qcocoaprintersupport.h
@@ -43,8 +43,6 @@
#include <qpa/qplatformprintersupport.h>
#ifndef QT_NO_PRINTER
-#include "qt_mac_p.h"
-
QT_BEGIN_NAMESPACE
class QCocoaPrinterSupport : public QPlatformPrinterSupport
diff --git a/src/plugins/platforms/cocoa/qcocoaprintersupport.mm b/src/plugins/platforms/cocoa/qcocoaprintersupport.mm
index d7eaa469fb..4c5c7aef88 100644
--- a/src/plugins/platforms/cocoa/qcocoaprintersupport.mm
+++ b/src/plugins/platforms/cocoa/qcocoaprintersupport.mm
@@ -41,6 +41,10 @@
#ifndef QT_NO_PRINTER
+#include <AppKit/AppKit.h>
+
+#include <QtCore/private/qcore_mac_p.h>
+
#include "qcocoaprintdevice.h"
#include "qprintengine_mac_p.h"
diff --git a/src/plugins/platforms/cocoa/qcocoasessionmanager.cpp b/src/plugins/platforms/cocoa/qcocoasessionmanager.cpp
index 74e318b5be..725fc5acc0 100644
--- a/src/plugins/platforms/cocoa/qcocoasessionmanager.cpp
+++ b/src/plugins/platforms/cocoa/qcocoasessionmanager.cpp
@@ -41,7 +41,7 @@
#include <private/qsessionmanager_p.h>
#include <private/qguiapplication_p.h>
-#include <qcocoasessionmanager.h>
+#include "qcocoasessionmanager.h"
#include <qstring.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h
index 7999438ca5..141995d1b1 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h
@@ -46,8 +46,8 @@
#if QT_CONFIG(systemtrayicon)
-#include "QtCore/qstring.h"
-#include "QtGui/qpa/qplatformsystemtrayicon.h"
+#include <QtCore/qstring.h>
+#include <QtGui/qpa/qplatformsystemtrayicon.h>
#include "qcocoamenu.h"
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
index bb1b1fc02e..8c96b2376f 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
@@ -84,7 +84,6 @@
#include "qcocoamenu.h"
-#include "qt_mac_p.h"
#include "qcocoahelpers.h"
#include "qcocoaintegration.h"
#include "qcocoascreen.h"
@@ -162,7 +161,7 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon)
qreal devicePixelRatio = qApp->devicePixelRatio();
const int maxPixmapHeight = maxImageHeight * devicePixelRatio;
QSize selectedSize;
- Q_FOREACH (const QSize& size, sortByHeight(icon.availableSizes())) {
+ for (const QSize& size : sortByHeight(icon.availableSizes())) {
// Select a pixmap based on the height. We want the largest pixmap
// with a height smaller or equal to maxPixmapHeight. The pixmap
// may rectangular; assume it has a reasonable size. If there is
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index a76ba300e9..d73b028afb 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -40,7 +40,6 @@
#import <AppKit/AppKit.h>
#include "qcocoatheme.h"
-#include "messages.h"
#include <QtCore/QOperatingSystemVersion>
#include <QtCore/QVariant>
@@ -547,7 +546,9 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const
QString QCocoaTheme::standardButtonText(int button) const
{
- return button == QPlatformDialogHelper::Discard ? msgDialogButtonDiscard() : QPlatformTheme::standardButtonText(button);
+ return button == QPlatformDialogHelper::Discard ?
+ QCoreApplication::translate("QCocoaTheme", "Don't Save")
+ : QPlatformTheme::standardButtonText(button);
}
QKeySequence QCocoaTheme::standardButtonShortcut(int button) const
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 4bff1de515..4688598da7 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -51,7 +51,6 @@
#endif
#include "qnsview.h"
#include "qnswindow.h"
-#include "qt_mac_p.h"
#if QT_CONFIG(vulkan)
#include <MoltenVK/mvk_vulkan.h>
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 35b0ec2d40..f387c0d093 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1830,7 +1830,7 @@ qreal QCocoaWindow::devicePixelRatio() const
QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint)
{
QWindow *targetWindow = window();
- foreach (QObject *child, targetWindow->children())
+ for (QObject *child : targetWindow->children())
if (QWindow *childWindow = qobject_cast<QWindow *>(child))
if (QPlatformWindow *handle = childWindow->handle())
if (handle->isExposed() && childWindow->geometry().contains(windowPoint))
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm
index c5d823693c..3202c6926e 100644
--- a/src/plugins/platforms/cocoa/qmacclipboard.mm
+++ b/src/plugins/platforms/cocoa/qmacclipboard.mm
@@ -38,14 +38,14 @@
****************************************************************************/
#include "qmacclipboard.h"
-#include "qclipboard.h"
-#include "qguiapplication.h"
-#include "qbitmap.h"
-#include "qdatetime.h"
-#include "qdebug.h"
-#include "qguiapplication.h"
-#include "qevent.h"
-#include "qurl.h"
+#include <QtGui/qclipboard.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qbitmap.h>
+#include <QtCore/qdatetime.h>
+#include <QtCore/qdebug.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qevent.h>
+#include <QtCore/qurl.h>
#include <stdlib.h>
#include <string.h>
#include "qcocoahelpers.h"
diff --git a/src/plugins/platforms/cocoa/qmacdefines_mac.h b/src/plugins/platforms/cocoa/qmacdefines_mac.h
deleted file mode 100644
index 9e229b8dcb..0000000000
--- a/src/plugins/platforms/cocoa/qmacdefines_mac.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Copyright (c) 2007-2008, Apple, Inc.
-**
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-**
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-**
-** * Neither the name of Apple, Inc. nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-****************************************************************************/
-
-/*
- * qmacdefines_mac_p.h
- * All the defines you'll ever need for Qt/Mac :-)
- */
-
-/* This is just many defines. Therefore it doesn't need things like:
-QT_BEGIN_NAMESPACE
-
-
-QT_END_NAMESPACE
-
-Yes, it is an informative comment ;-)
-*/
-
-#include <QtCore/qglobal.h>
-
-#ifdef __LP64__
-typedef signed int OSStatus;
-#else
-typedef signed long OSStatus;
-#endif
-
-typedef struct OpaqueEventHandlerCallRef * EventHandlerCallRef;
-typedef struct OpaqueEventRef * EventRef;
-typedef struct OpaqueMenuRef * MenuRef;
-typedef struct OpaquePasteboardRef* PasteboardRef;
-typedef struct OpaqueRgnHandle * RgnHandle;
-typedef const struct __HIShape *HIShapeRef;
-typedef struct __HIShape *HIMutableShapeRef;
-typedef struct CGRect CGRect;
-typedef struct CGImage *CGImageRef;
-typedef struct CGContext *CGContextRef;
-typedef struct GDevice * GDPtr;
-typedef GDPtr * GDHandle;
-typedef struct OpaqueIconRef * IconRef;
-
-#ifdef __OBJC__
-typedef NSWindow* OSWindowRef;
-typedef NSView *OSViewRef;
-typedef NSMenu *OSMenuRef;
-typedef NSEvent *OSEventRef;
-#else
-typedef void *OSWindowRef;
-typedef void *OSViewRef;
-typedef void *OSMenuRef;
-typedef void *OSEventRef;
-#endif
-
-typedef PasteboardRef OSPasteboardRef;
-typedef struct AEDesc AEDescList;
-typedef AEDescList AERecord;
-typedef AERecord AppleEvent;
-
-#ifdef check
-#undef check
-#endif
diff --git a/src/plugins/platforms/cocoa/qmultitouch_mac.mm b/src/plugins/platforms/cocoa/qmultitouch_mac.mm
index 10652dc6a1..95256657fe 100644
--- a/src/plugins/platforms/cocoa/qmultitouch_mac.mm
+++ b/src/plugins/platforms/cocoa/qmultitouch_mac.mm
@@ -184,7 +184,7 @@ QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch)
if (_touchCount != _currentTouches.size()) {
// Remove all instances, and basically start from scratch:
touchPoints.clear();
- foreach (QCocoaTouch *qcocoaTouch, _currentTouches) {
+ for (QCocoaTouch *qcocoaTouch : _currentTouches) {
if (!_updateInternalStateOnly) {
qcocoaTouch->_touchPoint.state = Qt::TouchPointReleased;
touchPoints.insert(qcocoaTouch->_touchPoint.id, qcocoaTouch->_touchPoint);
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 74d0735b4c..0a18afe3a6 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -43,7 +43,7 @@
#include <AppKit/AppKit.h>
#include <MetalKit/MetalKit.h>
-#include "private/qcore_mac_p.h"
+#include <QtCore/private/qcore_mac_p.h>
QT_BEGIN_NAMESPACE
class QCocoaWindow;
diff --git a/src/plugins/platforms/cocoa/qnsview_menus.mm b/src/plugins/platforms/cocoa/qnsview_menus.mm
index b6cd832282..7ae274ab04 100644
--- a/src/plugins/platforms/cocoa/qnsview_menus.mm
+++ b/src/plugins/platforms/cocoa/qnsview_menus.mm
@@ -39,11 +39,11 @@
// This file is included from qnsview.mm, and only used to organize the code
-#include <qcocoaapplicationdelegate.h>
-#include <qcocoansmenu.h>
-#include <qcocoamenuitem.h>
-#include <qcocoamenu.h>
-#include <qcocoamenubar.h>
+#include "qcocoaapplicationdelegate.h"
+#include "qcocoansmenu.h"
+#include "qcocoamenuitem.h"
+#include "qcocoamenu.h"
+#include "qcocoamenubar.h"
static bool selectorIsCutCopyPaste(SEL selector)
{
diff --git a/src/plugins/platforms/cocoa/qnswindow.h b/src/plugins/platforms/cocoa/qnswindow.h
index 5fc48d826f..3263df3862 100644
--- a/src/plugins/platforms/cocoa/qnswindow.h
+++ b/src/plugins/platforms/cocoa/qnswindow.h
@@ -42,7 +42,7 @@
#include <qglobal.h>
#include <QPointer>
-#include "qt_mac_p.h"
+#include <QtCore/private/qcore_mac_p.h>
#include <AppKit/AppKit.h>
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
index 429c47dc3b..b50c39c9b0 100644
--- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
@@ -37,6 +37,9 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+#include <CoreGraphics/CoreGraphics.h>
+
#include "qpaintengine_mac_p.h"
#if defined(QT_PRINTSUPPORT_LIB)
#include "qprintengine_mac_p.h"
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac_p.h b/src/plugins/platforms/cocoa/qpaintengine_mac_p.h
index 1416386745..a52e9cbe1c 100644
--- a/src/plugins/platforms/cocoa/qpaintengine_mac_p.h
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac_p.h
@@ -51,15 +51,15 @@
// We mean it.
//
-#include "QtGui/qpaintengine.h"
-#include "private/qpaintengine_p.h"
-#include "private/qpolygonclipper_p.h"
-#include "private/qfont_p.h"
-#include "QtCore/qhash.h"
-
-#include "qt_mac_p.h"
+#include <QtGui/qpaintengine.h>
+#include <QtGui/private/qpaintengine_p.h>
+#include <QtGui/private/qpolygonclipper_p.h>
+#include <QtGui/private/qfont_p.h>
+#include <QtCore/qhash.h>
typedef struct CGColorSpace *CGColorSpaceRef;
+typedef struct CGContext *CGContextRef;
+
QT_BEGIN_NAMESPACE
class QCoreGraphicsPaintEnginePrivate;
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index dcb9a85a3c..9391f921ec 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -37,6 +37,9 @@
**
****************************************************************************/
+#include <AppKit/AppKit.h>
+#include <ApplicationServices/ApplicationServices.h>
+
#include "qprintengine_mac_p.h"
#include "qcocoaprintersupport.h"
#include <quuid.h>
@@ -44,6 +47,7 @@
#include <QtCore/qcoreapplication.h>
#include <QtCore/qdebug.h>
+#include <QtCore/private/qcore_mac_p.h>
#ifndef QT_NO_PRINTER
@@ -485,7 +489,7 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
int bestResolution = 0;
int dpi = value.toInt();
int bestDistance = INT_MAX;
- foreach (int resolution, d->m_printDevice->supportedResolutions()) {
+ for (int resolution : d->m_printDevice->supportedResolutions()) {
if (dpi == resolution) {
bestResolution = resolution;
break;
@@ -758,7 +762,7 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
}
case PPK_SupportedResolutions: {
QList<QVariant> list;
- foreach (int resolution, d->m_printDevice->supportedResolutions())
+ for (int resolution : d->m_printDevice->supportedResolutions())
list << resolution;
ret = list;
break;
diff --git a/src/plugins/platforms/cocoa/qt_attribution.json b/src/plugins/platforms/cocoa/qt_attribution.json
index 37c0937f29..1da0d7e370 100644
--- a/src/plugins/platforms/cocoa/qt_attribution.json
+++ b/src/plugins/platforms/cocoa/qt_attribution.json
@@ -3,7 +3,7 @@
"Name": "Cocoa Platform Plugin",
"QDocModule": "qtgui",
"QtUsage": "Code used in the Qt Platform Abstraction (QPA) for macOS.",
- "Files": "qcocoaapplication.h qcocoaapplication.mm qcocoaapplicationdelegate.h qcocoaapplicationdelegate.mm qcocoaeventdispatcher.h qcocoaeventdispatcher.mm qcocoaintrospection.h qcocoaintrospection.mm qcocoasystemtrayicon.mm qmacdefines_mac.h",
+ "Files": "qcocoaapplication.h qcocoaapplication.mm qcocoaapplicationdelegate.h qcocoaapplicationdelegate.mm qcocoaeventdispatcher.h qcocoaeventdispatcher.mm qcocoaintrospection.h qcocoaintrospection.mm qcocoasystemtrayicon.mm",
"Description": "Allows Qt to integrate into Apple's Cocoa API.",
"LicenseId": "BSD-3-Clause",
diff --git a/src/plugins/platforms/cocoa/qt_mac_p.h b/src/plugins/platforms/cocoa/qt_mac_p.h
deleted file mode 100644
index fdcf3bcdd3..0000000000
--- a/src/plugins/platforms/cocoa/qt_mac_p.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT_MAC_P_H
-#define QT_MAC_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifdef __OBJC__
-#include <AppKit/AppKit.h>
-#include <objc/runtime.h>
-#endif
-
-#include "qmacdefines_mac.h"
-
-#include <CoreServices/CoreServices.h>
-
-#include "QtCore/qglobal.h"
-#include "QtCore/qvariant.h"
-#include "QtCore/qmimedata.h"
-#include "QtCore/qpointer.h"
-#include "QtCore/qloggingcategory.h"
-#include "private/qcore_mac_p.h"
-
-
-#include "QtGui/qpainter.h"
-
-QT_BEGIN_NAMESPACE
-class QWidget;
-class QDragMoveEvent;
-
-// Simple class to manage short-lived regions
-class QMacSmartQuickDrawRegion
-{
- RgnHandle qdRgn;
- Q_DISABLE_COPY(QMacSmartQuickDrawRegion)
-public:
- explicit QMacSmartQuickDrawRegion(RgnHandle rgn) : qdRgn(rgn) {}
- ~QMacSmartQuickDrawRegion() {
- extern void qt_mac_dispose_rgn(RgnHandle); // qregion_mac.cpp
- qt_mac_dispose_rgn(qdRgn);
- }
- operator RgnHandle() {
- return qdRgn;
- }
-};
-
-class QMacInternalPasteboardMime;
-class QMimeData;
-
-
-extern QPaintDevice *qt_mac_safe_pdev; //qapplication_mac.cpp
-
-extern OSWindowRef qt_mac_window_for(const QWidget*); //qwidget_mac.mm
-extern OSViewRef qt_mac_nativeview_for(const QWidget *); //qwidget_mac.mm
-extern QPoint qt_mac_nativeMapFromParent(const QWidget *child, const QPoint &pt); //qwidget_mac.mm
-
-#ifdef check
-# undef check
-#endif
-
-struct QMacDndAnswerRecord {
- QRect rect;
- Qt::KeyboardModifiers modifiers;
- Qt::MouseButtons buttons;
- Qt::DropAction lastAction;
- unsigned int lastOperation;
- void clear() {
- rect = QRect();
- modifiers = Qt::NoModifier;
- buttons = Qt::NoButton;
- lastAction = Qt::IgnoreAction;
- lastOperation = 0;
- }
-};
-extern QMacDndAnswerRecord qt_mac_dnd_answer_rec;
-void qt_mac_copy_answer_rect(const QDragMoveEvent &event);
-bool qt_mac_mouse_inside_answer_rect(QPoint mouse);
-
-QT_END_NAMESPACE
-
-#endif // QT_MAC_P_H