From ccf968c05c1ed1d9ee749577ece8413a3a050337 Mon Sep 17 00:00:00 2001
From: Eike Ziller <eike.ziller@digia.com>
Date: Wed, 2 Oct 2013 18:13:22 +0200
Subject: [PATCH] Ios: Fix compilation with Qt4

Change-Id: I6505d158d2456bc63572e274b47dcef486ca241d
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
---
 src/plugins/ios/iosrunfactories.h    | 32 ++++++++++++++--------------
 src/tools/3rdparty/iossim/iossim.pro |  2 +-
 src/tools/3rdparty/iossim/main.mm    |  9 ++++++++
 src/tools/iostool/iosdevicemanager.h |  2 ++
 src/tools/iostool/iostool.pro        |  2 +-
 src/tools/iostool/main.cpp           | 13 +++++++++++
 6 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/src/plugins/ios/iosrunfactories.h b/src/plugins/ios/iosrunfactories.h
index d45bd47069a..5b63620e6b6 100644
--- a/src/plugins/ios/iosrunfactories.h
+++ b/src/plugins/ios/iosrunfactories.h
@@ -31,7 +31,7 @@
 
 #include <projectexplorer/runconfiguration.h>
 #include <qt4projectmanager/qmakerunconfigurationfactory.h>
-#include <qcompilerdetection.h>
+#include <utils/qtcoverride.h>
 
 namespace ProjectExplorer {
 class RunControl;
@@ -50,25 +50,25 @@ class IosRunConfigurationFactory : public Qt4ProjectManager::QmakeRunConfigurati
 public:
     explicit IosRunConfigurationFactory(QObject *parent = 0);
 
-    Q_DECL_OVERRIDE QString displayNameForId(const Core::Id id) const;
-    Q_DECL_OVERRIDE QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
+    QString displayNameForId(const Core::Id id) const QTC_OVERRIDE;
+    QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const QTC_OVERRIDE;
 
-    Q_DECL_OVERRIDE bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
-    Q_DECL_OVERRIDE ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent,
-                                                              const Core::Id id);
+    bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const QTC_OVERRIDE;
+    ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent,
+                                                              const Core::Id id) QTC_OVERRIDE;
 
-    Q_DECL_OVERRIDE bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
-    Q_DECL_OVERRIDE ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent,
-                                                               const QVariantMap &map);
+    bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const QTC_OVERRIDE;
+    ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent,
+                                                               const QVariantMap &map) QTC_OVERRIDE;
 
-    Q_DECL_OVERRIDE bool canClone(ProjectExplorer::Target *parent,
-                                  ProjectExplorer::RunConfiguration *source) const;
-    Q_DECL_OVERRIDE ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
-                                                             ProjectExplorer::RunConfiguration *source);
+    bool canClone(ProjectExplorer::Target *parent,
+                                  ProjectExplorer::RunConfiguration *source) const QTC_OVERRIDE;
+    ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
+                                                             ProjectExplorer::RunConfiguration *source) QTC_OVERRIDE;
 
-    Q_DECL_OVERRIDE bool canHandle(ProjectExplorer::Target *t) const;
-    Q_DECL_OVERRIDE QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
-                                                                        ProjectExplorer::Node *n);
+    bool canHandle(ProjectExplorer::Target *t) const QTC_OVERRIDE;
+    QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
+                                                                        ProjectExplorer::Node *n) QTC_OVERRIDE;
 private:
     ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
     ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
diff --git a/src/tools/3rdparty/iossim/iossim.pro b/src/tools/3rdparty/iossim/iossim.pro
index b613d7046e9..77f1604db54 100644
--- a/src/tools/3rdparty/iossim/iossim.pro
+++ b/src/tools/3rdparty/iossim/iossim.pro
@@ -7,7 +7,7 @@ include(../../../../qtcreator.pri)
 # Prevent from popping up in the dock when launched.
 # We embed the Info.plist file, so the application doesn't need to
 # be a bundle.
-QMAKE_LFLAGS += -sectcreate __TEXT __info_plist $$shell_quote($$PWD/Info.plist) \
+QMAKE_LFLAGS += -sectcreate __TEXT __info_plist \"$$PWD/Info.plist\" \
   -fobjc-link-runtime
 
 LIBS += \
diff --git a/src/tools/3rdparty/iossim/main.mm b/src/tools/3rdparty/iossim/main.mm
index 1f6d7ba4123..29b67c5c33d 100644
--- a/src/tools/3rdparty/iossim/main.mm
+++ b/src/tools/3rdparty/iossim/main.mm
@@ -8,7 +8,11 @@
 #import <AppKit/AppKit.h>
 #import "iphonesimulator.h"
 #include <QLibrary>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <QApplication>
+#else
 #include <QGuiApplication>
+#endif
 #include <QString>
 #include <QStringList>
 
@@ -21,7 +25,12 @@
  * Runs the iPhoneSimulator backed by a main runloop.
  */
 int main (int argc, char *argv[]) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+    QApplication a(argc, argv);
+#else
     QGuiApplication a(argc, argv);
+#endif
+
 
     //NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
diff --git a/src/tools/iostool/iosdevicemanager.h b/src/tools/iostool/iosdevicemanager.h
index 81fa6460612..4616d461261 100644
--- a/src/tools/iostool/iosdevicemanager.h
+++ b/src/tools/iostool/iosdevicemanager.h
@@ -41,6 +41,7 @@
 
 namespace Ios {
 namespace Internal {
+class DevInfoSession;
 class IosDeviceManagerPrivate;
 } // namespace Internal
 
@@ -84,6 +85,7 @@ private slots:
     void checkPendingLookups();
 private:
     friend class Internal::IosDeviceManagerPrivate;
+    friend class Internal::DevInfoSession;
     IosDeviceManager(QObject *parent = 0);
     Internal::IosDeviceManagerPrivate *d;
 };
diff --git a/src/tools/iostool/iostool.pro b/src/tools/iostool/iostool.pro
index 1e503887e2f..fe3392c6678 100644
--- a/src/tools/iostool/iostool.pro
+++ b/src/tools/iostool/iostool.pro
@@ -8,7 +8,7 @@ CONFIG   += console
 # Prevent from popping up in the dock when launched.
 # We embed the Info.plist file, so the application doesn't need to
 # be a bundle.
-QMAKE_LFLAGS += -sectcreate __TEXT __info_plist $$shell_quote($$PWD/Info.plist)
+QMAKE_LFLAGS += -sectcreate __TEXT __info_plist \"$$PWD/Info.plist\"
 CONFIG -= app_bundle
 
 LIBS += -framework CoreFoundation -framework CoreServices -framework IOKit -lssl -lbz2 -framework Security -framework SystemConfiguration
diff --git a/src/tools/iostool/main.cpp b/src/tools/iostool/main.cpp
index 44136fc3169..1cfab9d581b 100644
--- a/src/tools/iostool/main.cpp
+++ b/src/tools/iostool/main.cpp
@@ -26,7 +26,12 @@
 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 **
 ****************************************************************************/
+#include <qglobal.h>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <QApplication>
+#else
 #include <QGuiApplication>
+#endif
 #include <QTextStream>
 #include <QDebug>
 #include <QXmlStreamWriter>
@@ -81,7 +86,11 @@ IosTool::IosTool(QObject *parent):
     outFile(),
     out(&outFile)
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+    outFile.open(stdout, QIODevice::WriteOnly, QFile::DontCloseHandle);
+#else
     outFile.open(stdout, QIODevice::WriteOnly, QFileDevice::DontCloseHandle);
+#endif
     out.setAutoFormatting(true);
     out.setCodec("UTF-8");
 }
@@ -376,7 +385,11 @@ void IosTool::errorMsg(const QString &msg)
 
 int main(int argc, char *argv[])
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+    QApplication a(argc, argv);
+#else
     QGuiApplication a(argc, argv);
+#endif
     IosTool tool;
     tool.run(QCoreApplication::arguments());
     int res = a.exec();
-- 
GitLab