From 2d8acad3fc3a9509a405451b91dda59f1ea16637 Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@nokia.com>
Date: Thu, 1 Sep 2011 16:14:21 +0200
Subject: [PATCH] QMakeStep: Move recompilation dialog to QMakeStepConfigWidget

Change-Id: I20576fa99d9a1d04c24f9615317663e943619200
Reviewed-on: http://codereview.qt-project.org/4089
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
---
 src/plugins/qt4projectmanager/qmakestep.cpp | 47 +++++++++++----------
 src/plugins/qt4projectmanager/qmakestep.h   |  6 +--
 2 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp
index a4cb600a164..02dca1d90c4 100644
--- a/src/plugins/qt4projectmanager/qmakestep.cpp
+++ b/src/plugins/qt4projectmanager/qmakestep.cpp
@@ -419,15 +419,6 @@ void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
 
     qt4BuildConfiguration()->emitQMakeBuildConfigurationChanged();
     qt4BuildConfiguration()->emitProFileEvaluateNeeded();
-
-    Core::ICore * const core = Core::ICore::instance();
-    QMessageBox *question = new QMessageBox(core->mainWindow());
-    question->setWindowTitle(tr("QML Debugging"));
-    question->setText(tr("The option will only take effect if the project is recompiled. Do you want to recompile now?"));
-    question->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
-    question->setModal(true);
-    connect(question, SIGNAL(finished(int)), this, SLOT(recompileMessageBoxFinished(int)));
-    question->show();
 }
 
 QStringList QMakeStep::parserArguments()
@@ -495,20 +486,6 @@ bool QMakeStep::fromMap(const QVariantMap &map)
     return BuildStep::fromMap(map);
 }
 
-void QMakeStep::recompileMessageBoxFinished(int button)
-{
-    if (button == QMessageBox::Yes) {
-        Qt4BuildConfiguration *bc = qt4BuildConfiguration();
-        if (!bc)
-            return;
-
-        QList<ProjectExplorer::BuildStepList *> stepLists;
-        stepLists << bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
-        stepLists << bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
-        ProjectExplorerPlugin::instance()->buildManager()->buildLists(stepLists);
-    }
-}
-
 ////
 // QMakeStepConfigWidget
 ////
@@ -651,6 +628,16 @@ void QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked)
     updateSummaryLabel();
     updateEffectiveQMakeCall();
     updateQmlDebuggingOption();
+
+
+    Core::ICore * const core = Core::ICore::instance();
+    QMessageBox *question = new QMessageBox(core->mainWindow());
+    question->setWindowTitle(tr("QML Debugging"));
+    question->setText(tr("The option will only take effect if the project is recompiled. Do you want to recompile now?"));
+    question->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+    question->setModal(true);
+    connect(question, SIGNAL(finished(int)), this, SLOT(recompileMessageBoxFinished(int)));
+    question->show();
 }
 
 void QMakeStepConfigWidget::buildQmlDebuggingHelper()
@@ -722,6 +709,20 @@ void QMakeStepConfigWidget::updateEffectiveQMakeCall()
     m_ui->qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + m_step->allArguments());
 }
 
+void QMakeStepConfigWidget::recompileMessageBoxFinished(int button)
+{
+    if (button == QMessageBox::Yes) {
+        Qt4BuildConfiguration *bc = m_step->qt4BuildConfiguration();
+        if (!bc)
+            return;
+
+        QList<ProjectExplorer::BuildStepList *> stepLists;
+        stepLists << bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
+        stepLists << bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
+        ProjectExplorerPlugin::instance()->buildManager()->buildLists(stepLists);
+    }
+}
+
 ////
 // QMakeStepFactory
 ////
diff --git a/src/plugins/qt4projectmanager/qmakestep.h b/src/plugins/qt4projectmanager/qmakestep.h
index ea4fab08ad9..2a23acbb2e7 100644
--- a/src/plugins/qt4projectmanager/qmakestep.h
+++ b/src/plugins/qt4projectmanager/qmakestep.h
@@ -114,9 +114,6 @@ signals:
     void userArgumentsChanged();
     void linkQmlDebuggingLibraryChanged();
 
-private slots:
-    void recompileMessageBoxFinished(int button);
-
 protected:
     QMakeStep(ProjectExplorer::BuildStepList *parent, QMakeStep *source);
     QMakeStep(ProjectExplorer::BuildStepList *parent, const QString &id);
@@ -163,6 +160,9 @@ private slots:
     // other
     void buildQmlDebuggingHelper();
 
+private slots:
+    void recompileMessageBoxFinished(int button);
+
 private:
     void updateSummaryLabel();
     void updateQmlDebuggingOption();
-- 
GitLab