From 2941045a9fac40688e63b4520ef59c16429e4345 Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@nokia.com>
Date: Wed, 8 Jun 2011 13:32:03 +0200
Subject: [PATCH] QMakeStep: Ask whether to recompile if 'Enable QML debugging'
 changed

Task-number: QTCREATORBUG-4633

Change-Id: I4116e63da6633bebb21ba08084e2d8edde4fbd6d
Reviewed-on: http://codereview.qt.nokia.com/383
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
---
 src/plugins/qt4projectmanager/qmakestep.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp
index c351bb952f2..8f1c1969b26 100644
--- a/src/plugins/qt4projectmanager/qmakestep.cpp
+++ b/src/plugins/qt4projectmanager/qmakestep.cpp
@@ -43,7 +43,9 @@
 #include "qt4basetargetfactory.h"
 #include "ui_showbuildlog.h"
 
+#include <projectexplorer/buildmanager.h>
 #include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/projectexplorer.h>
 #include <projectexplorer/toolchain.h>
 
 #include <coreplugin/icore.h>
@@ -58,6 +60,7 @@
 #include <QtCore/QFile>
 #include <qtconcurrent/runextensions.h>
 #include <QtCore/QtConcurrentRun>
+#include <QtGui/QMessageBox>
 
 using namespace Qt4ProjectManager;
 using namespace Qt4ProjectManager::Internal;
@@ -412,6 +415,19 @@ void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
 
     qt4BuildConfiguration()->emitQMakeBuildConfigurationChanged();
     qt4BuildConfiguration()->emitProFileEvaluateNeeded();
+
+    int button = QMessageBox::question(QApplication::activeWindow(), tr("QML Debugging"),
+                                   tr("The option will only take effect if the project is recompiled. Do you want to recompile now?"),
+                                   QMessageBox::Yes, QMessageBox::No);
+
+    if (button == QMessageBox::Yes) {
+        Qt4BuildConfiguration *bc = qt4BuildConfiguration();
+
+        QList<ProjectExplorer::BuildStepList *> stepLists;
+        stepLists << bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
+        stepLists << bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
+        ProjectExplorerPlugin::instance()->buildManager()->buildLists(stepLists);
+    }
 }
 
 QStringList QMakeStep::parserArguments()
-- 
GitLab