From 2586fc5479dfef86cf8ce688c300003d122d13eb Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 14 Feb 2013 20:36:06 +1000 Subject: [PATCH] Suggest updating boiler plate code in subprojects. Check if boiler plate code exists in all application pro files within a project and prompt user whether to update for each project. Change-Id: Ib4575be58a669193813036c4c8f4f48cc3d358e7 Reviewed-by: Daniel Teske Reviewed-by: Alessandro Portale --- .../qt4projectmanager/qt4projectmanager.cpp | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.cpp b/src/plugins/qt4projectmanager/qt4projectmanager.cpp index f8063e13cf4..a6ab2ca2694 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanager.cpp @@ -184,9 +184,10 @@ static void updateBoilerPlateCodeFiles(const AbstractMobileApp *app, const QStri foreach (const AbstractGeneratedFileInfo &info, updates) fileNames.append(QDir::toNativeSeparators(info.fileInfo.fileName())); const QString message = - Qt4Manager::tr("The following files are either outdated or have been modified:

%1" - "

Do you want Qt Creator to update the files? Any changes will be lost.") - .arg(fileNames.join(QLatin1String(", "))); + Qt4Manager::tr("In project

%1

The following files are either " + "outdated or have been modified:

%2

Do you want " + "Qt Creator to update the files? Any changes will be lost.") + .arg(proFile, fileNames.join(QLatin1String(", "))); if (QMessageBox::question(0, title, message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { QString error; if (!app->updateFiles(updates, error)) @@ -217,14 +218,24 @@ ProjectExplorer::Project *Qt4Manager::openProject(const QString &fileName, QStri } } - QtQuickApp qtQuickApp; - updateBoilerPlateCodeFiles(&qtQuickApp, canonicalFilePath); - qtQuickApp.setComponentSet(QtQuickApp::QtQuick20Components); - updateBoilerPlateCodeFiles(&qtQuickApp, canonicalFilePath); - const Html5App html5App; - updateBoilerPlateCodeFiles(&html5App, canonicalFilePath); - Qt4Project *pro = new Qt4Project(this, canonicalFilePath); + + // Update boiler plate code for subprojects. + if (pro->restoreSettings()) { + QtQuickApp qtQuickApp; + const Html5App html5App; + + foreach (Qt4ProFileNode *node, pro->applicationProFiles()) { + const QString path = node->path(); + + qtQuickApp.setComponentSet(QtQuickApp::QtQuick10Components); + updateBoilerPlateCodeFiles(&qtQuickApp, path); + qtQuickApp.setComponentSet(QtQuickApp::QtQuick20Components); + updateBoilerPlateCodeFiles(&qtQuickApp, path); + updateBoilerPlateCodeFiles(&html5App, path); + } + } + return pro; }