From e1aa293544930b44f5518e7b143dcfdad35b6f3e Mon Sep 17 00:00:00 2001
From: Alessandro Portale <alessandro.portale@nokia.com>
Date: Mon, 4 Oct 2010 04:10:54 +0200
Subject: [PATCH] Qt Quick app wizard: Merge two .pri files into one

As an project tree unclutter measure, we now append the
deployment.pri to the qmlapplicationviewer.pri while generating
the stub for Qt Quick Apps.

At the same tame we keep te Qt Mobile App wizard intact, which
continues to generate the deployment.pri file.

And we also keep the qmlapp/app.pro template functioning as
project, therefore we leave the include(../shared/deployment.pri)
in qmlapp/app.pro and let the wizard remove that incude.

Task-Number: QTCREATORBUG-2568
Reviewed-By: ck
---
 share/qtcreator/templates/qmlapp/app.pro                   | 3 ++-
 .../qt4projectmanager/wizards/abstractmobileapp.cpp        | 1 -
 src/plugins/qt4projectmanager/wizards/mobileapp.cpp        | 1 +
 src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp | 7 ++++---
 tests/manual/qmlstandalone/main.cpp                        | 3 +--
 5 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/share/qtcreator/templates/qmlapp/app.pro b/share/qtcreator/templates/qmlapp/app.pro
index f488604cbf6..cb0abcbfd31 100644
--- a/share/qtcreator/templates/qmlapp/app.pro
+++ b/share/qtcreator/templates/qmlapp/app.pro
@@ -28,7 +28,8 @@ symbian:TARGET.UID3 = 0xE1111234
 # The .cpp file which was generated for your project. Feel free to hack it.
 SOURCES += main.cpp
 
-# Please do not modify the following three lines. Required for deployment.
+# Please do not modify the following two lines. Required for deployment.
 include(qmlapplicationviewer/qmlapplicationviewer.pri)
+# INCLUDE_DEPLOYMENT_PRI (wizard will remove the include and append deployment.pri to qmlapplicationviewer.pri, instead) #
 include(../shared/deployment.pri)
 qtcAddDeployment()
diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp b/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp
index e9775f3f13e..3c5b4a18e31 100644
--- a/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp
+++ b/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp
@@ -319,7 +319,6 @@ Core::GeneratedFiles AbstractMobileApp::generateFiles(QString *errorMessage) con
     files << file(generateFile(AbstractGeneratedFileInfo::SymbianSvgIconFile, errorMessage), path(SymbianSvgIcon));
     files << file(generateFile(AbstractGeneratedFileInfo::MaemoPngIconFile, errorMessage), path(MaemoPngIcon));
     files << file(generateFile(AbstractGeneratedFileInfo::DesktopFile, errorMessage), path(Desktop));
-    files << file(generateFile(AbstractGeneratedFileInfo::DeploymentPriFile, errorMessage), path(DeploymentPri));
     return files;
 }
 #endif // CREATORLESSTEST
diff --git a/src/plugins/qt4projectmanager/wizards/mobileapp.cpp b/src/plugins/qt4projectmanager/wizards/mobileapp.cpp
index 2debd118029..dc9bd1ff832 100644
--- a/src/plugins/qt4projectmanager/wizards/mobileapp.cpp
+++ b/src/plugins/qt4projectmanager/wizards/mobileapp.cpp
@@ -94,6 +94,7 @@ Core::GeneratedFiles MobileApp::generateFiles(QString *errorMessage) const
 {
     Core::GeneratedFiles files = AbstractMobileApp::generateFiles(errorMessage);
 
+    files.append(file(generateFile(AbstractGeneratedFileInfo::DeploymentPriFile, errorMessage), path(DeploymentPri)));
     files.append(file(generateFile(MobileAppGeneratedFileInfo::MainWindowCppFile, errorMessage), path(MainWindowCpp)));
     files.append(file(generateFile(MobileAppGeneratedFileInfo::MainWindowHFile, errorMessage), path(MainWindowH)));
     files.append(file(generateFile(MobileAppGeneratedFileInfo::MainWindowUiFile, errorMessage), path(MainWindowUi)));
diff --git a/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp b/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp
index d323107c664..b6039a61246 100644
--- a/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp
+++ b/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp
@@ -261,6 +261,8 @@ void QmlStandaloneApp::handleCurrentProFileTemplateLine(const QString &line,
         }
 
         proFile << endl;
+    } else if (line.contains(QLatin1String("# INCLUDE_DEPLOYMENT_PRI"))) {
+        proFileTemplate.readLine(); // eats 'include(deployment.pri)'
     }
 }
 
@@ -378,6 +380,7 @@ QByteArray QmlStandaloneApp::generateFileExtended(int fileType,
             break;
         case QmlAppGeneratedFileInfo::AppViewerPriFile:
             data = readBlob(path(AppViewerPriOrigin), errorMessage);
+            data.append(readBlob(path(DeploymentPriOrigin), errorMessage));
             *comment = ProFileComment;
             *versionAndCheckSum = true;
             break;
@@ -408,9 +411,7 @@ static QList<QmlAppGeneratedFileInfo> updateableFiles(const QString &mainProFile
     } files[] = {
         {QmlAppGeneratedFileInfo::AppViewerPriFile, appViewerPriFileName},
         {QmlAppGeneratedFileInfo::AppViewerHFile, appViewerHFileName},
-        {QmlAppGeneratedFileInfo::AppViewerCppFile, appViewerCppFileName},
-        {QmlAppGeneratedFileInfo::DeploymentPriFile,
-             QLatin1String("../") + AbstractMobileApp::DeploymentPriFileName}
+        {QmlAppGeneratedFileInfo::AppViewerCppFile, appViewerCppFileName}
     };
     const QFileInfo mainProFileInfo(mainProFile);
     const int size = sizeof(files) / sizeof(files[0]);
diff --git a/tests/manual/qmlstandalone/main.cpp b/tests/manual/qmlstandalone/main.cpp
index f6eaf4778ea..03a40925871 100644
--- a/tests/manual/qmlstandalone/main.cpp
+++ b/tests/manual/qmlstandalone/main.cpp
@@ -52,8 +52,7 @@ bool QmlStandaloneApp::generateFiles(QString *errorMessage) const
             && writeFile(generateFile(QmlAppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH))
             && writeFile(generateFile(QmlAppGeneratedFileInfo::SymbianSvgIconFile, errorMessage), path(SymbianSvgIcon))
             && writeFile(generateFile(QmlAppGeneratedFileInfo::MaemoPngIconFile, errorMessage), path(MaemoPngIcon))
-            && writeFile(generateFile(QmlAppGeneratedFileInfo::DesktopFile, errorMessage), path(Desktop))
-            && writeFile(generateFile(QmlAppGeneratedFileInfo::DeploymentPriFile, errorMessage), path(DeploymentPri));
+            && writeFile(generateFile(QmlAppGeneratedFileInfo::DesktopFile, errorMessage), path(Desktop));
 }
 
 QString AbstractMobileApp::templatesRoot()
-- 
GitLab